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