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 #ifndef XIMOL_FSTREAM_HPP_
00048 #define XIMOL_FSTREAM_HPP_
00049
00050 #include <ximol/stream.hpp>
00051
00052 #include <fstream>
00053
00054
00055 XIMOL_BEGIN_NAMESPACE
00056
00057
00058
00059
00060
00061 class XIMOL_EXPORT xofstream
00062 : public xostream
00063 {
00064 public:
00065
00066 xofstream();
00067
00068 explicit xofstream(const char* name,
00069 const char* encoding_name = XIMOL_DEFAULT_ENCODING,
00070 std::ios_base::openmode mode = std::ios_base::out);
00071
00072 xofstream(const char* name, std::ios_base::openmode mode,
00073 const char* encoding_name = XIMOL_DEFAULT_ENCODING);
00074
00075 ~xofstream();
00076
00077 public:
00078 ::std::basic_filebuf<xchar_t>* rdbuf();
00079
00080 bool is_open() const;
00081
00082 void open(const char* filename,
00083 openmode mode = std::ios_base::out);
00084
00085 void close();
00086
00087 inline xostream& operator<<(xchar_t c) { return xostream::operator<<(c); }
00088 inline xostream& operator<<(char c) { return xostream::operator<<(c); }
00089
00090 private:
00091 ::std::basic_filebuf<xchar_t> buf_;
00092 };
00093
00094
00095
00096
00097
00098 class XIMOL_EXPORT xifstream
00099 : public xistream
00100 {
00101 public:
00102 xifstream();
00103
00104 explicit xifstream(const char* name,
00105 const char* encoding_name = XIMOL_DEFAULT_ENCODING,
00106 std::ios_base::openmode mode = std::ios_base::in);
00107
00108 xifstream(const char* name, std::ios_base::openmode mode,
00109 const char* encoding_name = XIMOL_DEFAULT_ENCODING);
00110
00111 ~xifstream();
00112
00113 public:
00114 ::std::basic_filebuf<xchar_t>* rdbuf();
00115
00116 bool is_open() const;
00117
00118 void open(const char* filename,
00119 openmode mode = std::ios_base::in);
00120
00121 void close();
00122
00123 inline xistream& operator>>(xchar_t& c) { return xistream::operator>>(c); }
00124 inline xistream& operator>>(char& c) { return xistream::operator>>(c); }
00125
00126 private:
00127 ::std::basic_filebuf<xchar_t> buf_;
00128 };
00129
00130
00131
00132
00133
00134 class XIMOL_EXPORT xfstream
00135 : public xiostream
00136 {
00137 public:
00138 xfstream();
00139
00140 explicit xfstream(const char* name,
00141 const char* encoding_name = XIMOL_DEFAULT_ENCODING,
00142 std::ios_base::openmode mode = std::ios_base::in | out);
00143
00144 xfstream(const char* name, std::ios_base::openmode mode,
00145 const char* encoding_name = XIMOL_DEFAULT_ENCODING);
00146
00147 ~xfstream();
00148
00149 public:
00150 ::std::basic_filebuf<xchar_t>* rdbuf();
00151
00152 bool is_open() const;
00153
00154 void open(const char* filename,
00155 openmode mode = std::ios_base::in | out);
00156
00157 void close();
00158
00159 inline xostream& operator<<(xchar_t c) { return xostream::operator<<(c); }
00160 inline xostream& operator<<(char c) { return xostream::operator<<(c); }
00161 inline xistream& operator>>(xchar_t& c) { return xistream::operator>>(c); }
00162 inline xistream& operator>>(char& c) { return xistream::operator>>(c); }
00163
00164 private:
00165 ::std::basic_filebuf<xchar_t> buf_;
00166 };
00167
00168
00169 XIMOL_END_NAMESPACE
00170
00171 #endif // #ifndef XIMOL_FSTREAM_HPP_