ParsersFactory.h
Go to the documentation of this file.
1 // ============================================================================
2 #ifndef GAUDIPROPERTYPARSERS_PARSERSGENERATOR_H
3 #define GAUDIPROPERTYPARSERS_PARSERSGENERATOR_H 1
4 // ============================================================================
5 // Include files
6 // ============================================================================
7 // STD & STL
8 // ============================================================================
9 #include <string>
10 #include <vector>
11 #include <map>
12 // ============================================================================
13 // Boost:
14 // ============================================================================
15 #include <boost/mpl/assert.hpp>
16 #include <boost/type_traits.hpp>
17 // ============================================================================
18 // Gaudi
19 // ============================================================================
20 #include "GaudiKernel/StatusCode.h"
21 #include "GaudiKernel/GrammarsV2.h"
22 // ============================================================================
23 namespace Gaudi {
24  namespace Parsers {
25  // ========================================================================
26  typedef std::string::const_iterator IteratorT;
27  //typedef boost::spirit::ascii::space_type Skipper;
29  // ========================================================================
30  template<typename ResultT> inline StatusCode
31  parse_(ResultT& result, const std::string& input){
32  Skipper skipper;
34  IteratorT iter = input.begin(), end = input.end();
35  return qi::phrase_parse( iter, end, g, skipper , result) && (iter==end);
36  }
37  //=========================================================================
38  template<> inline StatusCode
39  parse_(std::string& result, const std::string& input){
40  Skipper skipper;
42  IteratorT iter = input.begin(), end = input.end();
43  if (!(qi::phrase_parse( iter, end, g, skipper, result) && (iter==end))){
44  result = input;
45  }
46  //@attention always
47  return true;
48  }
49  //=========================================================================
50  template<typename ResultT> inline StatusCode
51  parse(ResultT& result, const std::string& input){
52 
53  return parse_(result, input);
54  }
55  //=========================================================================
56  }/* Parsers */
57 } /* Gaudi */
58 //=============================================================================
59 #endif // GAUDIPROPERTYPARSERS_PARSERSGENERATOR_H
60 
StatusCode parse_(ResultT &result, const std::string &input)
SkipperGrammar< IteratorT > Skipper
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
T end(T...args)
STL class.
std::string::const_iterator IteratorT
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:50
T begin(T...args)
dictionary g
Definition: gaudirun.py:420
Helper functions to set/get the application return code.
Definition: __init__.py:1