]> git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdc-group.cxx
Don't generate certificates that expire on Feb 29th (Issue #5643)
[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 // 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 // 'ppdcGroup::ppdcGroup()' - Create a new group.
19 //
20
21 ppdcGroup::ppdcGroup(const char *n, // I - Name of group
22 const char *t) // I - Text of group
23 {
24 PPDC_NEWVAL(n);
25
26 name = new ppdcString(n);
27 text = new ppdcString(t);
28 options = new ppdcArray();
29 }
30
31
32 //
33 // 'ppdcGroup::ppdcGroup()' - Copy a new group.
34 //
35
36 ppdcGroup::ppdcGroup(ppdcGroup *g) // I - Group template
37 {
38 PPDC_NEWVAL(g->name->value);
39
40 g->name->retain();
41 g->text->retain();
42
43 name = g->name;
44 text = g->text;
45
46 options = new ppdcArray();
47 for (ppdcOption *o = (ppdcOption *)g->options->first();
48 o;
49 o = (ppdcOption *)g->options->next())
50 options->add(new ppdcOption(o));
51 }
52
53
54 //
55 // 'ppdcGroup::~ppdcGroup()' - Destroy a group.
56 //
57
58 ppdcGroup::~ppdcGroup()
59 {
60 PPDC_DELETEVAL(name ? name->value : NULL);
61
62 name->release();
63 text->release();
64 options->release();
65
66 name = text = 0;
67 options = 0;
68 }
69
70
71 //
72 // 'ppdcGroup::find_option()' - Find an option in a group.
73 //
74
75 ppdcOption *
76 ppdcGroup::find_option(const char *n) // I - Name of option
77 {
78 ppdcOption *o; // Current option
79
80
81 for (o = (ppdcOption *)options->first(); o; o = (ppdcOption *)options->next())
82 if (!_cups_strcasecmp(n, o->name->value))
83 return (o);
84
85 return (0);
86 }