]>
git.ipfire.org Git - thirdparty/cups.git/blob - ppdc/ppdc-option.cxx
2 // Option class for the CUPS PPD Compiler.
4 // Copyright 2007-2011 by Apple Inc.
5 // Copyright 2002-2005 by Easy Software Products.
7 // Licensed under Apache License v2.0. See the file "LICENSE" for more information.
11 // Include necessary headers...
14 #include "ppdc-private.h"
18 // 'ppdcOption::ppdcOption()' - Create a new option.
21 ppdcOption::ppdcOption(ppdcOptType ot
, // I - Option type
22 const char *n
, // I - Option name
23 const char *t
, // I - Option text
24 ppdcOptSection s
, // I - Section
25 float o
) // I - Ordering number
31 name
= new ppdcString(n
);
32 text
= new ppdcString(t
);
35 choices
= new ppdcArray();
41 // 'ppdcOption::ppdcOption()' - Copy a new option.
44 ppdcOption::ppdcOption(ppdcOption
*o
) // I - Template option
51 o
->defchoice
->retain();
58 choices
= new ppdcArray(o
->choices
);
59 defchoice
= o
->defchoice
;
64 // 'ppdcOption::~ppdcOption()' - Destroy an option.
67 ppdcOption::~ppdcOption()
80 // 'ppdcOption::find_choice()' - Find an option choice.
83 ppdcChoice
* // O - Choice or NULL
84 ppdcOption::find_choice(const char *n
) // I - Name of choice
86 ppdcChoice
*c
; // Current choice
89 for (c
= (ppdcChoice
*)choices
->first(); c
; c
= (ppdcChoice
*)choices
->next())
90 if (!_cups_strcasecmp(n
, c
->name
->value
))
98 // 'ppdcOption::set_defchoice()' - Set the default choice.
102 ppdcOption::set_defchoice(ppdcChoice
*c
) // I - Choice
105 defchoice
->release();