1// 2// "$Id: ppdc-group.cxx 3277 2011-05-20 07:30:39Z msweet $" 3// 4// Group class for the CUPS PPD Compiler. 5// 6// Copyright 2007-2011 by Apple Inc. 7// Copyright 2002-2005 by Easy Software Products. 8// 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/". 14// 15// Contents: 16// 17// ppdcGroup::ppdcGroup() - Copy a new group. 18// ppdcGroup::~ppdcGroup() - Destroy a group. 19// ppdcGroup::find_option() - Find an option in a group. 20// 21 22// 23// Include necessary headers... 24// 25 26#include "ppdc-private.h" 27 28 29// 30// 'ppdcGroup::ppdcGroup()' - Create a new group. 31// 32 33ppdcGroup::ppdcGroup(const char *n, // I - Name of group 34 const char *t) // I - Text of group 35{ 36 PPDC_NEWVAL(n); 37 38 name = new ppdcString(n); 39 text = new ppdcString(t); 40 options = new ppdcArray(); 41} 42 43 44// 45// 'ppdcGroup::ppdcGroup()' - Copy a new group. 46// 47 48ppdcGroup::ppdcGroup(ppdcGroup *g) // I - Group template 49{ 50 PPDC_NEWVAL(g->name->value); 51 52 g->name->retain(); 53 g->text->retain(); 54 55 name = g->name; 56 text = g->text; 57 58 options = new ppdcArray(); 59 for (ppdcOption *o = (ppdcOption *)g->options->first(); 60 o; 61 o = (ppdcOption *)g->options->next()) 62 options->add(new ppdcOption(o)); 63} 64 65 66// 67// 'ppdcGroup::~ppdcGroup()' - Destroy a group. 68// 69 70ppdcGroup::~ppdcGroup() 71{ 72 PPDC_DELETEVAL(name ? name->value : NULL); 73 74 name->release(); 75 text->release(); 76 options->release(); 77 78 name = text = 0; 79 options = 0; 80} 81 82 83// 84// 'ppdcGroup::find_option()' - Find an option in a group. 85// 86 87ppdcOption * 88ppdcGroup::find_option(const char *n) // I - Name of option 89{ 90 ppdcOption *o; // Current option 91 92 93 for (o = (ppdcOption *)options->first(); o; o = (ppdcOption *)options->next()) 94 if (!_cups_strcasecmp(n, o->name->value)) 95 return (o); 96 97 return (0); 98} 99 100 101// 102// End of "$Id: ppdc-group.cxx 3277 2011-05-20 07:30:39Z msweet $". 103// 104