Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Gaudi/Parsers/Factory.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #pragma once
0012 // ============================================================================
0013 // Include files
0014 // ============================================================================
0015 // STD & STL
0016 // ============================================================================
0017 #include <map>
0018 #include <string>
0019 #include <vector>
0020 // ============================================================================
0021 // Boost:
0022 // ============================================================================
0023 #include <boost/mpl/assert.hpp>
0024 #include <boost/type_traits.hpp>
0025 // ============================================================================
0026 // Gaudi
0027 // ============================================================================
0028 #include <Gaudi/Parsers/Grammars.h>
0029 #include <GaudiKernel/StatusCode.h>
0030 // ============================================================================
0031 namespace Gaudi {
0032   namespace Parsers {
0033     // ========================================================================
0034     typedef std::string_view::const_iterator IteratorT;
0035     // typedef boost::spirit::ascii::space_type Skipper;
0036     typedef SkipperGrammar<IteratorT> Skipper;
0037     // ========================================================================
0038     template <typename ResultT>
0039     inline StatusCode parse_( ResultT& result, std::string_view input ) {
0040       Skipper                                                 skipper;
0041       typename Grammar_<IteratorT, ResultT, Skipper>::Grammar g;
0042       IteratorT                                               iter = input.begin(), end = input.end();
0043       return ( qi::phrase_parse( iter, end, g, skipper, result ) && ( iter == end ) ? StatusCode::SUCCESS
0044                                                                                     : StatusCode::FAILURE );
0045     }
0046     //=========================================================================
0047     template <>
0048     inline StatusCode parse_( std::string& result, std::string_view input ) {
0049       Skipper                                            skipper;
0050       Grammar_<IteratorT, std::string, Skipper>::Grammar g;
0051       IteratorT                                          iter = input.begin(), end = input.end();
0052       if ( !( qi::phrase_parse( iter, end, g, skipper, result ) && ( iter == end ) ) ) { result = input; }
0053       //@attention always
0054       return StatusCode::SUCCESS;
0055     }
0056     //=========================================================================
0057     template <typename ResultT>
0058     inline StatusCode parse( ResultT& result, std::string_view input ) {
0059       return parse_( result, input );
0060     }
0061     //=========================================================================
0062   } // namespace Parsers
0063 } // namespace Gaudi