]>
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 // These coded instructions, statements, and computer programs are the
8 // property of Apple Inc. and are protected by Federal copyright
9 // law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 // which should have been included with this file. If this file is
11 // file is missing or damaged, see the license at "http://www.cups.org/".
15 // Include necessary headers...
18 #include "ppdc-private.h"
22 // 'ppdcOption::ppdcOption()' - Create a new option.
25 ppdcOption::ppdcOption(ppdcOptType ot
, // I - Option type
26 const char *n
, // I - Option name
27 const char *t
, // I - Option text
28 ppdcOptSection s
, // I - Section
29 float o
) // I - Ordering number
35 name
= new ppdcString(n
);
36 text
= new ppdcString(t
);
39 choices
= new ppdcArray();
45 // 'ppdcOption::ppdcOption()' - Copy a new option.
48 ppdcOption::ppdcOption(ppdcOption
*o
) // I - Template option
55 o
->defchoice
->retain();
62 choices
= new ppdcArray(o
->choices
);
63 defchoice
= o
->defchoice
;
68 // 'ppdcOption::~ppdcOption()' - Destroy an option.
71 ppdcOption::~ppdcOption()
84 // 'ppdcOption::find_choice()' - Find an option choice.
87 ppdcChoice
* // O - Choice or NULL
88 ppdcOption::find_choice(const char *n
) // I - Name of choice
90 ppdcChoice
*c
; // Current choice
93 for (c
= (ppdcChoice
*)choices
->first(); c
; c
= (ppdcChoice
*)choices
->next())
94 if (!_cups_strcasecmp(n
, c
->name
->value
))
102 // 'ppdcOption::set_defchoice()' - Set the default choice.
106 ppdcOption::set_defchoice(ppdcChoice
*c
) // I - Choice
109 defchoice
->release();