Octane v1.01.20 - The Open Compression Toolkit for C++ | http://octane.sourceforge.net/ |
00001 00002 00003 00004 00005 00006 //--------------------------------------------------------------------------- 00007 00017 00018 //--------------------------------------------------------------------------- 00019 // forward declarations 00020 class OctaneParser; 00021 //--------------------------------------------------------------------------- 00022 00023 //--------------------------------------------------------------------------- 00024 // recursive header protection 00025 #ifndef Octane_ParserH 00026 #define Octane_ParserH 00027 //--------------------------------------------------------------------------- 00028 00029 //--------------------------------------------------------------------------- 00030 // application includes 00031 #include "../core/octaneclass.hpp" 00032 // system includes 00033 using namespace std; 00034 //--------------------------------------------------------------------------- 00035 00036 00037 00038 //--------------------------------------------------------------------------- 00048 class OctaneParser : public OctaneClass 00049 { 00050 public: 00052 OctaneParser() {;}; 00054 virtual ~OctaneParser() {;}; 00055 public: 00056 //--------------------------------------------------------------------------- 00057 // OCTANE PUBLIC API - RTTI FUNCTIONS - these are supported by all derived classes 00058 virtual std::string GetName() {return "OctaneParser";} 00059 virtual std::string GetDescription() {return "Base Parser Class";} 00060 virtual std::string GetHelpInformation() { return ""; } 00061 //--------------------------------------------------------------------------- 00062 public: 00063 //--------------------------------------------------------------------------- 00064 // PARSER PUBLIC API - PREPARATIONS FOR PARSING 00065 virtual bool ResetState() {return true;}; 00068 virtual bool CreateSymbolSetUsingStream(bitreader &from) {return true;}; 00071 virtual bool PrepareForParsing() {return true;}; 00073 virtual bool IsReadyToParse() {return true;}; 00077 virtual bool RewindAnyBufferedInput(bitreader &from) {return true;}; 00078 //--------------------------------------------------------------------------- 00079 public: 00080 //--------------------------------------------------------------------------- 00081 // PARSER PUBLIC API - MAIN PARSING FUNCTIONS 00084 virtual void SynchronizeStateForNewStream() {;}; 00086 virtual int GetSymbolCount()=0; 00092 virtual bool ParseNextSymbolFromInput(bitreader &from,int &symbolnum)=0; 00095 virtual bool WriteSymbolText(bitwriter &to, int symbolnum,bool &isendofstreamsymbol)=0; 00099 virtual string LookupSymbolText(int symbolnum)=0; 00100 //--------------------------------------------------------------------------- 00101 protected: 00102 //--------------------------------------------------------------------------- 00103 // PARSER INTERNAL - STATIC HELPER FUNCTIONS - some general purpose helper functions for derived classes 00106 static bool IsNonWordCharacter(unsigned char c); 00107 //--------------------------------------------------------------------------- 00108 }; 00109 //--------------------------------------------------------------------------- 00110 00111 00112 00113 //--------------------------------------------------------------------------- 00114 #endif 00115 //--------------------------------------------------------------------------- 00116