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

FXFileStream.h
1 /********************************************************************************
2 * *
3 * F i l e S t r e a m C l a s s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,2017 by Jeroen van der Zijp. 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 #ifndef FXFILESTREAM_H
22 #define FXFILESTREAM_H
23 
24 #ifndef FXSTREAM_H
25 #include "FXStream.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 class FXAPI FXFileStream : public FXStream {
33 protected:
34  FXFile file;
35 protected:
36  virtual FXuval writeBuffer(FXuval count);
37  virtual FXuval readBuffer(FXuval count);
38 public:
39 
41  FXFileStream(const FXObject* cont=NULL);
42 
44  FXFileStream(const FXString& filename,FXStreamDirection save_or_load=FXStreamLoad,FXuval size=8192UL);
45 
50  FXbool open(const FXString& filename,FXStreamDirection save_or_load=FXStreamLoad,FXuval size=8192UL);
51 
53  virtual FXbool close();
54 
56  FXlong position() const { return FXStream::position(); }
57 
59  virtual FXbool position(FXlong offset,FXWhence whence=FXFromStart);
60 
62  FXFileStream& operator<<(const FXuchar& v){ FXStream::operator<<(v); return *this; }
63  FXFileStream& operator<<(const FXchar& v){ FXStream::operator<<(v); return *this; }
64  FXFileStream& operator<<(const FXbool& v){ FXStream::operator<<(v); return *this; }
65  FXFileStream& operator<<(const FXushort& v){ FXStream::operator<<(v); return *this; }
66  FXFileStream& operator<<(const FXshort& v){ FXStream::operator<<(v); return *this; }
67  FXFileStream& operator<<(const FXuint& v){ FXStream::operator<<(v); return *this; }
68  FXFileStream& operator<<(const FXint& v){ FXStream::operator<<(v); return *this; }
69  FXFileStream& operator<<(const FXfloat& v){ FXStream::operator<<(v); return *this; }
70  FXFileStream& operator<<(const FXdouble& v){ FXStream::operator<<(v); return *this; }
71  FXFileStream& operator<<(const FXlong& v){ FXStream::operator<<(v); return *this; }
72  FXFileStream& operator<<(const FXulong& v){ FXStream::operator<<(v); return *this; }
73 
75  FXFileStream& save(const FXuchar* p,FXuval n){ FXStream::save(p,n); return *this; }
76  FXFileStream& save(const FXchar* p,FXuval n){ FXStream::save(p,n); return *this; }
77  FXFileStream& save(const FXbool* p,FXuval n){ FXStream::save(p,n); return *this; }
78  FXFileStream& save(const FXushort* p,FXuval n){ FXStream::save(p,n); return *this; }
79  FXFileStream& save(const FXshort* p,FXuval n){ FXStream::save(p,n); return *this; }
80  FXFileStream& save(const FXuint* p,FXuval n){ FXStream::save(p,n); return *this; }
81  FXFileStream& save(const FXint* p,FXuval n){ FXStream::save(p,n); return *this; }
82  FXFileStream& save(const FXfloat* p,FXuval n){ FXStream::save(p,n); return *this; }
83  FXFileStream& save(const FXdouble* p,FXuval n){ FXStream::save(p,n); return *this; }
84  FXFileStream& save(const FXlong* p,FXuval n){ FXStream::save(p,n); return *this; }
85  FXFileStream& save(const FXulong* p,FXuval n){ FXStream::save(p,n); return *this; }
86 
88  FXFileStream& operator>>(FXuchar& v){ FXStream::operator>>(v); return *this; }
89  FXFileStream& operator>>(FXchar& v){ FXStream::operator>>(v); return *this; }
90  FXFileStream& operator>>(FXbool& v){ FXStream::operator>>(v); return *this; }
91  FXFileStream& operator>>(FXushort& v){ FXStream::operator>>(v); return *this; }
92  FXFileStream& operator>>(FXshort& v){ FXStream::operator>>(v); return *this; }
93  FXFileStream& operator>>(FXuint& v){ FXStream::operator>>(v); return *this; }
94  FXFileStream& operator>>(FXint& v){ FXStream::operator>>(v); return *this; }
95  FXFileStream& operator>>(FXfloat& v){ FXStream::operator>>(v); return *this; }
96  FXFileStream& operator>>(FXdouble& v){ FXStream::operator>>(v); return *this; }
97  FXFileStream& operator>>(FXlong& v){ FXStream::operator>>(v); return *this; }
98  FXFileStream& operator>>(FXulong& v){ FXStream::operator>>(v); return *this; }
99 
101  FXFileStream& load(FXuchar* p,FXuval n){ FXStream::load(p,n); return *this; }
102  FXFileStream& load(FXchar* p,FXuval n){ FXStream::load(p,n); return *this; }
103  FXFileStream& load(FXbool* p,FXuval n){ FXStream::load(p,n); return *this; }
104  FXFileStream& load(FXushort* p,FXuval n){ FXStream::load(p,n); return *this; }
105  FXFileStream& load(FXshort* p,FXuval n){ FXStream::load(p,n); return *this; }
106  FXFileStream& load(FXuint* p,FXuval n){ FXStream::load(p,n); return *this; }
107  FXFileStream& load(FXint* p,FXuval n){ FXStream::load(p,n); return *this; }
108  FXFileStream& load(FXfloat* p,FXuval n){ FXStream::load(p,n); return *this; }
109  FXFileStream& load(FXdouble* p,FXuval n){ FXStream::load(p,n); return *this; }
110  FXFileStream& load(FXlong* p,FXuval n){ FXStream::load(p,n); return *this; }
111  FXFileStream& load(FXulong* p,FXuval n){ FXStream::load(p,n); return *this; }
112 
114  FXFileStream& saveObject(const FXObject* v){ FXStream::saveObject(v); return *this; }
115 
118 
120  virtual ~FXFileStream();
121  };
122 
123 }
124 
125 #endif

Copyright © 1997-2016 Jeroen van der Zijp