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 unsigned long writeBuffer(unsigned long count);
00038 virtual unsigned long readBuffer(unsigned long count);
00039 public:
00040
00041
00042 FXMemoryStream(const FXObject* cont=NULL);
00043
00044
00045 FXbool open(FXStreamDirection save_or_load,FXuchar* data);
00046
00047
00048 FXbool open(FXStreamDirection save_or_load,unsigned long size,FXuchar* data);
00049
00050
00051 void takeBuffer(FXuchar*& data,unsigned long& size);
00052
00053
00054 void giveBuffer(FXuchar *data,unsigned long size);
00055
00056
00057 virtual FXbool close();
00058
00059
00060 virtual FXbool position(long offset,FXWhence whence=FXFromStart);
00061
00062
00063 FXMemoryStream& operator<<(const FXuchar& v){ FXStream::operator<<(v); return *this; }
00064 FXMemoryStream& operator<<(const FXchar& v){ FXStream::operator<<(v); return *this; }
00065 FXMemoryStream& operator<<(const FXushort& v){ FXStream::operator<<(v); return *this; }
00066 FXMemoryStream& operator<<(const FXshort& v){ FXStream::operator<<(v); return *this; }
00067 FXMemoryStream& operator<<(const FXuint& v){ FXStream::operator<<(v); return *this; }
00068 FXMemoryStream& operator<<(const FXint& v){ FXStream::operator<<(v); return *this; }
00069 FXMemoryStream& operator<<(const FXfloat& v){ FXStream::operator<<(v); return *this; }
00070 FXMemoryStream& operator<<(const FXdouble& v){ FXStream::operator<<(v); return *this; }
00071 #ifdef FX_LONG
00072 FXMemoryStream& operator<<(const FXlong& v){ FXStream::operator<<(v); return *this; }
00073 FXMemoryStream& operator<<(const FXulong& v){ FXStream::operator<<(v); return *this; }
00074 #endif
00075
00076
00077 FXMemoryStream& save(const FXuchar* p,unsigned long n){ FXStream::save(p,n); return *this; }
00078 FXMemoryStream& save(const FXchar* p,unsigned long n){ FXStream::save(p,n); return *this; }
00079 FXMemoryStream& save(const FXushort* p,unsigned long n){ FXStream::save(p,n); return *this; }
00080 FXMemoryStream& save(const FXshort* p,unsigned long n){ FXStream::save(p,n); return *this; }
00081 FXMemoryStream& save(const FXuint* p,unsigned long n){ FXStream::save(p,n); return *this; }
00082 FXMemoryStream& save(const FXint* p,unsigned long n){ FXStream::save(p,n); return *this; }
00083 FXMemoryStream& save(const FXfloat* p,unsigned long n){ FXStream::save(p,n); return *this; }
00084 FXMemoryStream& save(const FXdouble* p,unsigned long n){ FXStream::save(p,n); return *this; }
00085 #ifdef FX_LONG
00086 FXMemoryStream& save(const FXlong* p,unsigned long n){ FXStream::save(p,n); return *this; }
00087 FXMemoryStream& save(const FXulong* p,unsigned long n){ FXStream::save(p,n); return *this; }
00088 #endif
00089
00090
00091 FXMemoryStream& operator>>(FXuchar& v){ FXStream::operator>>(v); return *this; }
00092 FXMemoryStream& operator>>(FXchar& v){ FXStream::operator>>(v); return *this; }
00093 FXMemoryStream& operator>>(FXushort& v){ FXStream::operator>>(v); return *this; }
00094 FXMemoryStream& operator>>(FXshort& v){ FXStream::operator>>(v); return *this; }
00095 FXMemoryStream& operator>>(FXuint& v){ FXStream::operator>>(v); return *this; }
00096 FXMemoryStream& operator>>(FXint& v){ FXStream::operator>>(v); return *this; }
00097 FXMemoryStream& operator>>(FXfloat& v){ FXStream::operator>>(v); return *this; }
00098 FXMemoryStream& operator>>(FXdouble& v){ FXStream::operator>>(v); return *this; }
00099 #ifdef FX_LONG
00100 FXMemoryStream& operator>>(FXlong& v){ FXStream::operator>>(v); return *this; }
00101 FXMemoryStream& operator>>(FXulong& v){ FXStream::operator>>(v); return *this; }
00102 #endif
00103
00104
00105 FXMemoryStream& load(FXuchar* p,unsigned long n){ FXStream::load(p,n); return *this; }
00106 FXMemoryStream& load(FXchar* p,unsigned long n){ FXStream::load(p,n); return *this; }
00107 FXMemoryStream& load(FXushort* p,unsigned long n){ FXStream::load(p,n); return *this; }
00108 FXMemoryStream& load(FXshort* p,unsigned long n){ FXStream::load(p,n); return *this; }
00109 FXMemoryStream& load(FXuint* p,unsigned long n){ FXStream::load(p,n); return *this; }
00110 FXMemoryStream& load(FXint* p,unsigned long n){ FXStream::load(p,n); return *this; }
00111 FXMemoryStream& load(FXfloat* p,unsigned long n){ FXStream::load(p,n); return *this; }
00112 FXMemoryStream& load(FXdouble* p,unsigned long n){ FXStream::load(p,n); return *this; }
00113 #ifdef FX_LONG
00114 FXMemoryStream& load(FXlong* p,unsigned long n){ FXStream::load(p,n); return *this; }
00115 FXMemoryStream& load(FXulong* p,unsigned long n){ FXStream::load(p,n); return *this; }
00116 #endif
00117
00118
00119 FXMemoryStream& saveObject(const FXObject* v){ FXStream::saveObject(v); return *this; }
00120
00121
00122 FXMemoryStream& loadObject(FXObject*& v){ FXStream::loadObject(v); return *this; }
00123 };
00124
00125 }
00126
00127 #endif