Gaudi Framework, version v23r2

Home   Generated: Thu Jun 28 2012

Parsers.icpp

Go to the documentation of this file.
00001 // $Id: Parsers.icpp,v 1.5 2008/10/28 14:02:18 marcocle Exp $
00002 // ============================================================================
00003 #ifndef GAUDIKERNEL_PARSERS_ICPP
00004 #define GAUDIKERNEL_PARSERS_ICPP 1
00005 // ============================================================================
00006 // Include files
00007 // ============================================================================
00008 // STD&STL
00009 // ============================================================================
00010 #include <vector>
00011 #include <map>
00012 #include <string>
00013 // ============================================================================
00014 // Boost.Bind
00015 // ============================================================================
00016 #include "boost/bind.hpp"
00017 // ============================================================================
00018 // Boost.Spirit, Boost.Spirit.Phoenix
00019 // ============================================================================
00020 #include <boost/version.hpp>
00021 #if BOOST_VERSION >= 103800
00022 // FIXME: Move to the new boost::spirit::classic namespace
00023 #if !defined(BOOST_SPIRIT_USE_OLD_NAMESPACE)
00024 #define BOOST_SPIRIT_USE_OLD_NAMESPACE
00025 #endif
00026 #include <boost/spirit/include/classic.hpp>
00027 #include <boost/spirit/include/phoenix1.hpp>
00028 #else
00029 #include <boost/spirit.hpp>
00030 #include <boost/spirit/phoenix.hpp>
00031 #endif
00032 // ============================================================================
00033 // GaudiKernel
00034 // ============================================================================
00035 #include "GaudiKernel/Parsers.h"
00036 #include "GaudiKernel/Grammars.h"
00037 // ============================================================================
00055 // ============================================================================
00056 namespace Gaudi
00057 {
00058   namespace Parsers
00059   {
00060     using namespace std;
00061     using namespace boost::spirit ;
00062 
00064     typedef boost::spirit::position_iterator<string::const_iterator> IteratorT;
00065 
00067     inline IteratorT createIterator( const std::string& input)
00068     { return IteratorT ( input.begin(), input.end() ) ; }
00069 
00070     // ========================================================================
00083     // ========================================================================
00084     template<typename IntegerT>
00085     inline StatusCode parse_integer
00086     (IntegerT& result,const string& input)
00087     {
00088       IntGrammar<IntegerT> g;
00089       return parse
00090         ( createIterator(input),
00091           IteratorT(),
00092           g[var(result)=arg1]).full;
00093     }
00094     // ========================================================================
00110     // ========================================================================
00111     template<typename IntegerT>
00112     inline  StatusCode parse_integer_vector
00113     ( std::vector<IntegerT>& result,const string& input)
00114     {
00115       VectorGrammar<IntGrammar<IntegerT> > g;
00116       return parse
00117         ( createIterator(input),
00118           IteratorT(),
00119           g[var(result)=arg1],
00120           SkipperGrammar()).full;
00121     }
00122     // ========================================================================
00135     // ========================================================================
00136     template<typename CharT>
00137     inline StatusCode  parse_char
00138     ( CharT& result , const string& input )
00139     {
00140       CharGrammar<CharT> g;
00141       return parse
00142         ( createIterator(input),
00143           IteratorT(),
00144           g[var(result)=arg1]).full;
00145     }
00146     // ========================================================================
00162     // ========================================================================
00163     template<typename CharT>
00164     inline StatusCode parse_char_vector
00165     (std::vector<CharT>& result,const string& input)
00166     {
00167       VectorGrammar<CharGrammar<CharT> > g;
00168       return parse
00169         ( createIterator(input),
00170           IteratorT(),
00171           g[var(result)=arg1],
00172           SkipperGrammar()).full;
00173     }
00174     // ========================================================================
00187     template<typename RealT>
00188     inline StatusCode parse_real
00189     ( RealT& result , const string& input)
00190     {
00191       RealGrammar<RealT> g;
00192       return parse
00193         ( createIterator(input),
00194           IteratorT(),
00195           g[var(result)=arg1],
00196           SkipperGrammar()).full;
00197     }
00198     // ========================================================================
00214     // ========================================================================
00215     template<typename RealT>
00216     StatusCode parse_real_vector
00217     ( std::vector<RealT>& result,const string& input)
00218     {
00219       VectorGrammar< RealGrammar<RealT> > g;
00220       return parse
00221         ( createIterator(input),
00222           IteratorT(),
00223           g[var(result)=arg1],
00224           SkipperGrammar()).full;
00225     }
00226   } // end of namespace Gaudi::Parsers
00227 } // end of namespace Gaudi
00228 // ============================================================================
00229 #endif
00230 // ============================================================================
00231 // The END
00232 // ============================================================================
00233 
00234 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Thu Jun 28 2012 23:27:22 for Gaudi Framework, version v23r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004