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.7 2004/12/17 21:31:15 sdw 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 #ifdef STL_STREAMS
00030 #include <fstream>
00031 using std::istream;
00032 using std::ifstream;
00033 #else
00034 #include <fstream.h>
00035 #endif
00036 #endif
00037 
00042 class CLASSEXPORT skInputSource
00043 #ifdef __SYMBIAN32__
00044 : public CBase
00045 #endif
00046 {
00047 public:
00048   IMPORT_C virtual ~skInputSource();
00052   virtual bool eof() const=0;
00056   virtual int get()=0;
00060   virtual int peek()=0;
00064   virtual skString readAllToString()=0;
00065 };
00066 
00067 class CLASSEXPORT skInputFile : public skInputSource
00068 {
00069 public:
00074   IMPORT_C skInputFile(const skString& filename);
00078   IMPORT_C skInputFile();
00083   IMPORT_C void open(const skString& filename);
00084 #ifdef __SYMBIAN32__
00085 
00090   IMPORT_C void open(const TDesC& file);
00091 #endif
00092   IMPORT_C virtual ~skInputFile();
00096   IMPORT_C virtual bool eof() const;
00100   IMPORT_C virtual int get();
00104   IMPORT_C virtual int peek();
00109   IMPORT_C virtual skString readAllToString();
00110 private:
00111 #ifdef STREAMS_ENABLED
00112   ifstream      m_In;
00113 #else
00114   FILE *        m_In;
00115   bool          m_Peeked;
00116   int           m_PeekedChar;
00117 #endif
00118 #ifdef UNICODE_STRINGS
00119   bool          m_FileIsUnicode;
00120 #endif
00121 };
00122 class CLASSEXPORT skInputString : public skInputSource
00123 {
00124 public:
00129   IMPORT_C skInputString(const skString& in);
00133   IMPORT_C virtual ~skInputString();
00137   IMPORT_C virtual bool eof() const;
00141   IMPORT_C virtual int get();
00145   IMPORT_C virtual int peek();
00149   IMPORT_C virtual skString readAllToString();
00150 private:
00151   skString      m_In;
00152   unsigned int  m_Pos;
00153   bool          m_Peeked;
00154   int           m_PeekedChar;
00155 };
00156 
00157 #endif

Generated on Fri Dec 17 20:28:26 2004 for Simkin C++ for Symbian by doxygen1.3