00001 /* 00002 ** Qaf Framework 1.2 00003 ** June 2006 00004 ** 00005 ** Pedro Luchini de Moraes, Public Domain - Free Lunch Code 00006 */ 00007 00008 #ifndef QAF_UTIL_INTEGERINPUTSTREAM_H 00009 #define QAF_UTIL_INTEGERINPUTSTREAM_H 00010 00011 #include "qafHgeInputStream.h" 00012 #include <string> 00013 00014 00015 namespace qaf { 00016 00027 class IntegerInputStream : private HgeInputStream { 00028 public: 00032 class EndOfFileException {}; 00033 00037 class EncodingException {}; 00038 00039 00046 IntegerInputStream ( const char * filename ); 00047 00057 bool canRead (); 00058 00065 int readInt (); 00066 00076 std::string readNullTerminatedString (); 00077 00082 virtual ~IntegerInputStream (); 00083 00084 private: 00085 // Throws an EndOfFileException if the end of the file is reached. 00086 int nextByte (); 00087 }; 00088 } 00089 00090 #endif