The Gaudi Framework  v29r0 (ff2e7097)
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 );
39  }
40  //=========================================================================
41  template <>
42  inline StatusCode parse_( std::string& result, const std::string& input )
43  {
44  Skipper skipper;
46  IteratorT iter = input.begin(), end = input.end();
47  if ( !( qi::phrase_parse( iter, end, g, skipper, result ) && ( iter == end ) ) ) {
48  result = input;
49  }
50  //@attention always
51  return true;
52  }
53  //=========================================================================
54  template <typename ResultT>
55  inline StatusCode parse( ResultT& result, const std::string& input )
56  {
57 
58  return parse_( result, input );
59  }
60  //=========================================================================
61  } /* Parsers */
62 } /* Gaudi */
63 //=============================================================================
64 #endif // GAUDIPROPERTYPARSERS_PARSERSGENERATOR_H
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:28
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:64
T begin(T...args)
dictionary g
Definition: gaudirun.py:439
Helper functions to set/get the application return code.
Definition: __init__.py:1