]> git.ipfire.org Git - thirdparty/cups.git/blame - ppdc/ppdc-string.cxx
License change: Apache License, Version 2.0.
[thirdparty/cups.git] / ppdc / ppdc-string.cxx
CommitLineData
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//
e3101897 7// Licensed under Apache License v2.0. See the file "LICENSE" for more information.
ac884b6a
MS
8//
9
10//
11// Include necessary headers...
12//
13
38e73f87 14#include "ppdc-private.h"
ac884b6a
MS
15
16
17//
18// 'ppdcString::ppdcString()' - Create a shared string.
19//
20
21ppdcString::ppdcString(const char *v) // I - String
22 : ppdcShared()
23{
94da7e34
MS
24 PPDC_NEWVAL(v);
25
ac884b6a
MS
26 if (v)
27 {
5a9febac
MS
28 size_t vlen = strlen(v);
29
30 value = new char[vlen + 1];
31 memcpy(value, v, vlen + 1);
ac884b6a
MS
32 }
33 else
34 value = 0;
35}
36
37
38//
39// 'ppdcString::~ppdcString()' - Destroy a shared string.
40//
41
42ppdcString::~ppdcString()
43{
97c9a8d7 44 PPDC_DELETEVAL(value);
94da7e34 45
ac884b6a
MS
46 if (value)
47 delete[] value;
48}