Belle II Software  release-08-01-10
StringToVector Class Reference

The StringToVector class converts a given string to the std::vector<T>. More...

#include <ARICHDatabaseTools.h>

Collaboration diagram for StringToVector:

Static Public Member Functions

template<typename T >
static auto convert (const std::string &rLine, const char delim=' ') -> std::vector< T >
 convert<T> converts the given string in to a std::vector<T> elements seperated by the given delimiter More...
 
template<typename T >
static auto parse (const std::string &rLine, const char delim=' ') -> std::string
 parse<T> expands the given string and evaluats defined operators. More...
 

Static Public Attributes

static const std::string m_gRangeOperator
 m_gRangeOperator is a std::wstring containing the range symbold
 

Static Private Member Functions

template<typename T >
static auto expand (std::ostream &rStream, const char delim, const std::string &rToken) -> std::ostream &
 expand<T> applies the given range and fills the given std::ostream with each element in range seperated by the delimiter char More...
 

Detailed Description

The StringToVector class converts a given string to the std::vector<T>.

The input string is allowed to contain white spaces and the specific types.

Definition at line 346 of file ARICHDatabaseTools.h.

Member Function Documentation

◆ convert()

static auto convert ( const std::string &  rLine,
const char  delim = ' ' 
) -> std::vector<T>
inlinestatic

convert<T> converts the given string in to a std::vector<T> elements seperated by the given delimiter

Parameters
rLinetokens seperated by the delimiter
delimdelimiter character
Returns
std::vector<T>
Exceptions
std::runtime_error()if
  • rLine contains other characters than delimiter, white space, digits or allowed characters defined by PrivateHelperClasses::TokenCast<T>
See also
PrivateHelperClasses::TokenCast<T> and its specializations

Definition at line 366 of file ARICHDatabaseTools.h.

◆ expand()

static auto expand ( std::ostream &  rStream,
const char  delim,
const std::string &  rToken 
) -> std::ostream&
inlinestaticprivate

expand<T> applies the given range and fills the given std::ostream with each element in range seperated by the delimiter char

Parameters
rStream
delim
rToken
Exceptions
std::runtime_errorif invalid range definition, ie A to B with A > B
Note
the precrement operator of T has to be defined, ie T::operator++()

Definition at line 459 of file ARICHDatabaseTools.h.

◆ parse()

static auto parse ( const std::string &  rLine,
const char  delim = ' ' 
) -> std::string
inlinestatic

parse<T> expands the given string and evaluats defined operators.

Currently only the range operator is defined and used.

Parameters
rLine
delim
Returns
the evaluated std::string.
Exceptions
std::runtime_error()if
  • invalid argument for during the operator parsing
  • out of range convertion, ie casting 0xffff into int8_t

Definition at line 410 of file ARICHDatabaseTools.h.


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