]>
git.saurik.com Git - apple/mdnsresponder.git/blob - Clients/PrinterSetupWizard/UtilTypes.h
aad29f1cb250d269a1567f7181aaf71f25c184a8
1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 Change History (most recent first):
20 Revision 1.15 2006/08/14 23:24:09 cheshire
21 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
23 Revision 1.14 2005/06/30 18:02:54 shersche
24 <rdar://problem/4124524> Workaround for Mac OS X Printer Sharing bug
26 Revision 1.13 2005/04/13 17:46:22 shersche
27 <rdar://problem/4082122> Generic PCL not selected when printers advertise multiple text records
29 Revision 1.12 2005/03/16 03:12:28 shersche
30 <rdar://problem/4050504> Generic PCL driver isn't selected correctly on Win2K
32 Revision 1.11 2005/03/05 02:27:46 shersche
33 <rdar://problem/4030388> Generic drivers don't do color
35 Revision 1.10 2005/02/08 21:45:06 shersche
36 <rdar://problem/3947490> Default to Generic PostScript or PCL if unable to match driver
38 Revision 1.9 2005/02/01 01:16:12 shersche
39 Change window owner from CSecondPage to CPrinterSetupWizardSheet
41 Revision 1.8 2005/01/06 08:18:26 shersche
42 Add protocol field to service, add EmptyQueues() function to service
44 Revision 1.7 2005/01/04 21:07:29 shersche
45 add description member to service object. this member corresponds to the 'ty' key in a printer text record
47 Revision 1.6 2004/12/30 01:24:02 shersche
48 <rdar://problem/3906182> Remove references to description key
51 Revision 1.5 2004/12/29 18:53:38 shersche
52 <rdar://problem/3725106>
53 <rdar://problem/3737413> Added support for LPR and IPP protocols as well as support for obtaining multiple text records. Reorganized and simplified codebase.
54 Bug #: 3725106, 3737413
56 Revision 1.4 2004/09/13 21:22:44 shersche
57 <rdar://problem/3796483> Add moreComing argument to OnAddPrinter and OnRemovePrinter callbacks
60 Revision 1.3 2004/06/26 23:27:12 shersche
61 support for installing multiple printers of the same name
63 Revision 1.2 2004/06/25 02:25:59 shersche
64 Remove item field from manufacturer and model structures
65 Submitted by: herscher
67 Revision 1.1 2004/06/18 04:36:58 rpantos
78 #include <DebugServices.h>
80 class CPrinterSetupWizardSheet
;
82 #define kDefaultPriority 50
83 #define kDefaultQTotal 1
85 namespace PrinterSetupWizard
93 typedef std :: list
< Queue
*> Queues
;
94 typedef std :: list
< Printer
*> Printers
;
95 typedef std :: list
< Service
*> Services
;
96 typedef std :: list
< Model
*> Models
;
107 const std :: string
& type
110 CPrinterSetupWizardSheet
* window
;
114 // These are from the browse reply
121 // These keep track of the different services associated with this printer.
122 // the services are ordered according to preference.
127 // these are derived from the printer matching code
129 // if driverInstalled is false, then infFileName should
130 // have an absolute path to the printers inf file. this
131 // is used to install the printer from printui.dll
133 // if driverInstalled is true, then model is the name
134 // of the driver to use in AddPrinter
136 bool driverInstalled
;
138 CString manufacturer
;
139 CString displayModelName
;
144 // This let's us know that this printer was discovered via OSX Printer Sharing.
145 // We use this knowledge to workaround a problem with OS X Printer sharing.
147 bool isSharedFromOSX
;
175 // these are from the resolve
177 DNSServiceRef serviceRef
;
179 unsigned short portNumber
;
181 unsigned short qtotal
;
184 // There will usually one be one of these, however
185 // this will handle printers that have multiple
186 // queues. These are ordered according to preference.
221 find ( const CString
& name
);
227 bool driverInstalled
;
237 isSharedFromOSX ( false )
244 while ( services
. size () > 0 )
246 Service
* service
= services
. front ();
247 services
. pop_front ();
253 Printer :: LookupService
255 const std :: string
& type
258 Services :: iterator it
;
260 for ( it
= services
. begin (); it
!= services
. end (); it
++ )
262 Service
* service
= * it
;
264 if ( strcmp ( service
-> type
. c_str (), type
. c_str ()) == 0 )
276 qtotal ( kDefaultQTotal
)
283 check ( serviceRef
== NULL
);
289 Service :: SelectedQueue ()
291 return queues
. front ();
295 Service :: EmptyQueues ()
297 while ( queues
. size () > 0 )
299 Queue
* q
= queues
. front ();
308 priority ( kDefaultPriority
)
318 Manufacturer :: find ( const CString
& name
)
322 for ( it
= models
. begin (); it
!= models
. end (); it
++ )
326 if ( model
-> name
== name
)