File: qpdl.h

package info (click to toggle)
splix 2.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,608 kB
  • sloc: cpp: 4,907; makefile: 424; ansic: 42; sh: 38; xml: 34; python: 8
file content (106 lines) | stat: -rw-r--r-- 3,560 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
 *      qpdl.h                  (C) 2006-2007, Aurélien Croc (AP²C)
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; version 2 of the License.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the
 *   Free Software Foundation, Inc.,
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 *   $Id$
 */
#ifndef _QPDL_H_
#define _QPDL_H_

#include <QtCore/qglobal.h>
#include "page.h"

class QFile;
class QTextStream;

class QPDLDocument
{
    public:
        enum Type {
            SPL2,
            SPLc,
        };

        enum Color {
            Cyan    = 1,
            Magenta = 2,
            Yellow  = 3,
            Black   = 4,
        };

    protected:
        quint8                  _qpdl;
        quint16                 _width;
        quint32                 _pageNr;
        quint8                  _duplex;
        quint8                  _tumble;
        quint16                 _height;
        quint16                 _nrCopies;
        quint8                  _paperType;
        quint16                 _resolutionX;
        quint16                 _resolutionY;
        quint8                  _paperSource;
        quint8                  _currentBandNr;
        char                    _unknown[3];

        bool                    _quiet;
        bool                    _decompression;
        bool                    _dump;
        Type                    _type;
        Page                    _page;

    protected:
        enum Result {
            Error   = -1,
            Ok      = 0,
            End     = 1,
        };

    protected:
        bool                    _processBandAnalysis(quint8 color, 
                                    quint16 width, quint16 height, 
                                    quint8 compression, QByteArray& content,
                                    QTextStream& out, QTextStream& err);
        Result                  _readPageHeader(QFile& data, QTextStream& out,
                                    QTextStream& err);
        Result                  _readPageContent(QFile& data, QTextStream& out,
                                    QTextStream& err);

    public:
        QPDLDocument();

    public:
        void                    setQuiet(bool quiet) {_quiet = quiet;}
        void                    setDecompressionState(bool state)
                                {_decompression = state;}
        void                    setDump(bool state) {_dump = state;}
        void                    setType(Type type) {_type = type;}

        bool                    decompressionState() const
                                {return _decompression;}
        Type                    type() const {return _type;}
        quint32                 page() const {return _pageNr;}
        quint32                 currentBandNr() const {return _currentBandNr;}

    public:
        bool                    parse(QFile& data, QTextStream& out, 
                                    QTextStream& err);
};

#endif /* _QPDL_H_ */

/* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8 : */