xref: /haiku/src/libs/print/libprint/PrinterCap.cpp (revision 16d5c24e533eb14b7b8a99ee9f3ec9ba66335b1e)
1 /*
2  * PrinterCap.cpp
3  * Copyright 1999-2000 Y.Takagi. All Rights Reserved.
4  */
5 
6 #include "PrinterCap.h"
7 #include "PrinterData.h"
8 
9 PrinterCap::PrinterCap(const PrinterData *printer_data)
10 	: fPrinterData(printer_data),
11 	fPrinterID(kUnknownPrinter)
12 {
13 }
14 
15 PrinterCap::~PrinterCap()
16 {
17 }
18 
19 const BaseCap *PrinterCap::getDefaultCap(CapID id) const
20 {
21 	int count = countCap(id);
22 	if (count > 0) {
23 		const BaseCap **base_cap = enumCap(id);
24 		while (count--) {
25 			if ((*base_cap)->is_default) {
26 				return *base_cap;
27 			}
28 			base_cap++;
29 		}
30 	}
31 	return NULL;
32 }
33 
34 int PrinterCap::getProtocolClass() const {
35 	return fPrinterData->getProtocolClass();
36 }
37