]>
git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdc-option.cxx
4 // Option class for the CUPS PPD Compiler.
6 // Copyright 2007-2009 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() - Copy a new option.
18 // ppdcOption::~ppdcOption() - Destroy an option.
19 // ppdcOption::find_choice() - Find an option choice.
20 // ppdcOption::set_defchoice() - Set the default choice.
24 // Include necessary headers...
31 // 'ppdcOption::ppdcOption()' - Create a new option.
34 ppdcOption::ppdcOption(ppdcOptType ot
, // I - Option type
35 const char *n
, // I - Option name
36 const char *t
, // I - Option text
37 ppdcOptSection s
, // I - Section
38 float o
) // I - Ordering number
44 name
= new ppdcString(n
);
45 text
= new ppdcString(t
);
48 choices
= new ppdcArray();
54 // 'ppdcOption::ppdcOption()' - Copy a new option.
57 ppdcOption::ppdcOption(ppdcOption
*o
) // I - Template option
64 o
->defchoice
->retain();
71 choices
= new ppdcArray(o
->choices
);
72 defchoice
= o
->defchoice
;
77 // 'ppdcOption::~ppdcOption()' - Destroy an option.
80 ppdcOption::~ppdcOption()
93 // 'ppdcOption::find_choice()' - Find an option choice.
96 ppdcChoice
* // O - Choice or NULL
97 ppdcOption::find_choice(const char *n
) // I - Name of choice
99 ppdcChoice
*c
; // Current choice
102 for (c
= (ppdcChoice
*)choices
->first(); c
; c
= (ppdcChoice
*)choices
->next())
103 if (!strcasecmp(n
, c
->name
->value
))
111 // 'ppdcOption::set_defchoice()' - Set the default choice.
115 ppdcOption::set_defchoice(ppdcChoice
*c
) // I - Choice
118 defchoice
->release();