00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #include <ximol/fstream.hpp>
00048 #include <ximol/encoders/encoders.hpp>
00049
00050
00051 XIMOL_BEGIN_NAMESPACE
00052
00053
00054
00055
00056
00057 xofstream::xofstream()
00058 :buf_()
00059 {
00060 XIMOL_ENCODERS_USING_NAMESPACE;
00061
00062 this->init(&buf_);
00063 prepare_ios(*this);
00064 encoding(XIMOL_DEFAULT_ENCODING);
00065 }
00066
00067
00068
00069
00070 xofstream::xofstream(const char* name, const char* encoding_name, std::ios_base::openmode mode)
00071 :buf_()
00072 {
00073 XIMOL_ENCODERS_USING_NAMESPACE;
00074
00075 this->init(&buf_);
00076 prepare_ios(*this);
00077 encoding(encoding_name);
00078 open(name, mode | binary);
00079 }
00080
00081
00082
00083
00084 xofstream::xofstream(const char* name, std::ios_base::openmode mode, const char* encoding_name)
00085 :buf_()
00086 {
00087 XIMOL_ENCODERS_USING_NAMESPACE;
00088
00089 this->init(&buf_);
00090 prepare_ios(*this);
00091 encoding(encoding_name);
00092 open(name, mode | binary);
00093 }
00094
00095
00096
00097
00098 xofstream::~xofstream()
00099 {
00100 }
00101
00102
00103
00104
00105 ::std::basic_filebuf<xchar_t>* xofstream::rdbuf()
00106 {
00107 return &buf_;
00108 }
00109
00110
00111
00112
00113 bool xofstream::is_open() const
00114 {
00115 return buf_.is_open();
00116 }
00117
00118
00119
00120
00121 void xofstream::open(const char* filename, openmode mode )
00122 {
00123 if (!buf_.open(filename, mode | out | binary))
00124 this->setstate(failbit);
00125 }
00126
00127
00128
00129
00130 void xofstream::close()
00131 {
00132 if (!buf_.close())
00133 this->setstate(failbit);
00134 }
00135
00136
00137
00138
00139 xifstream::xifstream()
00140 :buf_()
00141 {
00142 XIMOL_ENCODERS_USING_NAMESPACE;
00143
00144 this->init(&buf_);
00145 prepare_ios(*this);
00146 encoding(XIMOL_DEFAULT_ENCODING);
00147 }
00148
00149
00150
00151
00152 xifstream::xifstream(const char* name, const char* encoding_name, std::ios_base::openmode mode)
00153 :buf_()
00154 {
00155 XIMOL_ENCODERS_USING_NAMESPACE;
00156
00157 this->init(&buf_);
00158 prepare_ios(*this);
00159 encoding(encoding_name);
00160 open(name, mode | binary);
00161 }
00162
00163
00164
00165
00166 xifstream::xifstream(const char* name, std::ios_base::openmode mode, const char* encoding_name)
00167 :buf_()
00168 {
00169 XIMOL_ENCODERS_USING_NAMESPACE;
00170
00171 this->init(&buf_);
00172 prepare_ios(*this);
00173 encoding(encoding_name);
00174 open(name, mode | binary);
00175 }
00176
00177
00178
00179
00180 xifstream::~xifstream()
00181 {
00182 }
00183
00184
00185
00186
00187 ::std::basic_filebuf<xchar_t>* xifstream::rdbuf()
00188 {
00189 return &buf_;
00190 }
00191
00192
00193
00194
00195 bool xifstream::is_open() const
00196 {
00197 return buf_.is_open();
00198 }
00199
00200
00201
00202
00203 void xifstream::open(const char* filename, openmode mode )
00204 {
00205 if (!buf_.open(filename, mode | in | binary))
00206 this->setstate(failbit);
00207 }
00208
00209
00210
00211
00212 void xifstream::close()
00213 {
00214 if (!buf_.close())
00215 this->setstate(failbit);
00216 }
00217
00218
00219
00220
00221 xfstream::xfstream()
00222 :xiostream()
00223 ,buf_()
00224 {
00225 this->init(&buf_);
00226 }
00227
00228
00229
00230
00231 xfstream::xfstream(const char* name, const char* encoding_name, std::ios_base::openmode mode)
00232 :buf_()
00233 {
00234 XIMOL_ENCODERS_USING_NAMESPACE;
00235
00236 this->init(&buf_);
00237 prepare_ios(*this);
00238 xostream::encoding(encoding_name);
00239 xistream::encoding(encoding_name);
00240 open(name, mode | binary);
00241 }
00242
00243
00244
00245
00246 xfstream::xfstream(const char* name, std::ios_base::openmode mode, const char* encoding_name)
00247 :buf_()
00248 {
00249 XIMOL_ENCODERS_USING_NAMESPACE;
00250
00251 this->init(&buf_);
00252 prepare_ios(*this);
00253 xostream::encoding(encoding_name);
00254 xistream::encoding(encoding_name);
00255 open(name, mode | binary);
00256 }
00257
00258
00259
00260
00261 xfstream::~xfstream()
00262 {
00263 }
00264
00265
00266
00267
00268 ::std::basic_filebuf<xchar_t>* xfstream::rdbuf()
00269 {
00270 return &buf_;
00271 }
00272
00273
00274
00275
00276 bool xfstream::is_open() const
00277 {
00278 return buf_.is_open();
00279 }
00280
00281
00282
00283
00284 void xfstream::open(const char* filename, openmode mode )
00285 {
00286 if (!buf_.open(filename, mode | binary))
00287 this->setstate(failbit);
00288 }
00289
00290
00291
00292
00293 void xfstream::close()
00294 {
00295 if (!buf_.close())
00296 this->setstate(failbit);
00297 }
00298
00299
00300 XIMOL_END_NAMESPACE