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

FXBZFileStream.h
1 /********************************************************************************
2 * *
3 * B Z F i l e S t r e a m C l a s s e s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1999,2017 by Lyle Johnson. 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_BZ2LIB_H
22 #ifndef FXBZFILESTREAM_H
23 #define FXBZFILESTREAM_H
24 
25 #ifndef FXFILESTREAM_H
26 #include "FXFileStream.h"
27 #endif
28 
29 
30 namespace FX {
31 
32 
33 struct BZBlock;
34 
35 
37 class FXAPI FXBZFileStream : public FXFileStream {
38 private:
39  BZBlock *bz;
40  int ac;
41 protected:
42  virtual FXuval writeBuffer(FXuval count);
43  virtual FXuval readBuffer(FXuval count);
44 public:
45 
47  FXBZFileStream(const FXObject* cont=NULL);
48 
50  FXBZFileStream(const FXString& filename,FXStreamDirection save_or_load=FXStreamLoad,FXuval size=8192UL);
51 
53  FXbool open(const FXString& filename,FXStreamDirection save_or_load=FXStreamLoad,FXuval size=8192UL);
54 
56  virtual FXbool flush();
57 
59  virtual FXbool close();
60 
62  FXlong position() const { return FXStream::position(); }
63 
65  virtual FXbool position(FXlong,FXWhence){ return false; }
66 
68  FXBZFileStream& operator<<(const FXuchar& v){ FXStream::operator<<(v); return *this; }
69  FXBZFileStream& operator<<(const FXchar& v){ FXStream::operator<<(v); return *this; }
70  FXBZFileStream& operator<<(const FXbool& v){ FXStream::operator<<(v); return *this; }
71  FXBZFileStream& operator<<(const FXushort& v){ FXStream::operator<<(v); return *this; }
72  FXBZFileStream& operator<<(const FXshort& v){ FXStream::operator<<(v); return *this; }
73  FXBZFileStream& operator<<(const FXuint& v){ FXStream::operator<<(v); return *this; }
74  FXBZFileStream& operator<<(const FXint& v){ FXStream::operator<<(v); return *this; }
75  FXBZFileStream& operator<<(const FXfloat& v){ FXStream::operator<<(v); return *this; }
76  FXBZFileStream& operator<<(const FXdouble& v){ FXStream::operator<<(v); return *this; }
77  FXBZFileStream& operator<<(const FXlong& v){ FXStream::operator<<(v); return *this; }
78  FXBZFileStream& operator<<(const FXulong& v){ FXStream::operator<<(v); return *this; }
79 
81  FXBZFileStream& save(const FXuchar* p,FXuval n){ FXStream::save(p,n); return *this; }
82  FXBZFileStream& save(const FXchar* p,FXuval n){ FXStream::save(p,n); return *this; }
83  FXBZFileStream& save(const FXbool* p,FXuval n){ FXStream::save(p,n); return *this; }
84  FXBZFileStream& save(const FXushort* p,FXuval n){ FXStream::save(p,n); return *this; }
85  FXBZFileStream& save(const FXshort* p,FXuval n){ FXStream::save(p,n); return *this; }
86  FXBZFileStream& save(const FXuint* p,FXuval n){ FXStream::save(p,n); return *this; }
87  FXBZFileStream& save(const FXint* p,FXuval n){ FXStream::save(p,n); return *this; }
88  FXBZFileStream& save(const FXfloat* p,FXuval n){ FXStream::save(p,n); return *this; }
89  FXBZFileStream& save(const FXdouble* p,FXuval n){ FXStream::save(p,n); return *this; }
90  FXBZFileStream& save(const FXlong* p,FXuval n){ FXStream::save(p,n); return *this; }
91  FXBZFileStream& save(const FXulong* p,FXuval n){ FXStream::save(p,n); return *this; }
92 
94  FXBZFileStream& operator>>(FXuchar& v){ FXStream::operator>>(v); return *this; }
95  FXBZFileStream& operator>>(FXchar& v){ FXStream::operator>>(v); return *this; }
96  FXBZFileStream& operator>>(FXbool& v){ FXStream::operator>>(v); return *this; }
97  FXBZFileStream& operator>>(FXushort& v){ FXStream::operator>>(v); return *this; }
98  FXBZFileStream& operator>>(FXshort& v){ FXStream::operator>>(v); return *this; }
99  FXBZFileStream& operator>>(FXuint& v){ FXStream::operator>>(v); return *this; }
100  FXBZFileStream& operator>>(FXint& v){ FXStream::operator>>(v); return *this; }
101  FXBZFileStream& operator>>(FXfloat& v){ FXStream::operator>>(v); return *this; }
102  FXBZFileStream& operator>>(FXdouble& v){ FXStream::operator>>(v); return *this; }
103  FXBZFileStream& operator>>(FXlong& v){ FXStream::operator>>(v); return *this; }
104  FXBZFileStream& operator>>(FXulong& v){ FXStream::operator>>(v); return *this; }
105 
107  FXBZFileStream& load(FXuchar* p,FXuval n){ FXStream::load(p,n); return *this; }
108  FXBZFileStream& load(FXchar* p,FXuval n){ FXStream::load(p,n); return *this; }
109  FXBZFileStream& load(FXbool* p,FXuval n){ FXStream::load(p,n); return *this; }
110  FXBZFileStream& load(FXushort* p,FXuval n){ FXStream::load(p,n); return *this; }
111  FXBZFileStream& load(FXshort* p,FXuval n){ FXStream::load(p,n); return *this; }
112  FXBZFileStream& load(FXuint* p,FXuval n){ FXStream::load(p,n); return *this; }
113  FXBZFileStream& load(FXint* p,FXuval n){ FXStream::load(p,n); return *this; }
114  FXBZFileStream& load(FXfloat* p,FXuval n){ FXStream::load(p,n); return *this; }
115  FXBZFileStream& load(FXdouble* p,FXuval n){ FXStream::load(p,n); return *this; }
116  FXBZFileStream& load(FXlong* p,FXuval n){ FXStream::load(p,n); return *this; }
117  FXBZFileStream& load(FXulong* p,FXuval n){ FXStream::load(p,n); return *this; }
118 
120  FXBZFileStream& saveObject(const FXObject* v){ FXStream::saveObject(v); return *this; }
121 
123  FXBZFileStream& loadObject(FXObject*& v){ FXStream::loadObject(v); return *this; }
124 
126  virtual ~FXBZFileStream();
127  };
128 
129 
130 }
131 
132 #endif
133 #endif

Copyright © 1997-2016 Jeroen van der Zijp