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_KNOWNVARS_H_INCLUDED
00031 #define EXPANDLIB_CMD_KNOWNVARS_H_INCLUDED
00032
00033 #include <boost/lexical_cast.hpp>
00034
00035 #include "expandlib-cmd.h"
00036
00037 namespace expander {
00038
00040
00044 template<
00045
00046 class StringType = ::std::string
00047 >
00048 class expcmd_knownvars : public expandcmd<StringType> {
00049 protected:
00050 public:
00052
00055 expcmd_knownvars(expandable<StringType> * const eobj) : expandcmd<StringType>(eobj, _T("knownvars")) {};
00056
00057 virtual void operator()(StringType &dest, const FParamVectorType ¶ms, const FVarMapType &vars, ExpandResultsType &results) const
00058 {
00059 if ( params.size() == 1 ) {
00060 ExpandResultsType r;
00061 StringType d;
00062 expobj->expand(d, params[0], vars, r);
00063
00064 try {
00065 dest+=boost::lexical_cast<StringType>(r.FoundVars());
00066 } catch(...) {
00067 throw general_error(_T("expcmd_knownvars"),_T("Error during lexical_cast<StringType>(r.FoundVars())"));
00068 }
00069 } else {
00070 throw expand_error(_T("expcmd_knownvars"),_T("Parameter error"));
00071 }
00072 }
00073 };
00074
00075 }
00076
00077 #endif //EXPANDLIB_CMD_KNOWNVARS_H_INCLUDED