Scribus
Open source desktop publishing at your fingertips
scstreamfilter.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 
8 #ifndef SCSTREAMFILTER_H
9 #define SCSTREAMFILTER_H
10 
11 class QByteArray;
12 class QDataStream;
13 
15 {
16 protected:
17 
18  typedef enum
19  {
20  FilterToStream = 0,
21  FilterToFilter = 1
22  } FilterMode;
23 
24  int m_writtenToStream;
25  FilterMode m_filterMode;
26  QDataStream* m_dataStream;
27  ScStreamFilter* m_filter;
28 
29  bool writeDataInternal(const char* data, int dataLen);
30 
31 public:
32 
33  ScStreamFilter(QDataStream* stream);
35  virtual ~ScStreamFilter() {};
36 
37  virtual bool openFilter (void);
38  virtual bool closeFilter(void);
39 
40  virtual bool writeData(const QByteArray& data);
41  virtual bool writeData(const char* data, int dataLen) = 0;
42 
43  int writtenToStream(void);
44 };
45 
47 {
48 public:
49  ScNullEncodeFilter(QDataStream* stream) : ScStreamFilter(stream) {};
50  ScNullEncodeFilter(ScStreamFilter* filter) : ScStreamFilter(filter) {};
51 
52  virtual bool writeData(const char* data, int dataLen) { return writeDataInternal(data, dataLen); }
53 };
54 
55 #endif
Definition: scstreamfilter.h:46
Definition: scstreamfilter.h:14