Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:36:15

0001 #ifndef CommonTools_Utils_MethodArgumentSetter_h
0002 #define CommonTools_Utils_MethodArgumentSetter_h
0003 /* \class reco::parser::MethodArgumentSetter
0004  *
0005  * MethodArgumenteger setter
0006  *
0007  * \author  Luca Lista, INFN
0008  *
0009  * \version $Revision: 1.1 $
0010  *
0011  */
0012 #include "CommonTools/Utils/interface/parser/MethodArgumentStack.h"
0013 #include <cassert>
0014 
0015 namespace reco {
0016   namespace parser {
0017     struct MethodArgumentSetter {
0018       MethodArgumentSetter(MethodArgumentStack &stack) : stack_(stack) {}
0019       template <typename T>
0020       void operator()(const T &n) const {
0021         stack_.push_back(AnyMethodArgument(n));
0022       }
0023       void operator()(const char *begin, const char *end) const {
0024         assert(begin + 1 <= end - 1);  // the quotes are included in [begin,end[ range.
0025         //in boost 1.67, the parser appends any extra white space to the
0026         // end
0027         if (*(end - 1) != *begin) {
0028           --end;
0029         }
0030         stack_.push_back(AnyMethodArgument(std::string(begin + 1, end - 1)));
0031       }
0032 
0033     private:
0034       MethodArgumentStack &stack_;
0035     };
0036   }  // namespace parser
0037 }  // namespace reco
0038 
0039 #endif