Go to the documentation of this file.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 #ifndef _STDIO_FILEBUF_H
00031 #define _STDIO_FILEBUF_H 1
00032
00033 #pragma GCC system_header
00034
00035 #include <fstream>
00036
00037 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
00038 {
00039 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 template<typename _CharT, typename _Traits = std::char_traits<_CharT> >
00051 class stdio_filebuf : public std::basic_filebuf<_CharT, _Traits>
00052 {
00053 public:
00054
00055 typedef _CharT char_type;
00056 typedef _Traits traits_type;
00057 typedef typename traits_type::int_type int_type;
00058 typedef typename traits_type::pos_type pos_type;
00059 typedef typename traits_type::off_type off_type;
00060 typedef std::size_t size_t;
00061
00062 public:
00063
00064
00065
00066 stdio_filebuf() : std::basic_filebuf<_CharT, _Traits>() {}
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 stdio_filebuf(int __fd, std::ios_base::openmode __mode,
00078 size_t __size = static_cast<size_t>(BUFSIZ));
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090 stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode,
00091 size_t __size = static_cast<size_t>(BUFSIZ));
00092
00093
00094
00095
00096
00097 virtual
00098 ~stdio_filebuf();
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 int
00109 fd() { return this->_M_file.fd(); }
00110
00111
00112
00113
00114
00115
00116
00117
00118 std::__c_file*
00119 file() { return this->_M_file.file(); }
00120 };
00121
00122 template<typename _CharT, typename _Traits>
00123 stdio_filebuf<_CharT, _Traits>::~stdio_filebuf()
00124 { }
00125
00126 template<typename _CharT, typename _Traits>
00127 stdio_filebuf<_CharT, _Traits>::
00128 stdio_filebuf(int __fd, std::ios_base::openmode __mode, size_t __size)
00129 {
00130 this->_M_file.sys_open(__fd, __mode);
00131 if (this->is_open())
00132 {
00133 this->_M_mode = __mode;
00134 this->_M_buf_size = __size;
00135 this->_M_allocate_internal_buffer();
00136 this->_M_reading = false;
00137 this->_M_writing = false;
00138 this->_M_set_buffer(-1);
00139 }
00140 }
00141
00142 template<typename _CharT, typename _Traits>
00143 stdio_filebuf<_CharT, _Traits>::
00144 stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode,
00145 size_t __size)
00146 {
00147 this->_M_file.sys_open(__f, __mode);
00148 if (this->is_open())
00149 {
00150 this->_M_mode = __mode;
00151 this->_M_buf_size = __size;
00152 this->_M_allocate_internal_buffer();
00153 this->_M_reading = false;
00154 this->_M_writing = false;
00155 this->_M_set_buffer(-1);
00156 }
00157 }
00158
00159 _GLIBCXX_END_NAMESPACE_VERSION
00160 }
00161
00162 #endif