• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Variable class for the CUPS PPD Compiler.
3 //
4 // Copyright 2007-2009 by Apple Inc.
5 // Copyright 2002-2005 by Easy Software Products.
6 //
7 // Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
8 //
9 
10 //
11 // Include necessary headers...
12 //
13 
14 #include "ppdc-private.h"
15 
16 
17 //
18 // 'ppdcVariable::ppdcVariable()' - Create a variable.
19 //
20 
ppdcVariable(const char * n,const char * v)21 ppdcVariable::ppdcVariable(const char *n,	// I - Name of variable
22                            const char *v)	// I - Value of variable
23   : ppdcShared()
24 {
25   PPDC_NEW;
26 
27   name  = new ppdcString(n);
28   value = new ppdcString(v);
29 }
30 
31 
32 //
33 // 'ppdcVariable::~ppdcVariable()' - Destroy a variable.
34 //
35 
~ppdcVariable()36 ppdcVariable::~ppdcVariable()
37 {
38   PPDC_DELETE;
39 
40   name->release();
41   value->release();
42 }
43 
44 
45 //
46 // 'ppdcVariable::set_value()' - Set the value of a variable.
47 //
48 
49 void
set_value(const char * v)50 ppdcVariable::set_value(const char *v)
51 {
52   value->release();
53   value = new ppdcString(v);
54 }
55