The Gaudi Framework  v30r3 (a5ef0a68)
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 <map>
10 #include <string>
11 #include <vector>
12 // ============================================================================
13 // Boost:
14 // ============================================================================
15 #include <boost/mpl/assert.hpp>
16 #include <boost/type_traits.hpp>
17 // ============================================================================
18 // Gaudi
19 // ============================================================================
20 #include "GaudiKernel/GrammarsV2.h"
21 #include "GaudiKernel/StatusCode.h"
22 // ============================================================================
23 namespace Gaudi
24 {
25  namespace Parsers
26  {
27  // ========================================================================
28  typedef std::string::const_iterator IteratorT;
29  // typedef boost::spirit::ascii::space_type Skipper;
31  // ========================================================================
32  template <typename ResultT>
33  inline StatusCode parse_( ResultT& result, const std::string& input )
34  {
35  Skipper skipper;
37  IteratorT iter = input.begin(), end = input.end();
38  return ( qi::phrase_parse( iter, end, g, skipper, result ) && ( iter == end ) ? StatusCode::SUCCESS
40  }
41  //=========================================================================
42  template <>
43  inline StatusCode parse_( std::string& result, const std::string& input )
44  {
45  Skipper skipper;
47  IteratorT iter = input.begin(), end = input.end();
48  if ( !( qi::phrase_parse( iter, end, g, skipper, result ) && ( iter == end ) ) ) {
49  result = input;
50  }
51  //@attention always
52  return StatusCode::SUCCESS;
53  }
54  //=========================================================================
55  template <typename ResultT>
56  inline StatusCode parse( ResultT& result, const std::string& input )
57  {
58  return parse_( result, input );
59  }
60  //=========================================================================
61  } /* Parsers */
62 } /* Gaudi */
63 //=============================================================================
64 #endif // GAUDIPROPERTYPARSERS_PARSERSGENERATOR_H
constexpr static const auto FAILURE
Definition: StatusCode.h:88
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:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
T begin(T...args)
dictionary g
Definition: gaudirun.py:439
Helper functions to set/get the application return code.
Definition: __init__.py:1