ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

stdio_streambuf.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1999
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Copyright (c) 1999
00006  * Boris Fomitchev
00007  *
00008  * This material is provided "as is", with absolutely no warranty expressed
00009  * or implied. Any use is at your own risk.
00010  *
00011  * Permission to use or copy this software for any purpose is hereby granted
00012  * without fee, provided the above notices are retained on all copies.
00013  * Permission to modify the code and to distribute modified code is granted,
00014  * provided the above notices are retained, and a notice that the code was
00015  * modified is included with the above copyright notice.
00016  *
00017  */
00018 
00019 // This header defines two streambufs:
00020 // stdio_istreambuf, a read-only streambuf synchronized with a C stdio
00021 // FILE object
00022 // stdio_ostreambuf, a write-only streambuf synchronized with a C stdio
00023 // FILE object.
00024 // Note that neither stdio_istreambuf nor stdio_ostreambuf is a template;
00025 // both classes are derived from basic_streambuf<char, char_traits<char> >.
00026 
00027 // Note: the imbue() member function is a no-op.  In particular, these
00028 // classes assume that codecvt<char, char, mbstate_t> is always an identity
00029 // transformation.  This is true of the default locale, and of all locales
00030 // defined for the C I/O library.  If you need to use a locale where
00031 // the codecvt<char, char, mbstate_t> facet performs a nontrivial
00032 // conversion, then you should use basic_filebuf<> instead of stdio_istreambuf
00033 // or stdio_ostreambuf.  (If you don't understand what any of this means,
00034 // then it's not a feature you need to worry about.  Locales where
00035 // codecvt<char, char, mbstate_t> does something nontrivial are a rare
00036 // corner case.)
00037 
00038 
00039 #ifndef _STLP_STDIO_STREAMBUF
00040 #define _STLP_STDIO_STREAMBUF
00041 
00042 #include <streambuf>
00043 #include <cstdio>              // For FILE.
00044 
00045 _STLP_BEGIN_NAMESPACE
00046 _STLP_MOVE_TO_PRIV_NAMESPACE
00047 
00048 // Base class for features common to stdio_istreambuf and stdio_ostreambuf
00049 class stdio_streambuf_base :
00050   public basic_streambuf<char, char_traits<char> > /* FILE_basic_streambuf */ {
00051 public:                         // Constructor, destructor.
00052   // The argument may not be null.  It must be an open file pointer.
00053   stdio_streambuf_base(FILE*);
00054 
00055   // The destructor flushes the stream, but does not close it.
00056   ~stdio_streambuf_base();
00057 
00058 protected:                      // Virtual functions from basic_streambuf.
00059   streambuf* setbuf(char*, streamsize);
00060 
00061   pos_type seekoff(off_type, ios_base::seekdir,
00062                    ios_base::openmode
00063                           = ios_base::in | ios_base::out);
00064   pos_type seekpos(pos_type,
00065                    ios_base::openmode
00066                           = ios_base::in | ios_base::out);
00067   int sync();
00068 
00069 protected:
00070   FILE* _M_file;
00071 };
00072 
00073 class stdio_istreambuf : public stdio_streambuf_base {
00074 public:                         // Constructor, destructor.
00075   stdio_istreambuf(FILE* __f) : stdio_streambuf_base(__f) {}
00076   ~stdio_istreambuf();
00077 
00078 protected:                      // Virtual functions from basic_streambuf.
00079   streamsize showmanyc();
00080   int_type underflow();
00081   int_type uflow();
00082   virtual int_type pbackfail(int_type c = traits_type::eof());
00083 };
00084 
00085 class stdio_ostreambuf : public stdio_streambuf_base {
00086 public:                         // Constructor, destructor.
00087   stdio_ostreambuf(FILE* __f) : stdio_streambuf_base(__f) {}
00088   ~stdio_ostreambuf();
00089 
00090 protected:                      // Virtual functions from basic_streambuf.
00091   streamsize showmanyc();
00092   int_type overflow(int_type c = traits_type::eof());
00093 };
00094 
00095 _STLP_MOVE_TO_STD_NAMESPACE
00096 _STLP_END_NAMESPACE
00097 
00098 #endif /* _STLP_STDIO_STREAMBUF */
00099 
00100 // Local Variables:
00101 // mode:C++
00102 // End:

Generated on Sun May 27 2012 04:35:13 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.