inicpp
C++ parser of INI files with schema validation.
|
Functions | |
std::string | left_trim (const std::string &str) |
std::string | right_trim (const std::string &str) |
std::string | trim (const std::string &str) |
bool | find_needle (const std::string &haystack, const std::string &needle) |
bool | starts_with (const std::string &str, const std::string &search_str) |
bool | ends_with (const std::string &str, const std::string &search_str) |
std::vector< std::string > | split (const std::string &str, char delim) |
template<typename ReturnType > | |
ReturnType | parse_string (const std::string &value, const std::string &option_name) |
template<> | |
string_ini_t | parse_string< string_ini_t > (const std::string &value, const std::string &) |
template<> | |
boolean_ini_t | parse_string< boolean_ini_t > (const std::string &value, const std::string &option_name) |
template<> | |
enum_ini_t | parse_string< enum_ini_t > (const std::string &value, const std::string &option_name) |
template<> | |
float_ini_t | parse_string< float_ini_t > (const std::string &value, const std::string &option_name) |
template<> | |
signed_ini_t | parse_string< signed_ini_t > (const std::string &value, const std::string &option_name) |
template<> | |
unsigned_ini_t | parse_string< unsigned_ini_t > (const std::string &value, const std::string &option_name) |
Namespace which contains methods for working with strings, including basic string operations and inicpp specific parsing.
bool inicpp::string_utils::ends_with | ( | const std::string & | str, |
const std::string & | search_str | ||
) |
Tries to find out if given str ends with search_str.
str | searched string |
search_str | string which is searched for |
Definition at line 55 of file string_utils.cpp.
bool inicpp::string_utils::find_needle | ( | const std::string & | haystack, |
const std::string & | needle | ||
) |
In haystack find any occurence of needle.
haystack | string in which search is executed |
needle | string which is searched for |
Definition at line 33 of file string_utils.cpp.
std::string inicpp::string_utils::left_trim | ( | const std::string & | str | ) |
Trim whitespaces from start of given string.
str | processed string |
Definition at line 10 of file string_utils.cpp.
ReturnType inicpp::string_utils::parse_string | ( | const std::string & | value, |
const std::string & | option_name | ||
) |
Function for parsing string input value to strongly typed one
value | Value to be parsed |
option_name | Option name from this value - will be in exception text if thrown |
invalid_type_exception | if such cast cannot be made |
Definition at line 75 of file string_utils.h.
boolean_ini_t inicpp::string_utils::parse_string< boolean_ini_t > | ( | const std::string & | value, |
const std::string & | option_name | ||
) |
Parse string to boolean value.
value | Value to be parsed |
option_name | Option name from this value - will be in exception text if thrown |
invalid_type_exception | if string cannot be parsed |
Definition at line 90 of file string_utils.cpp.
enum_ini_t inicpp::string_utils::parse_string< enum_ini_t > | ( | const std::string & | value, |
const std::string & | option_name | ||
) |
Parse string to enum value.
value | Value to be parsed |
option_name | Option name from this value - will be in exception text if thrown |
invalid_type_exception | if string cannot be parsed |
Definition at line 104 of file string_utils.cpp.
float_ini_t inicpp::string_utils::parse_string< float_ini_t > | ( | const std::string & | value, |
const std::string & | option_name | ||
) |
Parse string to float value.
value | Value to be parsed |
option_name | Option name from this value - will be in exception text if thrown |
invalid_type_exception | if string cannot be parsed |
Definition at line 109 of file string_utils.cpp.
signed_ini_t inicpp::string_utils::parse_string< signed_ini_t > | ( | const std::string & | value, |
const std::string & | option_name | ||
) |
Parse string to signed value.
value | Value to be parsed |
option_name | Option name from this value - will be in exception text if thrown |
invalid_type_exception | if string cannot be parsed |
Definition at line 118 of file string_utils.cpp.
string_ini_t inicpp::string_utils::parse_string< string_ini_t > | ( | const std::string & | value, |
const std::string & | |||
) |
Specialization for string type, which doesn't need to be explicitely parsed.
Definition at line 86 of file string_utils.cpp.
unsigned_ini_t inicpp::string_utils::parse_string< unsigned_ini_t > | ( | const std::string & | value, |
const std::string & | option_name | ||
) |
Parse string to unsigned value.
value | Value to be parsed |
option_name | Option name from this value - will be in exception text if thrown |
invalid_type_exception | if string cannot be parsed |
Definition at line 135 of file string_utils.cpp.
std::string inicpp::string_utils::right_trim | ( | const std::string & | str | ) |
Trim whitespaces from end of given string.
str | processed string |
Definition at line 16 of file string_utils.cpp.
std::vector< std::string > inicpp::string_utils::split | ( | const std::string & | str, |
char | delim | ||
) |
Split given string with given delimiter.
str | text which will be splitted |
delim | delimiter |
Definition at line 73 of file string_utils.cpp.
bool inicpp::string_utils::starts_with | ( | const std::string & | str, |
const std::string & | search_str | ||
) |
Tries to find out if given str starts with search_str.
str | searched string |
search_str | string which is searched for |
Definition at line 38 of file string_utils.cpp.
std::string inicpp::string_utils::trim | ( | const std::string & | str | ) |
Trim whitespaces from start and end of given string.
str | processed string |
Definition at line 22 of file string_utils.cpp.