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_RTRIM_H_INCLUDED
00031 #define EXPANDLIB_CMD_RTRIM_H_INCLUDED
00032
00033 #include "expandlib-cmd.h"
00034
00035 namespace expander {
00036
00038
00042 template<
00043
00044 class StringType = ::std::string
00045 >
00046 class expcmd_rtrim : public expandcmd<StringType> {
00047 protected:
00048 public:
00050
00053 expcmd_rtrim(expandable<StringType> * const eobj) : expandcmd<StringType>(eobj, _T("rtrim")) {};
00054
00056 virtual void operator()(StringType &dest, const FParamVectorType ¶ms, const FVarMapType &vars, ExpandResultsType &results) const
00057 {
00058 if ( params.size() == 2 ) {
00059 StringType d;
00060 expobj->expand(d, params[0], vars, results);
00061
00062 dest.append(d.begin(), d.begin()+d.find_last_not_of(params[1])+1);
00063 } else {
00064 throw expand_error(_T("expcmd_rtrim"),_T("Parameter error"));
00065 }
00066 }
00067 };
00068
00069 }
00070
00071 #endif //EXPANDLIB_CMD_RTRIM_H_INCLUDED