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