00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FXFILESTREAM_H
00022 #define FXFILESTREAM_H
00023
00024 #ifndef FXSTREAM_H
00025 #include "FXStream.h"
00026 #endif
00027
00028 namespace FX {
00029
00030
00032 class FXAPI FXFileStream : public FXStream {
00033 protected:
00034 FXFile file;
00035 protected:
00036 virtual FXuval writeBuffer(FXuval count);
00037 virtual FXuval readBuffer(FXuval count);
00038 public:
00039
00041 FXFileStream(const FXObject* cont=NULL);
00042
00044 FXFileStream(const FXString& filename,FXStreamDirection save_or_load=FXStreamLoad,FXuval size=8192UL);
00045
00050 FXbool open(const FXString& filename,FXStreamDirection save_or_load=FXStreamLoad,FXuval size=8192UL);
00051
00053 virtual FXbool close();
00054
00056 FXlong position() const { return FXStream::position(); }
00057
00059 virtual FXbool position(FXlong offset,FXWhence whence=FXFromStart);
00060
00062 FXFileStream& operator<<(const FXuchar& v){ FXStream::operator<<(v); return *this; }
00063 FXFileStream& operator<<(const FXchar& v){ FXStream::operator<<(v); return *this; }
00064 FXFileStream& operator<<(const FXbool& v){ FXStream::operator<<(v); return *this; }
00065 FXFileStream& operator<<(const FXushort& v){ FXStream::operator<<(v); return *this; }
00066 FXFileStream& operator<<(const FXshort& v){ FXStream::operator<<(v); return *this; }
00067 FXFileStream& operator<<(const FXuint& v){ FXStream::operator<<(v); return *this; }
00068 FXFileStream& operator<<(const FXint& v){ FXStream::operator<<(v); return *this; }
00069 FXFileStream& operator<<(const FXfloat& v){ FXStream::operator<<(v); return *this; }
00070 FXFileStream& operator<<(const FXdouble& v){ FXStream::operator<<(v); return *this; }
00071 FXFileStream& operator<<(const FXlong& v){ FXStream::operator<<(v); return *this; }
00072 FXFileStream& operator<<(const FXulong& v){ FXStream::operator<<(v); return *this; }
00073
00075 FXFileStream& save(const FXuchar* p,FXuval n){ FXStream::save(p,n); return *this; }
00076 FXFileStream& save(const FXchar* p,FXuval n){ FXStream::save(p,n); return *this; }
00077 FXFileStream& save(const FXbool* p,FXuval n){ FXStream::save(p,n); return *this; }
00078 FXFileStream& save(const FXushort* p,FXuval n){ FXStream::save(p,n); return *this; }
00079 FXFileStream& save(const FXshort* p,FXuval n){ FXStream::save(p,n); return *this; }
00080 FXFileStream& save(const FXuint* p,FXuval n){ FXStream::save(p,n); return *this; }
00081 FXFileStream& save(const FXint* p,FXuval n){ FXStream::save(p,n); return *this; }
00082 FXFileStream& save(const FXfloat* p,FXuval n){ FXStream::save(p,n); return *this; }
00083 FXFileStream& save(const FXdouble* p,FXuval n){ FXStream::save(p,n); return *this; }
00084 FXFileStream& save(const FXlong* p,FXuval n){ FXStream::save(p,n); return *this; }
00085 FXFileStream& save(const FXulong* p,FXuval n){ FXStream::save(p,n); return *this; }
00086
00088 FXFileStream& operator>>(FXuchar& v){ FXStream::operator>>(v); return *this; }
00089 FXFileStream& operator>>(FXchar& v){ FXStream::operator>>(v); return *this; }
00090 FXFileStream& operator>>(FXbool& v){ FXStream::operator>>(v); return *this; }
00091 FXFileStream& operator>>(FXushort& v){ FXStream::operator>>(v); return *this; }
00092 FXFileStream& operator>>(FXshort& v){ FXStream::operator>>(v); return *this; }
00093 FXFileStream& operator>>(FXuint& v){ FXStream::operator>>(v); return *this; }
00094 FXFileStream& operator>>(FXint& v){ FXStream::operator>>(v); return *this; }
00095 FXFileStream& operator>>(FXfloat& v){ FXStream::operator>>(v); return *this; }
00096 FXFileStream& operator>>(FXdouble& v){ FXStream::operator>>(v); return *this; }
00097 FXFileStream& operator>>(FXlong& v){ FXStream::operator>>(v); return *this; }
00098 FXFileStream& operator>>(FXulong& v){ FXStream::operator>>(v); return *this; }
00099
00101 FXFileStream& load(FXuchar* p,FXuval n){ FXStream::load(p,n); return *this; }
00102 FXFileStream& load(FXchar* p,FXuval n){ FXStream::load(p,n); return *this; }
00103 FXFileStream& load(FXbool* p,FXuval n){ FXStream::load(p,n); return *this; }
00104 FXFileStream& load(FXushort* p,FXuval n){ FXStream::load(p,n); return *this; }
00105 FXFileStream& load(FXshort* p,FXuval n){ FXStream::load(p,n); return *this; }
00106 FXFileStream& load(FXuint* p,FXuval n){ FXStream::load(p,n); return *this; }
00107 FXFileStream& load(FXint* p,FXuval n){ FXStream::load(p,n); return *this; }
00108 FXFileStream& load(FXfloat* p,FXuval n){ FXStream::load(p,n); return *this; }
00109 FXFileStream& load(FXdouble* p,FXuval n){ FXStream::load(p,n); return *this; }
00110 FXFileStream& load(FXlong* p,FXuval n){ FXStream::load(p,n); return *this; }
00111 FXFileStream& load(FXulong* p,FXuval n){ FXStream::load(p,n); return *this; }
00112
00114 FXFileStream& saveObject(const FXObject* v){ FXStream::saveObject(v); return *this; }
00115
00117 FXFileStream& loadObject(FXObject*& v){ FXStream::loadObject(v); return *this; }
00118
00120 virtual ~FXFileStream();
00121 };
00122
00123 }
00124
00125 #endif