|
Hermes
|
String class and set of string functions. More...
#include <str.h>
Classes | |
| struct | regex |
Public Member Functions | |
| template<typename T > | |
| bool friend | operator== (const T &t, const Str &s) |
| Character-wise comparison. | |
| Str () | |
| Default constructor. | |
| Str (std::string s) | |
Constructor from std::string | |
| Str (const char *s) | |
Constructor from const char*'s contents copy. | |
| Str (const Str &other) | |
| Copy constructor. | |
| Str (Str &&other) noexcept | |
| Move constructor. | |
| const std::string & | str () const |
Get std::string object. | |
| const char * | c_str () const |
Get const char* pointer. | |
| size_t | size () const |
| Get the number of characters on the string. | |
| bool | empty () const |
| Checks if string is empty. | |
| Result< ConstStrView > | substr (size_t pos=0, i64 len=-1) |
| Get a sub-string view from this object. | |
| template<class... Args> | |
| void | append (const Args &... args) |
| Append arguments to this Str. | |
| template<class... Args> | |
| void | appendLine (const Args &... args) |
| Append arguments to this Str followed by a breakline. | |
| Str & | operator= (const Str &s)=default |
| template<typename T > | |
| Str & | operator= (const T &t) |
| String of value assignment. | |
| Str & | operator+= (const Str &other) |
Simple concatenation with other | |
| template<typename T > | |
| Str & | operator+= (const T &t) |
| Simple concatenation with string of value. | |
| template<typename T > | |
| Str | operator+ (const T &t) const |
Generates a copy appended by t | |
| Str | operator<< (const char *s) const |
Generates a copy appended by s | |
| bool | operator== (const char *ss) const |
| Performs const char* comparison. | |
| template<typename T > | |
| bool | operator== (const T &t) const |
Performs character comparison with string value of t | |
Static Public Member Functions | |
| static bool | isPrefix (const std::string &p, const std::string &s) |
| Checks if s has prefix p. | |
| static std::string | abbreviate (const std::string &s, size_t width, const char fmt[4]="s.s") |
| Abbreviates a string to fit in a string of width characters. | |
| template<typename T > | |
| static std::string | rjust (const T &value, size_t width, char fill_char=' ') |
| Right justifies string value. | |
| template<typename T > | |
| static std::string | ljust (const T &value, size_t width, char fill_char=' ') |
| Left justifies string value. | |
| template<typename T > | |
| static std::string | cjust (const T &value, size_t width, char fill_char=' ') |
| Center justifies string value. | |
| template<typename... Ts> | |
| static std::string | format (const std::string &fmt, Ts &&... args) |
| template<typename T > | |
| static std::string | toHex (T i, bool leading_zeros=false, bool zero_x=false) |
| Generates hexadecimal representation from number. | |
| static std::string | strip (const std::string &s, const std::string &patterns=" \t\n") |
| template<class... Args> | |
| static std::string | concat (const Args &... args) |
| Concatenates multiple elements_ into a single string. | |
| static std::string | join (const std::vector< std::string > &v, const std::string &separator="") |
| Concatenate strings together separated by a separator. | |
| template<typename T > | |
| static std::string | join (const std::vector< T > &v, const std::string &separator="") |
| Concatenate elements together separates by a separator. | |
| static std::vector< std::string > | split (const std::string &s, const std::string &delimiters=" ") |
| Splits a string into tokens separated by delimiters. | |
| static std::string | printBits (u32 n) |
| Print bits in big-endian order. | |
| template<typename T > | |
| static std::string | binaryToHex (T input_n, bool uppercase=true, bool strip_leading_zeros=false) |
Get ascii representation of raw bit data of input_n | |
| static std::string | addressOf (uintptr_t ptr, u32 digit_count=8) |
| Generates hexadecimal representation of memory address. | |
| static std::string | byteToBinary (byte b) |
| Binary representation of byte. | |
| static bool | isInteger (const std::string &s) |
| Checks if string represents an integer. | |
| static bool | isNumber (const std::string &s) |
| Checks if string represents a number. | |
Friends | |
| Str | operator<< (const char *s, const Str &str) |
| Concatenate. | |
| Str | operator+ (const std::string &s, const Str &str) |
| Concatenate. | |
| bool | operator== (const char *ss, const Str &s) |
const char* pointer comparison | |
String class and set of string functions.
| hermes::Str::Str | ( | std::string | s | ) |
Constructor from std::string
| s |
|
noexcept |
Move constructor.
| other |
|
static |
Abbreviates a string to fit in a string of width characters.
| s | input string |
| width | final character count |
| fmt | a three-character string describing the abbreviation type: ("..s", "s.s", ".s.", or "..s"). where 's' represents the input string contents and '.' the abbreviated portion of s. |
Generates hexadecimal representation of memory address.
| ptr | |
| digit_count |
Append arguments to this Str.
std::ostringstream | Args |
| args |
Append arguments to this Str followed by a breakline.
std::ostringstream | Args |
| args |
|
inlinestatic |
Get ascii representation of raw bit data of input_n
| T |
| input_n | |
| uppercase | |
| strip_leading_zeros |
Binary representation of byte.
| b |
|
inlinestatic |
Center justifies string value.
| T | string-convertible type |
| value | |
| width | output size |
| fill_char |
Concatenates multiple elements_ into a single string.
| Args |
| args |
|
inline |
Checks if string is empty.
|
inlinestatic |
| Ts |
| fmt | |
| args |
Checks if string represents an integer.
| s |
Checks if string represents a number.
| s |
Checks if s has prefix p.
| p | prefix string |
| s | string |
|
static |
Concatenate strings together separated by a separator.
| v | array of strings |
| separator | [in | ""] |
|
inlinestatic |
Concatenate elements together separates by a separator.
std::stringstream | T | element type |
| v | |
| separator |
|
inlinestatic |
Left justifies string value.
| T | string-convertible type |
| value | |
| width | output size |
| fill_char |
Generates a copy appended by t
std::stringstream | T |
| t |
Simple concatenation with other
| other |
Simple concatenation with string of value.
std::stringstream | T |
| t |
Generates a copy appended by s
| s |
String of value assignment.
std::stringstream | T |
| t |
Performs const char* comparison.
| ss |
Performs character comparison with string value of t
std::stringstream Character-wise comparison.
| T |
| t | |
| s |
Print bits in big-endian order.
| n |
|
inlinestatic |
Right justifies string value.
| T | string-convertible type |
| value | |
| width | output size |
| fill_char |
|
inline |
Get the number of characters on the string.
|
static |
Splits a string into tokens separated by delimiters.
| s | [in] input string |
| delimiters | [in | default = " "] delimiters |
|
inline |
Get std::string object.
|
static |
| s | |
| patterns |
| Result< ConstStrView > hermes::Str::substr | ( | size_t | pos = 0, |
| i64 | len = -1 |
||
| ) |
Get a sub-string view from this object.
| pos | position of the first character of the sub-string in str. |
| len | number of characters of the sub-string. If len = -1, then the size is str.size() - pos. |
|
inlinestatic |
Generates hexadecimal representation from number.
i | T |
| i | number |
| leading_zeros | puts leading zeros up to the size of T |
| zero_x | puts the "0x" suffix |
Concatenate.
| s | |
| str |
const char* pointer comparison
| ss | |
| s |