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