]>
git.saurik.com Git - apple/mdnsresponder.git/blob - Clients/PrinterSetupWizard/UtilTypes.h
e5512b982da3332e0b5e78395c856cc06aa6c678
2 * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
23 Change History (most recent first):
26 Revision 1.14 2005/06/30 18:02:54 shersche
27 <rdar://problem/4124524> Workaround for Mac OS X Printer Sharing bug
29 Revision 1.13 2005/04/13 17:46:22 shersche
30 <rdar://problem/4082122> Generic PCL not selected when printers advertise multiple text records
32 Revision 1.12 2005/03/16 03:12:28 shersche
33 <rdar://problem/4050504> Generic PCL driver isn't selected correctly on Win2K
35 Revision 1.11 2005/03/05 02:27:46 shersche
36 <rdar://problem/4030388> Generic drivers don't do color
38 Revision 1.10 2005/02/08 21:45:06 shersche
39 <rdar://problem/3947490> Default to Generic PostScript or PCL if unable to match driver
41 Revision 1.9 2005/02/01 01:16:12 shersche
42 Change window owner from CSecondPage to CPrinterSetupWizardSheet
44 Revision 1.8 2005/01/06 08:18:26 shersche
45 Add protocol field to service, add EmptyQueues() function to service
47 Revision 1.7 2005/01/04 21:07:29 shersche
48 add description member to service object. this member corresponds to the 'ty' key in a printer text record
50 Revision 1.6 2004/12/30 01:24:02 shersche
51 <rdar://problem/3906182> Remove references to description key
54 Revision 1.5 2004/12/29 18:53:38 shersche
55 <rdar://problem/3725106>
56 <rdar://problem/3737413> Added support for LPR and IPP protocols as well as support for obtaining multiple text records. Reorganized and simplified codebase.
57 Bug #: 3725106, 3737413
59 Revision 1.4 2004/09/13 21:22:44 shersche
60 <rdar://problem/3796483> Add moreComing argument to OnAddPrinter and OnRemovePrinter callbacks
63 Revision 1.3 2004/06/26 23:27:12 shersche
64 support for installing multiple printers of the same name
66 Revision 1.2 2004/06/25 02:25:59 shersche
67 Remove item field from manufacturer and model structures
68 Submitted by: herscher
70 Revision 1.1 2004/06/18 04:36:58 rpantos
81 #include <DebugServices.h>
83 class CPrinterSetupWizardSheet
;
85 #define kDefaultPriority 50
86 #define kDefaultQTotal 1
88 namespace PrinterSetupWizard
96 typedef std :: list
< Queue
*> Queues
;
97 typedef std :: list
< Printer
*> Printers
;
98 typedef std :: list
< Service
*> Services
;
99 typedef std :: list
< Model
*> Models
;
110 const std :: string
& type
113 CPrinterSetupWizardSheet
* window
;
117 // These are from the browse reply
124 // These keep track of the different services associated with this printer.
125 // the services are ordered according to preference.
130 // these are derived from the printer matching code
132 // if driverInstalled is false, then infFileName should
133 // have an absolute path to the printers inf file. this
134 // is used to install the printer from printui.dll
136 // if driverInstalled is true, then model is the name
137 // of the driver to use in AddPrinter
139 bool driverInstalled
;
141 CString manufacturer
;
142 CString displayModelName
;
147 // This let's us know that this printer was discovered via OSX Printer Sharing.
148 // We use this knowledge to workaround a problem with OS X Printer sharing.
150 bool isSharedFromOSX
;
178 // these are from the resolve
180 DNSServiceRef serviceRef
;
182 unsigned short portNumber
;
184 unsigned short qtotal
;
187 // There will usually one be one of these, however
188 // this will handle printers that have multiple
189 // queues. These are ordered according to preference.
224 find ( const CString
& name
);
230 bool driverInstalled
;
240 isSharedFromOSX ( false )
247 while ( services
. size () > 0 )
249 Service
* service
= services
. front ();
250 services
. pop_front ();
256 Printer :: LookupService
258 const std :: string
& type
261 Services :: iterator it
;
263 for ( it
= services
. begin (); it
!= services
. end (); it
++ )
265 Service
* service
= * it
;
267 if ( strcmp ( service
-> type
. c_str (), type
. c_str ()) == 0 )
279 qtotal ( kDefaultQTotal
)
286 check ( serviceRef
== NULL
);
292 Service :: SelectedQueue ()
294 return queues
. front ();
298 Service :: EmptyQueues ()
300 while ( queues
. size () > 0 )
302 Queue
* q
= queues
. front ();
311 priority ( kDefaultPriority
)
321 Manufacturer :: find ( const CString
& name
)
325 for ( it
= models
. begin (); it
!= models
. end (); it
++ )
329 if ( model
-> name
== name
)