]> cygwin.com Git - cygwin-apps/cygutils.git/blob - src/lpr/Printer.hh
Reimplement lpr in C++, Rick Rankin.
[cygwin-apps/cygutils.git] / src / lpr / Printer.hh
1 /*
2 * lpr for cygwin/windows
3 *
4 * Copyright (C) 2000-2003 Rick Rankin
5 * http://www.cygwin.com/ml/cygwin/2000-07/msg00320.html
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation in version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #if !defined(Printer_hh)
22 #define Printer_hh
23
24 #if HAVE_CONFIG_H
25 # include "config.h"
26 #endif
27 #include "common.h"
28
29 #include <string>
30 #include <memory>
31 #include <vector>
32
33 #include "src/lpr/PrinterException.hh"
34
35 using namespace std;
36
37 class Printer
38 {
39 public:
40 Printer(const string &name, bool debugFlag)
41 throw(PrinterException);
42 ~Printer();
43
44 void close();
45 void endDoc()
46 throw(PrinterException);
47 void endPage()
48 throw(PrinterException);
49 void flush()
50 throw(PrinterException);
51 void print(istream & in, const string & docName)
52 throw(PrinterException);
53 void put(unsigned char ch)
54 throw(PrinterException);
55 void startDoc(const string & docName)
56 throw(PrinterException);
57 void startPage()
58 throw(PrinterException);
59 void write(unsigned char *buf, unsigned int size)
60 throw(PrinterException);
61
62 private:
63
64 typedef vector<PRINTER_INFO_5> PrinterList;
65
66 // Don't want copy construction or assignment.
67 Printer(const Printer & rhs);
68 Printer & operator = (const Printer & rhs);
69
70 // Enumerate the existing printers.
71 PrinterList enumPrinters(DWORD flags, LPTSTR name)
72 throw(PrinterException);
73
74 // Map a port name (lpt1, etc) to a device name.
75 void mapPortName()
76 throw(PrinterException);
77
78 // Open the printer if it's not already open.
79 void open()
80 throw(PrinterException);
81
82 string m_devName;
83 bool m_debugFlag;
84 HANDLE m_devHandle;
85 DEVMODE * m_devMode;
86 unsigned char * m_buffer;
87 unsigned int m_bufferSize;
88 unsigned int m_bufferIndex;
89 };
90
91 #endif /* Printer_hh */
This page took 0.0387150000000001 seconds and 5 git commands to generate.