00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
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