ifw-core  5.0.0-pre2
Functions
core::utils::conversion Namespace Reference

Functions

std::string DblToString (const double dbl_val, const std::string &prec_or_format="3")
 Convert a double value to its string representation, applying the given precision. More...
 
std::string BoolToString (const bool bool_val, const bool long_format=true)
 Convert a boolean value to a string (Short format: T/F; Long format: True/False). More...
 
bool Boolean (const std::string &value, const bool permissive=false)
 Interpret a string as a boolean (t/T/true/TRUE -> true; f/F/false/FALSE -> false). More...
 
void Convert (const std::string &str_value, std::string &native_value)
 Handle case: Conversion of std::string to std::string. More...
 
template<typename TYPE >
std::string NbToStr (const TYPE number, const std::string &format="")
 Convert the given value to a string representation. More...
 
template<typename TYPE >
void Convert_ (const std::string &str_value, std::variant< TYPE > &native_value)
 Convert a value represented as string into its 'native type'. Data type not given. Boolean string representations are converted as: {t/T/true/True/TRUE -> true} and {f/F/false/False/FALSE -> false}. More...
 
template<typename TYPE >
void Convert (const std::string &str_value, TYPE &value)
 Convert a value represented as string into its 'native type'. Data type not given. More...
 

Detailed Description

Function Documentation

◆ Boolean()

bool core::utils::conversion::Boolean ( const std::string &  value,
const bool  permissive 
)

Interpret a string as a boolean (t/T/true/TRUE -> true; f/F/false/FALSE -> false).

◆ BoolToString()

std::string core::utils::conversion::BoolToString ( const bool  value,
const bool  long_format 
)

Convert a boolean value to a string (Short format: T/F; Long format: True/False).

◆ Convert() [1/2]

void core::utils::conversion::Convert ( const std::string &  str_value,
std::string &  native_value 
)

Handle case: Conversion of std::string to std::string.

◆ Convert() [2/2]

template<typename TYPE >
void core::utils::conversion::Convert ( const std::string &  str_value,
TYPE &  value 
)

Convert a value represented as string into its 'native type'. Data type not given.

◆ Convert_()

template<typename TYPE >
void core::utils::conversion::Convert_ ( const std::string &  str_value,
std::variant< TYPE > &  native_value 
)

Convert a value represented as string into its 'native type'. Data type not given. Boolean string representations are converted as: {t/T/true/True/TRUE -> true} and {f/F/false/False/FALSE -> false}.

◆ DblToString()

std::string core::utils::conversion::DblToString ( const double  value,
const std::string &  prec_or_format 
)

Convert a double value to its string representation, applying the given precision.

◆ NbToStr()

template<typename TYPE >
std::string core::utils::conversion::NbToStr ( const TYPE  number,
const std::string &  format = "" 
)

Convert the given value to a string representation.