|
OpenABF 2.1.0
|
Mesh IO utility functions. More...
Functions | |
| static auto | icase_compare (const std::string_view a, const std::string_view b) -> bool |
| Compare two string_views, ignoring case. | |
| static auto | trim_left (std::string_view s) -> std::string_view |
| Left trim. | |
| static auto | trim_right (std::string_view s) -> std::string_view |
| Right trim. | |
| static auto | trim (std::string_view s) -> std::string_view |
| Trim from both ends. | |
| template<typename... Ds> | |
| static auto | split (std::string_view s, const Ds &... ds) -> std::vector< std::string_view > |
| Split a string by a delimiter. | |
| template<typename T > | |
| auto | to_string_view (const T &a, char *buf, const std::size_t &bufSize) |
| Convenience wrapper around std::to_chars for converting numerics to std::string_view. | |
| template<typename T , typename... Args> | |
| auto | to_numeric (const std::string_view str, Args... args) -> T |
| Convert a string to a numeric type. | |
| template<> | |
| auto | to_numeric< float > (const std::string_view str) -> float |
| Convert a string to a numeric type. | |
| template<> | |
| auto | to_numeric< double > (const std::string_view str) -> double |
| Convert a string to a numeric type. | |
| template<> | |
| auto | to_numeric< long double > (const std::string_view str) -> long double |
| Convert a string to a numeric type. | |
Mesh IO utility functions.
|
staticprivate |
Split a string by a delimiter.
When provided conflicting delimiters, the largest delimiter will take precedence:
|
private |
Convert a string to a numeric type.
A drop-in replacement for the std:sto family of functions which uses std::from_chars for conversion. Like std::sto, throws exceptions when conversion fails or if the converted value is out of range of the result type.
| std::invalid_argument | If string cannot be converted to the result type. |
| std::result_out_of_range | If converted value is out of range for the result type. |
| T | Requested numeric type |
| Args | Parameter pack type |
| str | Value to convert |
| args | Extra parameters passed directly to std::to_chars |
|
inlineprivate |
Convert a string to a numeric type.
Template specialization as fallback when the compiler does not support std::from_chars for floating point types. Converts the input to a std::string and passes to the appropriate std::sto function.
|
inlineprivate |
Convert a string to a numeric type.
Template specialization as fallback when the compiler does not support std::from_chars for floating point types. Converts the input to a std::string and passes to the appropriate std::sto function.
|
inlineprivate |
Convert a string to a numeric type.
Template specialization as fallback when the compiler does not support std::from_chars for floating point types. Converts the input to a std::string and passes to the appropriate std::sto function.
|
private |
Convenience wrapper around std::to_chars for converting numerics to std::string_view.
Useful during file writing operations when you're reusing a buffer, but don't want to duplicate the error checking code of using std::to_chars.