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 #include <fstream.h>
00030 #endif
00031
00036 class CLASSEXPORT skInputSource
00037 #ifdef __SYMBIAN32__
00038 : public CBase
00039 #endif
00040 {
00041 public:
00042 IMPORT_C virtual ~skInputSource();
00046 virtual bool eof() const=0;
00050 virtual int get()=0;
00054 virtual int peek()=0;
00058 virtual skString readAllToString()=0;
00059 };
00060
00061 class CLASSEXPORT skInputFile : public skInputSource
00062 {
00063 public:
00068 IMPORT_C skInputFile(const skString& filename);
00072 IMPORT_C skInputFile();
00077 IMPORT_C void open(const skString& filename);
00078 #ifdef __SYMBIAN32__
00079
00084 IMPORT_C void open(const TDesC& file);
00085 #endif
00086 IMPORT_C virtual ~skInputFile();
00090 IMPORT_C virtual bool eof() const;
00094 IMPORT_C virtual int get();
00098 IMPORT_C virtual int peek();
00103 IMPORT_C virtual skString readAllToString();
00104 private:
00105 #ifdef STREAMS_ENABLED
00106 ifstream m_In;
00107 #else
00108 FILE * m_In;
00109 bool m_Peeked;
00110 int m_PeekedChar;
00111 #endif
00112 #ifdef UNICODE_STRINGS
00113 bool m_FileIsUnicode;
00114 #endif
00115 };
00116 class CLASSEXPORT skInputString : public skInputSource
00117 {
00118 public:
00123 IMPORT_C skInputString(const skString& in);
00127 IMPORT_C virtual ~skInputString();
00131 IMPORT_C virtual bool eof() const;
00135 IMPORT_C virtual int get();
00139 IMPORT_C virtual int peek();
00143 IMPORT_C virtual skString readAllToString();
00144 private:
00145 skString m_In;
00146 unsigned int m_Pos;
00147 bool m_Peeked;
00148 int m_PeekedChar;
00149 };
00150
00151 #endif