|
StormByte C++ Library 1.2.0
StormByte is a comprehensive, cross-platform C++ library aimed at easing system programming, configuration management, logging, and database handling tasks. This library provides a unified API that abstracts away the complexities and inconsistencies of different platforms (Windows, Linux).
|
String helpers (case, split, UTF-8, human-readable numbers). More...
Enumerations | |
| enum class | Format : unsigned short { Raw , HumanReadableNumber , HumanReadableBytes } |
How HumanReadable prints a number. More... | |
Functions | |
| constexpr std::string | Indent (const int &level) noexcept |
level tab characters, or empty when level == 0. | |
| constexpr bool | IsNumeric (std::string_view str) noexcept |
true when every character is a decimal digit (std::isdigit). | |
| std::string | ToLower (std::string_view str) noexcept |
Lowercase copy of str. | |
| std::string | ToUpper (std::string_view str) noexcept |
Uppercase copy of str. | |
| std::queue< std::string > | Explode (std::string_view str, const char delimiter) |
Splits on delimiter into a queue (empty tokens kept). | |
| std::vector< std::string > | Split (std::string_view str) |
| Splits on ASCII whitespace into a vector. | |
| template<typename T , typename = std::enable_if_t<std::is_arithmetic_v<T> && !std::is_same_v<T, wchar_t>>> | |
| std::string | HumanReadable (const T &number, const Format &format, const std::string &locale="en_US.UTF-8") noexcept |
Formats an arithmetic value (not wchar_t). | |
| std::string | UTF8Encode (std::wstring_view ws) |
| Wide text to UTF-8. | |
| std::wstring | UTF8Decode (std::string_view s) |
| UTF-8 text to wide string. | |
| std::string | SanitizeNewlines (std::string_view str) noexcept |
Normalizes \r\n to \n. | |
| std::string | FromByteVector (const std::vector< std::byte > &byte_vector) noexcept |
Interprets bytes as char and builds a string. | |
| std::vector< std::byte > | ToByteVector (std::string_view str) noexcept |
Copies text bytes into a vector<std::byte>. | |
| std::string | RemoveWhitespace (std::string_view str) noexcept |
| Strips every whitespace character. | |
| bool | IsInteger (std::string_view str) noexcept |
true when str parses as an integer (optional leading +/-). | |
String helpers (case, split, UTF-8, human-readable numbers).
Read-only inputs are std::string_view / std::wstring_view. std::string, std::wstring and string literals convert to those views.
|
strong |
| std::queue< std::string > StormByte::String::Explode | ( | std::string_view | str, |
| const char | delimiter | ||
| ) |
Splits on delimiter into a queue (empty tokens kept).
| str | Input text. |
| delimiter | Separator. |
|
noexcept |
Interprets bytes as char and builds a string.
| byte_vector | Input bytes. |
|
noexcept |
Formats an arithmetic value (not wchar_t).
| T | Arithmetic type. |
| number | Value. |
| format | Raw, HumanReadableNumber or HumanReadableBytes. |
| locale | Locale name, default "en_US.UTF-8". |
|
constexprnoexcept |
level tab characters, or empty when level == 0.
| level | Indentation depth. |
|
noexcept |
true when str parses as an integer (optional leading +/-).
| str | Input text. |
|
constexprnoexcept |
true when every character is a decimal digit (std::isdigit).
| str | Text to test. |
|
noexcept |
Strips every whitespace character.
| str | Input text. |
|
noexcept |
Normalizes \r\n to \n.
Lone \r is kept.
| str | Input text. |
| std::vector< std::string > StormByte::String::Split | ( | std::string_view | str | ) |
Splits on ASCII whitespace into a vector.
| str | Input text. |
|
noexcept |
Copies text bytes into a vector<std::byte>.
| str | Input text. |
|
noexcept |
Lowercase copy of str.
| str | Input text. |
|
noexcept |
Uppercase copy of str.
| str | Input text. |
| std::wstring StormByte::String::UTF8Decode | ( | std::string_view | s | ) |
UTF-8 text to wide string.
| s | UTF-8 input. |
| StormByte::UTF8Error | On invalid Unicode input. |
| std::string StormByte::String::UTF8Encode | ( | std::wstring_view | ws | ) |
Wide text to UTF-8.
| ws | Wide input. |
| StormByte::UTF8Error | On invalid Unicode input. |