Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXGZFileStream.h
1 /********************************************************************************
2 * *
3 * G Z F i l e S t r e a m C l a s s e s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2002,2017 by Sander Jansen. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifdef HAVE_ZLIB_H
22 #ifndef FXGZFILESTREAM_H
23 #define FXGZFILESTREAM_H
24 
25 #ifndef FXFILESTREAM_H
26 #include "FXFileStream.h"
27 #endif
28 
29 namespace FX {
30 
31 
32 struct ZBlock;
33 
34 
36 class FXAPI FXGZFileStream : public FXFileStream {
37 private:
38  ZBlock *gz;
39  int ac;
40 protected:
41  virtual FXuval writeBuffer(FXuval count);
42  virtual FXuval readBuffer(FXuval count);
43 public:
44 
46  FXGZFileStream(const FXObject* cont=NULL);
47 
49  FXGZFileStream(const FXString& filename,FXStreamDirection save_or_load=FXStreamLoad,FXuval size=8192UL);
50 
52  FXbool open(const FXString& filename,FXStreamDirection save_or_load=FXStreamLoad,FXuval size=8192UL);
53 
55  virtual FXbool flush();
56 
58  virtual FXbool close();
59 
61  FXlong position() const { return FXStream::position(); }
62 
64  virtual FXbool position(FXlong,FXWhence){ return false; }
65 
67  FXGZFileStream& operator<<(const FXuchar& v){ FXStream::operator<<(v); return *this; }
68  FXGZFileStream& operator<<(const FXchar& v){ FXStream::operator<<(v); return *this; }
69  FXGZFileStream& operator<<(const FXbool& v){ FXStream::operator<<(v); return *this; }
70  FXGZFileStream& operator<<(const FXushort& v){ FXStream::operator<<(v); return *this; }
71  FXGZFileStream& operator<<(const FXshort& v){ FXStream::operator<<(v); return *this; }
72  FXGZFileStream& operator<<(const FXuint& v){ FXStream::operator<<(v); return *this; }
73  FXGZFileStream& operator<<(const FXint& v){ FXStream::operator<<(v); return *this; }
74  FXGZFileStream& operator<<(const FXfloat& v){ FXStream::operator<<(v); return *this; }
75  FXGZFileStream& operator<<(const FXdouble& v){ FXStream::operator<<(v); return *this; }
76  FXGZFileStream& operator<<(const FXlong& v){ FXStream::operator<<(v); return *this; }
77  FXGZFileStream& operator<<(const FXulong& v){ FXStream::operator<<(v); return *this; }
78 
80  FXGZFileStream& save(const FXuchar* p,FXuval n){ FXStream::save(p,n); return *this; }
81  FXGZFileStream& save(const FXchar* p,FXuval n){ FXStream::save(p,n); return *this; }
82  FXGZFileStream& save(const FXbool* p,FXuval n){ FXStream::save(p,n); return *this; }
83  FXGZFileStream& save(const FXushort* p,FXuval n){ FXStream::save(p,n); return *this; }
84  FXGZFileStream& save(const FXshort* p,FXuval n){ FXStream::save(p,n); return *this; }
85  FXGZFileStream& save(const FXuint* p,FXuval n){ FXStream::save(p,n); return *this; }
86  FXGZFileStream& save(const FXint* p,FXuval n){ FXStream::save(p,n); return *this; }
87  FXGZFileStream& save(const FXfloat* p,FXuval n){ FXStream::save(p,n); return *this; }
88  FXGZFileStream& save(const FXdouble* p,FXuval n){ FXStream::save(p,n); return *this; }
89  FXGZFileStream& save(const FXlong* p,FXuval n){ FXStream::save(p,n); return *this; }
90  FXGZFileStream& save(const FXulong* p,FXuval n){ FXStream::save(p,n); return *this; }
91 
93  FXGZFileStream& operator>>(FXuchar& v){ FXStream::operator>>(v); return *this; }
94  FXGZFileStream& operator>>(FXchar& v){ FXStream::operator>>(v); return *this; }
95  FXGZFileStream& operator>>(FXbool& v){ FXStream::operator>>(v); return *this; }
96  FXGZFileStream& operator>>(FXushort& v){ FXStream::operator>>(v); return *this; }
97  FXGZFileStream& operator>>(FXshort& v){ FXStream::operator>>(v); return *this; }
98  FXGZFileStream& operator>>(FXuint& v){ FXStream::operator>>(v); return *this; }
99  FXGZFileStream& operator>>(FXint& v){ FXStream::operator>>(v); return *this; }
100  FXGZFileStream& operator>>(FXfloat& v){ FXStream::operator>>(v); return *this; }
101  FXGZFileStream& operator>>(FXdouble& v){ FXStream::operator>>(v); return *this; }
102  FXGZFileStream& operator>>(FXlong& v){ FXStream::operator>>(v); return *this; }
103  FXGZFileStream& operator>>(FXulong& v){ FXStream::operator>>(v); return *this; }
104 
106  FXGZFileStream& load(FXuchar* p,FXuval n){ FXStream::load(p,n); return *this; }
107  FXGZFileStream& load(FXchar* p,FXuval n){ FXStream::load(p,n); return *this; }
108  FXGZFileStream& load(FXbool* p,FXuval n){ FXStream::load(p,n); return *this; }
109  FXGZFileStream& load(FXushort* p,FXuval n){ FXStream::load(p,n); return *this; }
110  FXGZFileStream& load(FXshort* p,FXuval n){ FXStream::load(p,n); return *this; }
111  FXGZFileStream& load(FXuint* p,FXuval n){ FXStream::load(p,n); return *this; }
112  FXGZFileStream& load(FXint* p,FXuval n){ FXStream::load(p,n); return *this; }
113  FXGZFileStream& load(FXfloat* p,FXuval n){ FXStream::load(p,n); return *this; }
114  FXGZFileStream& load(FXdouble* p,FXuval n){ FXStream::load(p,n); return *this; }
115  FXGZFileStream& load(FXlong* p,FXuval n){ FXStream::load(p,n); return *this; }
116  FXGZFileStream& load(FXulong* p,FXuval n){ FXStream::load(p,n); return *this; }
117 
119  FXGZFileStream& saveObject(const FXObject* v){ FXStream::saveObject(v); return *this; }
120 
122  FXGZFileStream& loadObject(FXObject*& v){ FXStream::loadObject(v); return *this; }
123 
125  virtual ~FXGZFileStream();
126  };
127 
128 }
129 
130 
131 #endif
132 #endif

Copyright © 1997-2016 Jeroen van der Zijp