Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

skInputSource.h

00001 /*
00002   copyright 1996-2003
00003   Simon Whiteside
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019   $Id: skInputSource_8h-source.html,v 1.2 2003/01/23 15:31:03 simkin_cvs Exp $
00020 */
00021 #ifndef skInputSource_h
00022 #define skInputSource_h
00023 
00024 
00025 #include "skString.h"
00026 #include <stdio.h>
00027 
00028 #ifdef STREAMS_ENABLED
00029 #include <fstream.h>
00030 #endif
00031 
00036 class CLASSEXPORT skInputSource
00037 {
00038 public:
00039   virtual bool          eof() const=0;
00040   virtual int           get()=0;
00041   virtual int           peek()=0;
00042   virtual skString      readAllToString()=0;
00043 //  virtual unsigned int  read(void * buffer,unsigned int buf_len)=0;
00044 };
00045 
00046 class CLASSEXPORT skInputFile : public skInputSource
00047 {
00048 public:
00049                 skInputFile(const skString& filename);
00050                 ~skInputFile();
00051   bool          eof() const;
00052   int           get();
00053   int           peek();
00054   skString      readAllToString();
00055 //  unsigned int  read(void * buffer,unsigned int buf_len);
00056 private:
00057 #ifdef STREAMS_ENABLED
00058   ifstream      m_In;
00059 #else
00060   FILE *        m_In;
00061   bool          m_Peeked;
00062   int           m_PeekedChar;
00063 #endif
00064 #ifdef UNICODE_STRINGS
00065   bool          m_FileIsUnicode;
00066 #endif
00067 };
00068 class CLASSEXPORT skInputString : public skInputSource
00069 {
00070 public:
00071                 skInputString(const skString& in);
00072   bool          eof() const;
00073   int           get();
00074   int           peek();
00075   skString      readAllToString();
00076 //  unsigned int  read(void * buffer,unsigned int buf_len);
00077 private:
00078   skString      m_In;
00079   unsigned int  m_Pos;
00080   bool          m_Peeked;
00081   int           m_PeekedChar;
00082 };
00083 
00084 #endif

Generated on Thu Jan 23 15:25:38 2003 for Simkin by doxygen1.3-rc1