]>
Commit | Line | Data |
---|---|---|
ac884b6a | 1 | // |
503b54c9 | 2 | // Shared string class for the CUPS PPD Compiler. |
ac884b6a | 3 | // |
503b54c9 MS |
4 | // Copyright 2007-2012 by Apple Inc. |
5 | // Copyright 2002-2005 by Easy Software Products. | |
ac884b6a | 6 | // |
503b54c9 MS |
7 | // These coded instructions, statements, and computer programs are the |
8 | // property of Apple Inc. and are protected by Federal copyright | |
9 | // law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
10 | // which should have been included with this file. If this file is | |
57b7b66b | 11 | // missing or damaged, see the license at "http://www.cups.org/". |
ac884b6a MS |
12 | // |
13 | ||
14 | // | |
15 | // Include necessary headers... | |
16 | // | |
17 | ||
38e73f87 | 18 | #include "ppdc-private.h" |
ac884b6a MS |
19 | |
20 | ||
21 | // | |
22 | // 'ppdcString::ppdcString()' - Create a shared string. | |
23 | // | |
24 | ||
25 | ppdcString::ppdcString(const char *v) // I - String | |
26 | : ppdcShared() | |
27 | { | |
94da7e34 MS |
28 | PPDC_NEWVAL(v); |
29 | ||
ac884b6a MS |
30 | if (v) |
31 | { | |
5a9febac MS |
32 | size_t vlen = strlen(v); |
33 | ||
34 | value = new char[vlen + 1]; | |
35 | memcpy(value, v, vlen + 1); | |
ac884b6a MS |
36 | } |
37 | else | |
38 | value = 0; | |
39 | } | |
40 | ||
41 | ||
42 | // | |
43 | // 'ppdcString::~ppdcString()' - Destroy a shared string. | |
44 | // | |
45 | ||
46 | ppdcString::~ppdcString() | |
47 | { | |
97c9a8d7 | 48 | PPDC_DELETEVAL(value); |
94da7e34 | 49 | |
ac884b6a MS |
50 | if (value) |
51 | delete[] value; | |
52 | } |