Octane v1.01.20 - The Open Compression Toolkit for C++ http://octane.sourceforge.net/
Homepage | Main | Modules | Class Hierarchy | Compound List | File List | Compound Members | Related Pages

parsers/parser_sample/sampleparser.hpp

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 //---------------------------------------------------------------------------
00013 
00014 //---------------------------------------------------------------------------
00015 // recursive header protection
00016 #ifndef SampleParserH
00017 #define SampleParserH
00018 //---------------------------------------------------------------------------
00019 
00020 //---------------------------------------------------------------------------
00021 // application includes
00022 #include "../parser.hpp"
00023 #include "../../bitio/bitio.hpp"
00024 // system includes
00025 using namespace std;
00026 //---------------------------------------------------------------------------
00027 
00028 
00029 
00030 
00031 //---------------------------------------------------------------------------
00032 // this parser uses 256 symbols
00033 // symbols 0-255 are ascii characters, symbol 255 is used for end of stream
00034 #define SampleParser_EndOfStreamSYMBOL 255
00035 //---------------------------------------------------------------------------
00036 
00037 
00038 
00039 
00040 //---------------------------------------------------------------------------
00045 class SampleParser : public OctaneParser
00046 {
00047 protected:
00050         bool senteos;
00051 public:
00052         //---------------------------------------------------------------------------
00054         SampleParser() {;};
00056         ~SampleParser() {;};
00057         //---------------------------------------------------------------------------
00058 public:
00059         //---------------------------------------------------------------------------
00060         // PARSER PUBLIC API - PREPARATIONS FOR PARSING
00061         virtual bool CreateSymbolSetUsingStream(bitreader &from) {return true;};
00062         virtual bool IsReadyToParse() {return true;};
00063         virtual bool RewindAnyBufferedInput(bitreader &from) {return true;};
00064         //---------------------------------------------------------------------------
00065 public:
00066         //---------------------------------------------------------------------------
00067         // PARSER PUBLIC API - MAIN PARSING FUNCTIONS
00068         virtual void SynchronizeStateForNewStream();
00069         virtual int GetSymbolCount() {return 256;};
00070         virtual bool ParseNextSymbolFromInput(bitreader &from, int &symbolnum);
00071         virtual bool WriteSymbolText(bitwriter &to, int symbolnum,bool &isendofstreamsymbol);
00072         virtual string LookupSymbolText(int symbolnum);
00073         //---------------------------------------------------------------------------
00074 public:
00075         //---------------------------------------------------------------------------
00076         // OCTANE PUBLIC API - AUXILIARY FUNCTIONS - these are supported by all derived classes
00077         virtual void ShowDebuggingInfo() {;};
00078         virtual unsigned int GetMemoryUsed() {return (unsigned int)(sizeof(this));};
00079         virtual unsigned int GetDiskspaceUsed(bool fortempdecompressiononly) {return (unsigned int)0;};
00080         virtual std::string GetParametersInformation() {return "";};
00081         virtual void SetDefaultParameters() {;};
00082         virtual bool SetParameter(const std::string &parametername,const std::string &parametervalue) {return false;};
00083         virtual bool SaveState(bitwriter &to,bool fortempdecompressiononly) {return true;};
00084         virtual bool LoadState(bitreader &from) {return true;};
00085         //---------------------------------------------------------------------------
00086 };
00087 //---------------------------------------------------------------------------
00088 
00089 
00090 
00091 
00092 
00093 //---------------------------------------------------------------------------
00094 #endif
00095 //---------------------------------------------------------------------------
00096 
 
Generated on 20 May 2004 by doxygen 1.3.3