40 #ifndef _resourcefilestream_cpp
41 #define _resourcefilestream_cpp
44 #include "stringtool.h"
45 #include "exception.h"
54 #ifdef USENEWDATASTREAM
56 #else //USENEWDATASTREAM
59 StandardStream(Stream)
61 StandardStream->seekg(0,std::ios_base::end);
62 Size = (size_t)StandardStream->tellg();
63 StandardStream->flush();
70 StandardStream =
new std::fstream();
72 std::ios_base::openmode Options = (std::ios_base::in | std::ios_base::out);
75 Options = (Options | std::ios_base::binary);
79 Options = (Options | std::ios_base::trunc);
83 char Check = Path.at(Path.size() - 1);
89 if( SysSlash != Check )
90 FullPath = Path+SysSlash+FileName;
92 FullPath = Path+FileName;
93 StandardStream->open(FullPath.c_str(),Options);
95 if(!StandardStream->is_open())
100 StandardStream->seekg(0,std::ios_base::end);
101 Size = (size_t)StandardStream->tellg();
102 StandardStream->flush();
118 StandardStream->read(static_cast<char*>(Buffer),static_cast<std::streamsize>(Count));
119 StandardStream->seekp(static_cast<std::ifstream::pos_type>(StandardStream->gcount()),std::ios::cur);
120 return StandardStream->gcount();
131 StandardStream->write(static_cast<const char*>(Buffer), static_cast<std::streamsize>(Count));
132 StandardStream->seekg(static_cast<std::ifstream::pos_type>(Count),std::ios::cur);
140 StandardStream->clear();
146 StandardStream->clear();
147 StandardStream->seekg(Position);
148 StandardStream->seekp(Position);
153 StandardStream->clear();
154 StandardStream->seekg(Offset,std::ios::cur);
155 StandardStream->seekp(Offset,std::ios::cur);
160 if(Read)
return StandardStream->tellg();
161 else return StandardStream->tellp();
166 return StandardStream->eof();
171 if(StandardStream->is_open())
173 StandardStream->flush();
174 StandardStream->close();