CmdTranslation.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef CmdTranslation_h
00034 #define CmdTranslation_h 1
00035
00036 #include <libxml/encoding.h>
00037 #include <libxml/xmlwriter.h>
00038
00039 #include <string>
00040 #include <map>
00041 #include <iostream>
00042
00043 using std::string ;
00044 using std::map ;
00045 using std::ostream ;
00046
00047 class BESTokenizer ;
00048
00049 class CmdTranslation
00050 {
00051 private:
00052 typedef bool (*p_cmd_translator)( BESTokenizer &tokenizer,
00053 xmlTextWriterPtr writer ) ;
00054 static map< string, p_cmd_translator > _translations ;
00055
00056 static bool _is_show ;
00057
00058 static bool translate_show( BESTokenizer &tokenizer,
00059 xmlTextWriterPtr writer ) ;
00060 static bool translate_show_error( BESTokenizer &tokenizer,
00061 xmlTextWriterPtr writer ) ;
00062 static bool translate_catalog( BESTokenizer &tokenizer,
00063 xmlTextWriterPtr writer ) ;
00064 static bool translate_set( BESTokenizer &tokenizer,
00065 xmlTextWriterPtr writer ) ;
00066 static bool translate_context( BESTokenizer &tokenizer,
00067 xmlTextWriterPtr writer ) ;
00068 static bool translate_container( BESTokenizer &tokenizer,
00069 xmlTextWriterPtr writer ) ;
00070 static bool translate_define( BESTokenizer &tokenizer,
00071 xmlTextWriterPtr writer ) ;
00072 static bool translate_delete( BESTokenizer &tokenizer,
00073 xmlTextWriterPtr writer ) ;
00074 static bool translate_get( BESTokenizer &tokenizer,
00075 xmlTextWriterPtr writer ) ;
00076
00077 static bool do_translate( BESTokenizer &tokenizer,
00078 xmlTextWriterPtr writer ) ;
00079 public:
00080 static int initialize( int argc, char **argv ) ;
00081 static int terminate( void ) ;
00082
00083 static bool is_show() { return _is_show ; }
00084 static void set_show( bool val ) { _is_show = val ; }
00085
00086 static void add_translation( const string &name,
00087 p_cmd_translator func ) ;
00088 static void remove_translation( const string &name ) ;
00089
00090 static string translate( const string &commands ) ;
00091
00092 static void dump( ostream &strm ) ;
00093 } ;
00094
00095 #endif // CmdTranslation_h
00096