The Gaudi Framework  master (bdbe7744)
Loading...
Searching...
No Matches
ParsersStandardSingle.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
17#ifndef __clang__
18# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
19#endif
20
23#include <nlohmann/json.hpp>
24#include <string>
25#include <string_view>
26#include <utility>
27
28#define PARSERS_DEF_FOR_SINGLE( Type ) \
29 StatusCode Gaudi::Parsers::parse( Type& result, std::string_view input ) { \
30 return Gaudi::Parsers::parse_( result, input ); \
31 }
32
35PARSERS_DEF_FOR_SINGLE( unsigned char )
36PARSERS_DEF_FOR_SINGLE( signed char )
39PARSERS_DEF_FOR_SINGLE( unsigned short )
40PARSERS_DEF_FOR_SINGLE( unsigned int )
42PARSERS_DEF_FOR_SINGLE( unsigned long )
43PARSERS_DEF_FOR_SINGLE( long long )
44PARSERS_DEF_FOR_SINGLE( unsigned long long )
47PARSERS_DEF_FOR_SINGLE( long double )
48PARSERS_DEF_FOR_SINGLE( std::string )
49
50StatusCode Gaudi::Parsers::parse( nlohmann::json& result, std::string_view input ) {
51 auto parsed = nlohmann::json::parse( input, nullptr, false );
52 if ( parsed.is_discarded() ) return StatusCode::FAILURE;
53 result = std::move( parsed );
55}
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
#define PARSERS_DEF_FOR_SINGLE(Type)
@fixme workaround for a warning in a Boost spirit header
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr static const auto SUCCESS
Definition StatusCode.h:99
constexpr static const auto FAILURE
Definition StatusCode.h:100
StatusCode parse(GaudiUtils::HashMap< K, V > &result, std::string_view input)
Basic parser for the types of HashMap used in DODBasicMapper.