]> git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdc-group.cxx
Merge changes from CUPS 1.4svn-r8088, the real official 1.4b1!
[thirdparty/cups.git] / ppdc / ppdc-group.cxx
1 //
2 // "$Id$"
3 //
4 // Group class for the CUPS PPD Compiler.
5 //
6 // Copyright 2007-2008 by Apple Inc.
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 // ppdcGroup::ppdcGroup() - Create a new group.
18 // ppdcGroup::ppdcGroup() - Copy a new group.
19 // ppdcGroup::~ppdcGroup() - Destroy a group.
20 // ppdcGroup::find_option() - Find an option in a group.
21 //
22
23 //
24 // Include necessary headers...
25 //
26
27 #include "ppdc.h"
28
29
30 //
31 // 'ppdcGroup::ppdcGroup()' - Create a new group.
32 //
33
34 ppdcGroup::ppdcGroup(const char *n, // I - Name of group
35 const char *t) // I - Text of group
36 {
37 name = new ppdcString(n);
38 text = new ppdcString(t);
39 options = new ppdcArray();
40 }
41
42
43 //
44 // 'ppdcGroup::ppdcGroup()' - Copy a new group.
45 //
46
47 ppdcGroup::ppdcGroup(ppdcGroup *g) // I - Group template
48 {
49 ppdcOption *o; // Current option
50
51
52 g->name->retain();
53 g->text->retain();
54
55 name = g->name;
56 text = g->text;
57
58 options = new ppdcArray();
59 for (o = (ppdcOption *)g->options->first(); o; o = (ppdcOption *)g->options->next())
60 options->add(new ppdcOption(o));
61 }
62
63
64 //
65 // 'ppdcGroup::~ppdcGroup()' - Destroy a group.
66 //
67
68 ppdcGroup::~ppdcGroup()
69 {
70 name->release();
71 text->release();
72 options->release();
73 }
74
75
76 //
77 // 'ppdcGroup::find_option()' - Find an option in a group.
78 //
79
80 ppdcOption *
81 ppdcGroup::find_option(const char *n) // I - Name of option
82 {
83 ppdcOption *o; // Current option
84
85
86 for (o = (ppdcOption *)options->first(); o; o = (ppdcOption *)options->next())
87 if (!strcasecmp(n, o->name->value))
88 return (o);
89
90 return (0);
91 }
92
93
94 //
95 // End of "$Id$".
96 //