Subversion Repositories Scribus

Rev

Rev 11801 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
8022 jghali 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
 
8024 jghali 8
#ifndef SCGZFILE_H
9
#define SCGZFILE_H
10
 
11801 jghali 11
#include <QByteArray>
12
#include <QIODevice>
9968 fschmid 13
#include <QString>
8022 jghali 14
 
15
#include "scribusapi.h"
16
 
11801 jghali 17
struct ScGzFileDataPrivate;
11739 jghali 18
 
11801 jghali 19
class SCRIBUS_API ScGzFile : public QIODevice
8022 jghali 20
{
21
protected:
11801 jghali 22
        QString              m_fileName;
23
        ScGzFileDataPrivate* m_data;
24
        ScGzFileDataPrivate* newPrivateData(void);
25
        void freeData(void);
11739 jghali 26
 
11801 jghali 27
        bool    gzFileOpen(QString fileName, ScGzFileDataPrivate* data, QIODevice::OpenMode mode);
11739 jghali 28
 
11801 jghali 29
        virtual qint64 readData  (char * data, qint64 maxSize);
11739 jghali 30
        virtual qint64 writeData (const char * data, qint64 maxSize);
31
 
8022 jghali 32
public:
33
        ScGzFile(const QString& filename);
11739 jghali 34
        ~ScGzFile(void);
8022 jghali 35
 
36
        static const int gzipExpansionFactor;
11739 jghali 37
 
12788 jghali 38
        virtual bool atEnd() const;
11739 jghali 39
        virtual bool open(QIODevice::OpenMode mode);
40
        virtual void close();
8022 jghali 41
 
11801 jghali 42
        bool errorOccurred(void) const;
43
        int  error(void) const;
44
 
45
        bool reset(void);
46
 
11739 jghali 47
        static bool readFromFile(const QString& filename, QByteArray& bArray, uint maxBytes = 0);
11752 jghali 48
        static bool writeToFile (const QString& filename, const QByteArray& bArray);
49
        static bool writeToFile (const QString& filename, const QByteArray& bArray, const char* header);
8022 jghali 50
};
8024 jghali 51
 
52
#endif