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_LOWER_H_INCLUDED
00031 #define EXPANDLIB_CMD_LOWER_H_INCLUDED
00032
00033 #include <locale>
00034
00035 #include "expandlib-cmd.h"
00036
00037 namespace expander {
00038
00040
00044 template<
00045
00046 class StringType = ::std::string
00047 >
00048 class expcmd_lower : public expandcmd<StringType> {
00049 protected:
00051 const std::locale loc;
00052
00053 public:
00055
00058 expcmd_lower(expandable<StringType> * const eobj) : expandcmd<StringType>(eobj, _T("lower")), loc("") {};
00059
00060 virtual void operator()(StringType &dest, const FParamVectorType ¶ms, const FVarMapType &vars, ExpandResultsType &results) const
00061 {
00062 if ( params.size() == 1 ) {
00063 const StringType::iterator u=dest.end();
00064 expobj->expand(dest, params[0], vars, results);
00065
00066 std::use_facet< std::ctype<StringType::value_type> >(loc).tolower(u, dest.end());
00067 } else {
00068 throw expand_error(_T("expcmd_lower"),_T("Parameter error"));
00069 }
00070 }
00071 };
00072
00073 }
00074
00075 #endif //EXPANDLIB_CMD_LOWER_H_INCLUDED