haiku/headers/libs/print/libprint/Transport.h
Karsten Heimrich 12fd6cc2e7 * move libprint sources into libs, as it is a 3rdparty lib
* move libprint headers into libs headers folder accordingly
* merge all shared folders sources into kits print, we might build later on a
  real print kit, propably also to access cups from an nicely API, atm static
* move all shared headers into private print, also pr_server.h from interface
* adjust build to work with the changed folder layout



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26570 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-22 20:30:14 +00:00

58 lines
1.2 KiB
C++

/*
* Transport.h
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
*/
#ifndef __TRANSPORT_H
#define __TRANSPORT_H
#include <image.h>
#include <string>
class BDataIO;
class PrinterData;
#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
using namespace std;
#else
#define std
#endif
extern "C" {
typedef BDataIO *(*PFN_init_transport)(BMessage *);
typedef void (*PFN_exit_transport)(void);
}
class TransportException {
private:
string fWhat;
public:
TransportException(const string &what_arg) : fWhat(what_arg) {}
const char *what() const { return fWhat.c_str(); }
};
class Transport {
public:
Transport(const PrinterData *printer_data);
~Transport();
void write(const void *buffer, size_t size) throw(TransportException);
bool check_abort() const;
bool is_print_to_file_canceled() const;
const string &last_error() const;
protected:
void set_last_error(const char *e);
Transport(const Transport &);
Transport &operator = (const Transport &);
private:
image_id fImage;
PFN_init_transport fInitTransport;
PFN_exit_transport fExitTransport;
BDataIO *fDataStream;
bool fAbort;
string fLastErrorString;
};
#endif // __TRANSPORT_H