Gaudi Framework, version v20r4

Generated: 8 Jan 2009

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
00019 // ============================================================================
00020 #include "boost/spirit.hpp"
00021 // ============================================================================
00022 // Boost.Spirit.Phoenix
00023 // ============================================================================
00024 #include "boost/spirit/phoenix.hpp"
00025 // ============================================================================
00026 // GaudiKernel
00027 // ============================================================================
00028 #include "GaudiKernel/Parsers.h"
00029 #include "GaudiKernel/Grammars.h"
00030 // ============================================================================
00048 // ============================================================================
00049 namespace Gaudi
00050 {
00051   namespace Parsers
00052   {
00053     using namespace std;
00054     using namespace boost::spirit ;
00055 
00057     typedef boost::spirit::position_iterator<string::const_iterator> IteratorT;
00058 
00060     inline IteratorT createIterator( const std::string& input)
00061     { return IteratorT ( input.begin(), input.end() ) ; }
00062 
00063     // ========================================================================
00076     // ========================================================================
00077     template<typename IntegerT>
00078     inline StatusCode parse_integer
00079     (IntegerT& result,const string& input)
00080     {
00081       IntGrammar<IntegerT> g;
00082       return parse
00083         ( createIterator(input),
00084           IteratorT(),
00085           g[var(result)=arg1]).full;
00086     }
00087     // ========================================================================
00103     // ========================================================================
00104     template<typename IntegerT>
00105     inline  StatusCode parse_integer_vector
00106     ( std::vector<IntegerT>& result,const string& input)
00107     {
00108       VectorGrammar<IntGrammar<IntegerT> > g;
00109       return parse
00110         ( createIterator(input),
00111           IteratorT(),
00112           g[var(result)=arg1],
00113           SkipperGrammar()).full;
00114     }
00115     // ========================================================================
00128     // ========================================================================
00129     template<typename CharT>
00130     inline StatusCode  parse_char
00131     ( CharT& result , const string& input )
00132     {
00133       CharGrammar<CharT> g;
00134       return parse
00135         ( createIterator(input),
00136           IteratorT(),
00137           g[var(result)=arg1]).full;
00138     }
00139     // ========================================================================
00155     // ========================================================================
00156     template<typename CharT>
00157     inline StatusCode parse_char_vector
00158     (std::vector<CharT>& result,const string& input)
00159     {
00160       VectorGrammar<CharGrammar<CharT> > g;
00161       return parse
00162         ( createIterator(input),
00163           IteratorT(),
00164           g[var(result)=arg1],
00165           SkipperGrammar()).full;
00166     }
00167     // ========================================================================
00180     template<typename RealT>
00181     inline StatusCode parse_real
00182     ( RealT& result , const string& input)
00183     {
00184       RealGrammar<RealT> g;
00185       return parse
00186         ( createIterator(input),
00187           IteratorT(),
00188           g[var(result)=arg1],
00189           SkipperGrammar()).full;
00190     }
00191     // ========================================================================
00207     // ========================================================================
00208     template<typename RealT>
00209     StatusCode parse_real_vector
00210     ( std::vector<RealT>& result,const string& input)
00211     {
00212       VectorGrammar< RealGrammar<RealT> > g;
00213       return parse
00214         ( createIterator(input),
00215           IteratorT(),
00216           g[var(result)=arg1],
00217           SkipperGrammar()).full;
00218     }
00219   } // end of namespace Gaudi::Parsers
00220 } // end of namespace Gaudi
00221 // ============================================================================
00222 #endif
00223 // ============================================================================
00224 // The END
00225 // ============================================================================
00226 
00227 

Generated at Thu Jan 8 17:44:21 2009 for Gaudi Framework, version v20r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004