]> cygwin.com Git - cygwin-apps/cygutils.git/blob - src/lpr/Printer.hh
Import relevant changes from MinGW and MSYS port
[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 class Printer
36 {
37 public:
38 Printer(const std::string &name, bool debugFlag) throw(PrinterException);
39 ~Printer();
40
41 void close();
42 void endDoc() throw(PrinterException);
43 void endPage() throw(PrinterException);
44 void flush() throw(PrinterException);
45 bool getRawFlag() const;
46 void print(istream & in, const std::string & docName) throw(PrinterException);
47 void put(unsigned char ch) throw(PrinterException);
48 void setRawFlag(bool flag);
49 void startDoc(const std::string & docName) throw(PrinterException);
50 void startPage() throw(PrinterException);
51 void write(unsigned char *buf, unsigned int size) throw(PrinterException);
52
53 private:
54
55 typedef std::vector<PRINTER_INFO_5> PrinterList;
56
57 // Don't want copy construction or assignment.
58 Printer(const Printer & rhs);
59 Printer & operator = (const Printer & rhs);
60
61 // Enumerate the existing printers.
62 PrinterList enumPrinters(DWORD flags, LPTSTR name) throw(PrinterException);
63
64 // Map a port name (lpt1, etc) to a device name.
65 void mapPortName() throw(PrinterException);
66
67 // Open the printer if it's not already open.
68 void open() throw(PrinterException);
69
70 std::string m_devName;
71 bool m_debugFlag;
72 HANDLE m_devHandle;
73 DEVMODE * m_devMode;
74 unsigned char * m_buffer;
75 unsigned int m_bufferSize;
76 unsigned int m_bufferIndex;
77 bool m_rawFlag;
78 };
79
80 #endif /* Printer_hh */
This page took 0.041995 seconds and 5 git commands to generate.