00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __INTERPRETER_H__
00013 #define __INTERPRETER_H__
00014
00015 #include <vector>
00016 #include <wx/hashmap.h>
00017
00018
00019 namespace VRUT
00020 {
00022 class Interpreter
00023 {
00024 protected:
00026 enum ARG_TYPE
00027 {
00028 ARG_STRING,
00029 ARG_INT,
00030 ARG_UNSIGNED,
00031 ARG_FLOAT,
00032 ARG_BOOL
00033 };
00034
00036 struct Argument
00037 {
00038 wxString name;
00039 ARG_TYPE type;
00040 bool mandatory;
00041
00042 Argument(wxString _name, ARG_TYPE _type, bool _mandatory) : name(_name), type(_type), mandatory(_mandatory) {}
00043 };
00044 typedef std::vector<Argument> ArgList;
00045 WX_DECLARE_STRING_HASH_MAP(ArgList, CommandEntries);
00046
00048 CommandEntries commandEntries;
00049
00051 wxString getUsageString(CommandEntries::const_iterator cmdEntry) const;
00052
00053 public:
00055 Interpreter();
00057 virtual ~Interpreter();
00058
00063 size_t GetCommandsStarting(const wxString & cmdPart, std::vector<wxString> * cmdList) const;
00065 bool CheckSyntax(const wxString & cmd) const;
00069 bool ProcessCommand(const wxString & cmd);
00073 bool ExecuteScriptFile(const wxString & scriptFileName);
00074 };
00075 };
00076
00077
00078 #endif