MarlinMT  0.1.0
marlinmt::StringUtil Class Reference

StringUtil class Simple utility class for string operations. More...

#include <Utils.h>

Public Member Functions

template<>
std::string typeToString (const std::string &var)
 
template<>
std::string typeToString (const bool &var)
 
template<>
std::string stringToType (const std::string &str)
 
template<>
bool stringToType (const std::string &str)
 

Static Public Member Functions

template<typename T >
static std::string typeToString (const T &var)
 Convert a type to string. More...
 
template<typename T >
static std::vector< std::string > typeToString (const std::vector< T > &vars)
 Convert a vector of type to vector of string. More...
 
template<typename T >
static T stringToType (const std::string &str)
 Convert a variable to string. More...
 
template<typename T >
static std::vector< T > stringToType (const std::vector< std::string > &strs)
 Convert a string vector to a vector of specified type. More...
 
template<typename T >
static std::vector< T > split (const std::string &inputString, const std::string &delimiter=" ")
 Split the string with the corresponding delimiter. More...
 
template<typename T >
static std::string join (const T &input, const std::string &delimiter=" ")
 Weird overload for scalar types. More...
 
template<typename T >
static std::string join (const std::vector< T > &input, const std::string &delimiter=" ")
 Join the input values from the vector with the corresponding delimiter and returns a string representation of it. More...
 

Detailed Description

StringUtil class Simple utility class for string operations.

Definition at line 157 of file Utils.h.

Member Function Documentation

◆ join() [1/2]

template<typename T >
std::string marlinmt::StringUtil::join ( const T &  input,
const std::string &  delimiter = " " 
)
inlinestatic

Weird overload for scalar types.

Just returns the conversion to string. See overload version with vector instead.

Parameters
inputthe input value
delimiterthe string delimiter (unused here)

Definition at line 320 of file Utils.h.

◆ join() [2/2]

template<typename T >
std::string marlinmt::StringUtil::join ( const std::vector< T > &  input,
const std::string &  delimiter = " " 
)
inlinestatic

Join the input values from the vector with the corresponding delimiter and returns a string representation of it.

Parameters
inputthe input vector or values to join
delimiterthe string delimiter

Definition at line 327 of file Utils.h.

◆ split()

template<typename T >
std::vector< T > marlinmt::StringUtil::split ( const std::string &  inputString,
const std::string &  delimiter = " " 
)
inlinestatic

Split the string with the corresponding delimiter.

Parameters
inputStringthe input string to split
delimiterthe string delimiter

Definition at line 303 of file Utils.h.

References marlinmt::book::Flags::value().

◆ stringToType() [1/4]

template<typename T >
T marlinmt::StringUtil::stringToType ( const std::string &  str)
inlinestatic

Convert a variable to string.

Parameters
strthe string to convert

Definition at line 263 of file Utils.h.

◆ stringToType() [2/4]

template<typename T >
std::vector< T > marlinmt::StringUtil::stringToType ( const std::vector< std::string > &  strs)
inlinestatic

Convert a string vector to a vector of specified type.

Parameters
strsthe string vector to convert

Definition at line 291 of file Utils.h.

◆ stringToType() [3/4]

template<>
std::string marlinmt::StringUtil::stringToType ( const std::string &  str)
inline

Definition at line 275 of file Utils.h.

◆ stringToType() [4/4]

template<>
bool marlinmt::StringUtil::stringToType ( const std::string &  str)
inline

Definition at line 282 of file Utils.h.

◆ typeToString() [1/4]

template<typename T >
std::string marlinmt::StringUtil::typeToString ( const T &  var)
inlinestatic

Convert a type to string.

Parameters
varthe value to convert

Definition at line 226 of file Utils.h.

◆ typeToString() [2/4]

template<typename T >
std::vector< std::string > marlinmt::StringUtil::typeToString ( const std::vector< T > &  vars)
inlinestatic

Convert a vector of type to vector of string.

Parameters
varsthe values to convert

Definition at line 251 of file Utils.h.

◆ typeToString() [3/4]

template<>
std::string marlinmt::StringUtil::typeToString ( const std::string &  var)
inline

Definition at line 237 of file Utils.h.

◆ typeToString() [4/4]

template<>
std::string marlinmt::StringUtil::typeToString ( const bool &  var)
inline

Definition at line 244 of file Utils.h.


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