vfs: check userland buffers before reading them.
[haiku.git] / headers / libs / print / libprint / PrinterDriver.h
blobe9b1336e4505eb8de532cb10f9df73240f7c71b7
1 #ifndef _PRINTER_DRIVER_H
2 #define _PRINTER_DRIVER_H
5 #include <SupportDefs.h>
8 class BFile;
9 class BMessage;
10 class BNode;
11 class PrinterCap;
12 class PrinterData;
13 class GraphicsDriver;
15 #define kAttrPageSettings "libprint/page_settings"
16 #define kAttrJobSettings "libprint/job_settings"
18 class PrinterDriver {
19 public:
20 PrinterDriver(BNode* spoolFolder);
21 virtual ~PrinterDriver();
23 virtual const char* GetSignature() const = 0;
24 virtual const char* GetDriverName() const = 0;
25 virtual const char* GetVersion() const = 0;
26 virtual const char* GetCopyright() const = 0;
28 virtual PrinterCap* InstantiatePrinterCap(PrinterData* printerData) = 0;
29 virtual PrinterData* InstantiatePrinterData(BNode* node);
30 virtual GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings,
31 PrinterData* printerData,
32 PrinterCap* printerCap) = 0;
34 void InitPrinterDataAndCap();
36 virtual void About();
37 virtual char* AddPrinter(char* printerName);
38 BMessage* ConfigPage(BMessage* settings);
39 BMessage* ConfigJob(BMessage* settings);
40 BMessage* TakeJob(BFile* printJob, BMessage* settings);
42 protected:
43 PrinterData* GetPrinterData() { return fPrinterData; }
44 PrinterCap* GetPrinterCap() { return fPrinterCap; }
46 private:
47 bool _ReadSettings(const char* attrName,
48 BMessage* settings);
49 void _WriteSettings(const char* attrName,
50 BMessage* settings);
51 void _MergeWithPreviousSettings(const char* attrName,
52 BMessage* settings);
54 BNode* fSpoolFolder;
55 PrinterData* fPrinterData;
56 PrinterCap* fPrinterCap;
57 GraphicsDriver* fGraphicsDriver;
60 PrinterDriver* instantiate_printer_driver(BNode* printerFolder = NULL);
62 #endif // _PRINTER_DRIVER_H