89f1fd6512
needs gutenprint8 packages to be uploaded. Change-Id: I1204ff8b1bb85cc0eb615082b205280daabbc290 Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
64 lines
1.2 KiB
C++
64 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;
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
extern "C" {
|
|
typedef BDataIO *(*PFN_init_transport)(BMessage *);
|
|
typedef void (*PFN_exit_transport)(void);
|
|
}
|
|
|
|
|
|
class TransportException {
|
|
public:
|
|
TransportException(const string &what_arg);
|
|
const char* What() const;
|
|
|
|
private:
|
|
string fWhat;
|
|
};
|
|
|
|
|
|
class Transport {
|
|
public:
|
|
Transport(const PrinterData* printerData);
|
|
~Transport();
|
|
|
|
void Write(const void *buffer, size_t size)
|
|
/* throw (TransportException) */;
|
|
void Read(void *buffer, size_t size)
|
|
/* throw (TransportException) */;
|
|
bool CheckAbort() const;
|
|
bool IsPrintToFileCanceled() const;
|
|
const string& LastError() const;
|
|
|
|
protected:
|
|
Transport(const Transport& transport);
|
|
Transport &operator=(const Transport& transport);
|
|
|
|
void SetLastError(const char* message);
|
|
|
|
private:
|
|
image_id fImage;
|
|
PFN_init_transport fInitTransport;
|
|
PFN_exit_transport fExitTransport;
|
|
BDataIO* fDataStream;
|
|
bool fAbort;
|
|
string fLastErrorString;
|
|
};
|
|
|
|
#endif // __TRANSPORT_H
|