]> git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdc-group.cxx
Remove all of the Subversion keywords from various source files.
[thirdparty/cups.git] / ppdc / ppdc-group.cxx
1 //
2 // Group class for the CUPS PPD Compiler.
3 //
4 // Copyright 2007-2011 by Apple Inc.
5 // Copyright 2002-2005 by Easy Software Products.
6 //
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
11 // file is missing or damaged, see the license at "http://www.cups.org/".
12 //
13
14 //
15 // Include necessary headers...
16 //
17
18 #include "ppdc-private.h"
19
20
21 //
22 // 'ppdcGroup::ppdcGroup()' - Create a new group.
23 //
24
25 ppdcGroup::ppdcGroup(const char *n, // I - Name of group
26 const char *t) // I - Text of group
27 {
28 PPDC_NEWVAL(n);
29
30 name = new ppdcString(n);
31 text = new ppdcString(t);
32 options = new ppdcArray();
33 }
34
35
36 //
37 // 'ppdcGroup::ppdcGroup()' - Copy a new group.
38 //
39
40 ppdcGroup::ppdcGroup(ppdcGroup *g) // I - Group template
41 {
42 PPDC_NEWVAL(g->name->value);
43
44 g->name->retain();
45 g->text->retain();
46
47 name = g->name;
48 text = g->text;
49
50 options = new ppdcArray();
51 for (ppdcOption *o = (ppdcOption *)g->options->first();
52 o;
53 o = (ppdcOption *)g->options->next())
54 options->add(new ppdcOption(o));
55 }
56
57
58 //
59 // 'ppdcGroup::~ppdcGroup()' - Destroy a group.
60 //
61
62 ppdcGroup::~ppdcGroup()
63 {
64 PPDC_DELETEVAL(name ? name->value : NULL);
65
66 name->release();
67 text->release();
68 options->release();
69
70 name = text = 0;
71 options = 0;
72 }
73
74
75 //
76 // 'ppdcGroup::find_option()' - Find an option in a group.
77 //
78
79 ppdcOption *
80 ppdcGroup::find_option(const char *n) // I - Name of option
81 {
82 ppdcOption *o; // Current option
83
84
85 for (o = (ppdcOption *)options->first(); o; o = (ppdcOption *)options->next())
86 if (!_cups_strcasecmp(n, o->name->value))
87 return (o);
88
89 return (0);
90 }