UploadIstream.h

Go to the documentation of this file.
00001 /* -*- c++ -*-
00002  * $Id: UploadIstream.h,v 1.5 2006/05/16 20:06:34 brook Exp $
00003  */
00004 
00005 /*
00006  * ClearSilver++ Software License.
00007  *
00008  * Copyright (c) 2005,2006 Brook Milligan <brook@nmsu.edu>
00009  * All rights reserved.
00010  * 
00011  * Redistribution and use in source and binary forms, with or without
00012  * modification, are permitted provided that the following conditions
00013  * are met:
00014  * 
00015  * 1. Redistributions of source code must retain the above copyright
00016  *    notice, this list of conditions and the following disclaimer.
00017  * 2. Redistributions in binary form must reproduce the above
00018  *    copyright notice, this list of conditions and the following
00019  *    disclaimer in the documentation and/or other materials provided
00020  *    with the distribution.
00021  * 3. The name of the author may not be used to endorse or promote
00022  *    products derived from this software without specific prior
00023  *    written permission.
00024  * 
00025  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
00026  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00027  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00028  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00029  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00030  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00031  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00032  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00033  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036  */
00037 
00043 #ifndef UploadIstream_h_
00044 #define UploadIstream_h_ 1
00045 
00046 #include <iosfwd>
00047 #include <ext/stdio_filebuf.h>
00048 
00049 namespace ClearSilver
00050 {
00051 
00067   template<typename _CharT, typename _Traits = std::char_traits<_CharT> >
00068   class basic_UploadIstream : public std::basic_istream<_CharT, _Traits>
00069   {
00070   public:
00071                                 // Types:
00072     typedef __gnu_cxx::stdio_filebuf<_CharT, _Traits> __filebuf_type;
00073 
00074   public:
00075                                 // Constructors
00076     explicit basic_UploadIstream (std::FILE*);
00077     ~basic_UploadIstream ();
00078 
00079                                 // Members
00087     __filebuf_type*
00088     rdbuf() const
00089     { return const_cast<__filebuf_type*>(&_M_filebuf); }
00090 
00091   private:
00092     basic_UploadIstream (const basic_UploadIstream&);
00093     basic_UploadIstream& operator = (const basic_UploadIstream&);
00094 
00095   private:
00096     __filebuf_type      _M_filebuf;
00097   };
00098 
00103   typedef basic_UploadIstream<char> UploadIstream;
00104 
00105 
00106   template<typename _CharT, typename _Traits>
00107   basic_UploadIstream<_CharT, _Traits>::
00108   basic_UploadIstream (std::FILE* f)
00109     : std::basic_istream<_CharT, _Traits>(&_M_filebuf),
00110       _M_filebuf(f, std::ios_base::in)
00111   {}
00112 
00113   template<typename _CharT, typename _Traits>
00114   basic_UploadIstream<_CharT, _Traits>::
00115   ~basic_UploadIstream () {}
00116 
00117 };                              // namespace ClearSilver
00118 
00119 
00120 
00121 #endif

Generated on Tue May 16 14:50:52 2006 for ClearSilver C++ Library by  doxygen 1.4.5