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