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
00030 #ifndef EXPANDLIB_CMD_H_INCLUDED
00031 #define EXPANDLIB_CMD_H_INCLUDED
00032
00033 #include <string>
00034 #include <vector>
00035 #include <map>
00036 #include <utility>
00037
00038 #include <tchar.h>
00039
00040 #include "expandlib-expandable.h"
00041
00042 #include "expandlib-results.h"
00043 #include "expandlib-vartype.h"
00044 #include "expandlib-exceptions.h"
00045
00046 namespace expander {
00047
00049
00056 template<
00057
00058 class StringType = ::std::string
00059 >
00060 class expandcmd {
00061 private:
00063 expandcmd() {};
00064
00065 protected:
00066 typedef ::std::vector<StringType> FParamVectorType;
00067 typedef ::std::map<StringType, ::expander::expandvartype<StringType>*> FVarMapType;
00068 typedef ::std::map<StringType, ::expander::expandcmd<StringType>*> FCmdMapType;
00069
00071 expandable<StringType> * const expobj;
00073
00077 const StringType cmdname;
00078
00079 public:
00081
00083 expandcmd(expandable<StringType> * const eobj, const StringType cn) : expobj(eobj), cmdname(cn) {};
00084
00086
00089 virtual void operator()(StringType &dest, const FParamVectorType ¶ms, const FVarMapType &vars, ExpandResultsType &results) const = 0;
00090
00092
00096 void Register() { expobj->cmdmap[cmdname] = this; };
00097 };
00098
00099 }
00100
00101 #endif //EXPANDLIB_CMD_H_INCLUDED