tfel
Loading...
Searching...
No Matches
tfel::utilities::Data Struct Reference

A structure able to contain values extracted from a JSON-like file. More...

#include </home/runner/work/tfel/tfel/include/TFEL/Utilities/Data.hxx>

Inheritance diagram for tfel::utilities::Data:
tfel::utilities::GenTypeBase< DataTypes >

Public Types

using CallBack = std::function<void(const Data&)>
 a simple alias
Public Types inherited from tfel::utilities::GenTypeBase< DataTypes >
using variant
 a simple alias

Public Member Functions

template<typename T1>
requires ( tfel::meta::TLCountNbrOfT<std::decay_t<T1>, DataTypes>::value == 1)
TFEL_INLINE explicit (false) Data(T1 &&v)
 constructor from a value
 Data ()
 default constructor
 Data (Data &&) noexcept
 move constructor
 Data (const Data &)
 copy constructor
Data & operator= (Data &&) noexcept
 move assignement
Data & operator= (const Data &)
 assignement
 ~Data ()
 destructor
Public Member Functions inherited from tfel::utilities::GenTypeBase< DataTypes >
 GenTypeBase ()=default
 default constructor
 explicit (false) GenTypeBase(T1 &&value)
 constructor from a value
GenTypeBase & operator= (GenTypeBase &&)=default
bool empty () const
bool copy (const GenTypeBase &src)
 copy a GenType (calls the assignement operator).
TFEL_INLINE void set (T1 &&src)
 set the value of the GenType.
TFEL_INLINE bool is () const
TFEL_INLINE const T1 & get () const
TFEL_INLINE unsigned short getTypeIndex () const

Static Public Member Functions

static Data read (CxxTokenizer::const_iterator &, const CxxTokenizer::const_iterator, const DataParsingOptions &={})
 read a JSON-like structure
static void parse (CxxTokenizer::const_iterator &, const CxxTokenizer::const_iterator, const std::map< std::string, CallBack > &, const DataParsingOptions &={})
 read a map. For each read key, a callback must available to treat the associated data. The result of the treatment is stored in the returned value.
static Data read_value (CxxTokenizer::const_iterator &, const CxxTokenizer::const_iterator, const DataParsingOptions &={})
 read a standard value (string,double,int)
static Data read_vector (CxxTokenizer::const_iterator &, const CxxTokenizer::const_iterator, const DataParsingOptions &={})
 read a map
static Data read_map (CxxTokenizer::const_iterator &, const CxxTokenizer::const_iterator, const DataParsingOptions &={})
 read a map

Additional Inherited Members

Static Public Attributes inherited from tfel::utilities::GenTypeBase< DataTypes >
static constexpr bool isValidType
 a variable checking if the given type is valid
Protected Member Functions inherited from tfel::utilities::GenTypeBase< DataTypes >
TFEL_INLINE void clear ()
 clear the GenType
TFEL_INLINE void set_uninitialised ()
 set the value of the GenType.

Detailed Description

A structure able to contain values extracted from a JSON-like file.

See also
the DataTypes list of types for all the values that a Data can contain.

Member Function Documentation

◆ parse()

void tfel::utilities::Data::parse ( CxxTokenizer::const_iterator & ,
const CxxTokenizer::const_iterator ,
const std::map< std::string, CallBack > & ,
const DataParsingOptions & = {} )
static

read a map. For each read key, a callback must available to treat the associated data. The result of the treatment is stored in the returned value.

Returns
treated values
Parameters
[in,out]pcurrent position in the tokens stream
[in]pepast-the-end iterator
[in]callbackslist of call-backs
[in]oparsing options

◆ read()

Data tfel::utilities::Data::read ( CxxTokenizer::const_iterator & ,
const CxxTokenizer::const_iterator ,
const DataParsingOptions & = {} )
static

read a JSON-like structure

Returns
the values read
Parameters
[in,out]pcurrent position in the tokens stream
[in]pepast-the-end iterator
[in]oparsing options

◆ read_map()

Data tfel::utilities::Data::read_map ( CxxTokenizer::const_iterator & ,
const CxxTokenizer::const_iterator ,
const DataParsingOptions & = {} )
static

read a map

Returns
the values read
Parameters
[in,out]pcurrent position in the tokens stream
[in]pepast-the-end iterator
[in]oparsing options

◆ read_value()

Data tfel::utilities::Data::read_value ( CxxTokenizer::const_iterator & ,
const CxxTokenizer::const_iterator ,
const DataParsingOptions & = {} )
static

read a standard value (string,double,int)

Returns
the values read
Parameters
[in,out]pcurrent position in the tokens stream
[in]pepast-the-end iterator
[in]oparsing options

◆ read_vector()

Data tfel::utilities::Data::read_vector ( CxxTokenizer::const_iterator & ,
const CxxTokenizer::const_iterator ,
const DataParsingOptions & = {} )
static

read a map

Returns
the values read
Parameters
[in,out]pcurrent position in the tokens stream
[in]pepast-the-end iterator
[in]oparsing options

The documentation for this struct was generated from the following file: