cstrstream.h

Go to the documentation of this file.
00001 
00003 
00004 //
00005 // Copyright (c) 2002-2004 California Institute of Technology
00006 // Copyright (c) 2004-2007 University of Southern California
00007 // Rob Peters <rjpeters at usc dot edu>
00008 //
00009 // created: Fri Mar  7 13:12:33 2003
00010 // commit: $Id: cstrstream.h 10065 2007-04-12 05:54:56Z rjpeters $
00011 // $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/rutz/cstrstream.h $
00012 //
00013 // --------------------------------------------------------------------
00014 //
00015 // This file is part of GroovX.
00016 //   [http://ilab.usc.edu/rjpeters/groovx/]
00017 //
00018 // GroovX is free software; you can redistribute it and/or modify it
00019 // under the terms of the GNU General Public License as published by
00020 // the Free Software Foundation; either version 2 of the License, or
00021 // (at your option) any later version.
00022 //
00023 // GroovX is distributed in the hope that it will be useful, but
00024 // WITHOUT ANY WARRANTY; without even the implied warranty of
00025 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00026 // General Public License for more details.
00027 //
00028 // You should have received a copy of the GNU General Public License
00029 // along with GroovX; if not, write to the Free Software Foundation,
00030 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00031 //
00033 
00034 #ifndef GROOVX_RUTZ_CSTRSTREAM_H_UTC20050626084019_DEFINED
00035 #define GROOVX_RUTZ_CSTRSTREAM_H_UTC20050626084019_DEFINED
00036 
00037 #include <cstring>
00038 #include <istream>
00039 #include <streambuf>
00040 
00041 namespace rutz
00042 {
00043   class imembuf;
00044   class imemstream;
00045   class icstrstream;
00046 }
00047 
00049 class rutz::imembuf : public std::streambuf
00050 {
00051 private:
00052   unsigned int m_len;
00053   const char* m_buf;
00054   char* m_owned_mem;
00055 
00056   imembuf(const imembuf&);
00057   imembuf& operator=(const imembuf&);
00058 
00059 public:
00061   imembuf(const char* s);
00062 
00064   imembuf(const char* s, unsigned int len);
00065 
00066   void make_owning();
00067 
00069   virtual ~imembuf();
00070 
00072 
00074   virtual int underflow();
00075 };
00076 
00078 class rutz::imemstream : public std::istream
00079 {
00080 private:
00081   imembuf m_buf;
00082 public:
00084   imemstream(const char* s);
00085 
00087   imemstream(const char* s, unsigned int len);
00088 };
00089 
00091 class rutz::icstrstream : public std::istream
00092 {
00093 private:
00094   imembuf m_buf;
00095 public:
00097   icstrstream(const char* s);
00098 };
00099 
00100 static const char __attribute__((used)) vcid_groovx_rutz_cstrstream_h_utc20050626084019[] = "$Id: cstrstream.h 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file:
00101 #endif // !GROOVX_RUTZ_CSTRSTREAM_H_UTC20050626084019_DEFINED

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:49:40 2008 by Doxygen version 1.5.5.