8 #ifndef BOOST_NOWIDE_FSTREAM_INCLUDED_HPP     9 #define BOOST_NOWIDE_FSTREAM_INCLUDED_HPP    12 #include <boost/config.hpp>    13 #include <boost/nowide/convert.hpp>    14 #include <boost/scoped_ptr.hpp>    17 #include <boost/nowide/filebuf.hpp>    26 #if !defined(BOOST_WINDOWS)  && !defined(BOOST_NOWIDE_FSTREAM_TESTS) && !defined(BOOST_NOWIDE_DOXYGEN)    28     using std::basic_ifstream;
    29     using std::basic_ofstream;
    30     using std::basic_fstream;
    36     template<
typename CharType,
typename Traits = std::
char_traits<CharType> >
    44         typedef std::basic_istream<CharType,Traits> internal_stream_type;
    47             internal_stream_type(0)
    49             buf_.reset(
new internal_buffer_type());
    50             std::ios::rdbuf(buf_.get());
    53         explicit basic_ifstream(
char const *file_name,std::ios_base::openmode mode = std::ios_base::in) : 
    54             internal_stream_type(0) 
    56             buf_.reset(
new internal_buffer_type());
    57             std::ios::rdbuf(buf_.get());
    61         explicit basic_ifstream(std::string 
const &file_name,std::ios_base::openmode mode = std::ios_base::in) : 
    62             internal_stream_type(0) 
    64             buf_.reset(
new internal_buffer_type());
    65             std::ios::rdbuf(buf_.get());
    70         void open(std::string 
const &file_name,std::ios_base::openmode mode = std::ios_base::in)
    72             open(file_name.c_str(),mode);
    74         void open(
char const *file_name,std::ios_base::openmode mode = std::ios_base::in)
    76             if(!buf_->open(file_name,mode | std::ios_base::in)) {
    77                 this->setstate(std::ios_base::failbit);
    85             return buf_->is_open();
    89             return buf_->is_open();
    94                 this->setstate(std::ios_base::failbit);
    99         internal_buffer_type *rdbuf()
 const   109         boost::scoped_ptr<internal_buffer_type> buf_;
   116     template<
typename CharType,
typename Traits = std::
char_traits<CharType> >
   121         typedef std::basic_ostream<CharType,Traits> internal_stream_type;
   124             internal_stream_type(0)
   126             buf_.reset(
new internal_buffer_type());
   127             std::ios::rdbuf(buf_.get());
   129         explicit basic_ofstream(
char const *file_name,std::ios_base::openmode mode = std::ios_base::out) :
   130             internal_stream_type(0)
   132             buf_.reset(
new internal_buffer_type());
   133             std::ios::rdbuf(buf_.get());
   134             open(file_name,mode);
   136         explicit basic_ofstream(std::string 
const &file_name,std::ios_base::openmode mode = std::ios_base::out) :
   137             internal_stream_type(0)
   139             buf_.reset(
new internal_buffer_type());
   140             std::ios::rdbuf(buf_.get());
   141             open(file_name,mode);
   143         void open(std::string 
const &file_name,std::ios_base::openmode mode = std::ios_base::out)
   145             open(file_name.c_str(),mode);
   147         void open(
char const *file_name,std::ios_base::openmode mode = std::ios_base::out)
   149             if(!buf_->open(file_name,mode | std::ios_base::out)) {
   150                 this->setstate(std::ios_base::failbit);
   158             return buf_->is_open();
   162             return buf_->is_open();
   167                 this->setstate(std::ios_base::failbit);
   172         internal_buffer_type *rdbuf()
 const   182         boost::scoped_ptr<internal_buffer_type> buf_;
   189     template<
typename CharType,
typename Traits = std::
char_traits<CharType> >
   194         typedef std::basic_iostream<CharType,Traits> internal_stream_type;
   197             internal_stream_type(0)
   199             buf_.reset(
new internal_buffer_type());
   200             std::ios::rdbuf(buf_.get());
   202         explicit basic_fstream(
char const *file_name,std::ios_base::openmode mode = std::ios_base::out | std::ios_base::in) :
   203             internal_stream_type(0)
   205             buf_.reset(
new internal_buffer_type());
   206             std::ios::rdbuf(buf_.get());
   207             open(file_name,mode);
   209         explicit basic_fstream(std::string 
const &file_name,std::ios_base::openmode mode = std::ios_base::out | std::ios_base::in) :
   210             internal_stream_type(0)
   212             buf_.reset(
new internal_buffer_type());
   213             std::ios::rdbuf(buf_.get());
   214             open(file_name,mode);
   216         void open(std::string 
const &file_name,std::ios_base::openmode mode = std::ios_base::out | std::ios_base::out)
   218             open(file_name.c_str(),mode);
   220         void open(
char const *file_name,std::ios_base::openmode mode = std::ios_base::out | std::ios_base::out)
   222             if(!buf_->open(file_name,mode)) {
   223                 this->setstate(std::ios_base::failbit);
   231             return buf_->is_open();
   235             return buf_->is_open();
   240                 this->setstate(std::ios_base::failbit);
   245         internal_buffer_type *rdbuf()
 const   255         boost::scoped_ptr<internal_buffer_type> buf_;
 
basic_ifstream< char > ifstream
Definition: fstream.hpp:266
 
basic_filebuf< char > filebuf
Convinience typedef. 
Definition: filebuf.hpp:401
 
Same as std::basic_ifstream<char> but accepts UTF-8 strings under Windows. 
Definition: fstream.hpp:40
 
basic_ofstream< char > ofstream
Definition: fstream.hpp:270
 
This forward declaration defined the basic_filebuf type. 
Definition: filebuf.hpp:38
 
Same as std::basic_fstream<char> but accepts UTF-8 strings under Windows. 
Definition: fstream.hpp:190
 
This is implementation of std::filebuf. 
Definition: filebuf.hpp:47
 
Same as std::basic_ofstream<char> but accepts UTF-8 strings under Windows. 
Definition: fstream.hpp:117
 
basic_fstream< char > fstream
Definition: fstream.hpp:274