Belle II Software development
TokenCast< int > Struct Reference

Integer specialization of TokenCast<T> More...

#include <ARICHDatabaseTools.h>

Public Member Functions

auto isValidChar (const unsigned char character) const noexcept -> bool
 isValidChar defines characters that are allowed for the convertion
 
auto operator() (const std::string &rToken) const -> int
 operator () converts given token to an integer.
 

Detailed Description

Integer specialization of TokenCast<T>

Definition at line 242 of file ARICHDatabaseTools.h.

Member Function Documentation

◆ isValidChar()

auto isValidChar ( const unsigned char  character) const -> bool
inlinenoexcept

isValidChar defines characters that are allowed for the convertion

Parameters
character
Returns
true if its allowed for convertion

Definition at line 248 of file ARICHDatabaseTools.h.

250 {
251 return std::isdigit(character);
252 }

◆ operator()()

auto operator() ( const std::string &  rToken) const -> int
inline

operator () converts given token to an integer.

Parameters
rToken
Exceptions
invalid_argumentin case the given string is invalid for convertion
std::out_of_rangeif the given number is smaller/greater than a integer.

Definition at line 262 of file ARICHDatabaseTools.h.

263 {
264 return std::stoi(rToken);
265 }

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