]>
git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdc-option.cxx
4 // Option class for the CUPS PPD Compiler.
6 // Copyright 2007 by Apple Inc.
7 // Copyright 2002-2005 by Easy Software Products.
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/".
17 // ppdcOption::ppdcOption() - Create a new option.
18 // ppdcOption::ppdcOption() - Copy a new option.
19 // ppdcOption::~ppdcOption() - Destroy an option.
20 // ppdcOption::find_choice() - Find an option choice.
21 // ppdcOption::set_defchoice() - Set the default choice.
25 // Include necessary headers...
32 // 'ppdcOption::ppdcOption()' - Create a new option.
35 ppdcOption::ppdcOption(ppdcOptType ot
, // I - Option type
36 const char *n
, // I - Option name
37 const char *t
, // I - Option text
38 ppdcOptSection s
, // I - Section
39 float o
) // I - Ordering number
41 // printf("ppdcOption(ot=%d, n=\"%s\", t=\"%s\"), this=%p\n",
45 name
= new ppdcString(n
);
46 text
= new ppdcString(t
);
49 choices
= new ppdcArray();
55 // 'ppdcOption::ppdcOption()' - Copy a new option.
58 ppdcOption::ppdcOption(ppdcOption
*o
) // I - Template option
70 choices
= new ppdcArray(o
->choices
);
71 defchoice
= o
->defchoice
;
76 // 'ppdcOption::~ppdcOption()' - Destroy an option.
79 ppdcOption::~ppdcOption()
90 // 'ppdcOption::find_choice()' - Find an option choice.
93 ppdcChoice
* // O - Choice or NULL
94 ppdcOption::find_choice(const char *n
) // I - Name of choice
96 ppdcChoice
*c
; // Current choice
99 for (c
= (ppdcChoice
*)choices
->first(); c
; c
= (ppdcChoice
*)choices
->next())
100 if (!strcasecmp(n
, c
->name
->value
))
108 // 'ppdcOption::set_defchoice()' - Set the default choice.
112 ppdcOption::set_defchoice(ppdcChoice
*c
) // I - Choice
115 defchoice
->release();