A bounds-safe string class which provides an identical interface to std::string plus many convenience functions for string manipulation.
More...
|
| RStr () |
| Default constructor, initializes to blank string.
|
|
| RStr (const RStr &other) |
| Copy constructor.
|
|
| RStr (const std::string &str) |
| Initializes to str.
|
|
| RStr (const RStr &s, size_t pos, size_t n=npos) |
| Creates a new RStr from a segment of s starting at index pos with length n or until the end. More...
|
|
| RStr (const char *s, size_t n) |
| Creates a new RStr from n characters at s, or until null-termination. More...
|
|
| RStr (const char *s) |
| Creates a new RStr from s until null-termination, or empty string if s is NULL.
|
|
| RStr (size_t n, char c) |
| Initializes to n copies of character c.
|
|
template<class InputIterator > |
| RStr (InputIterator begin, InputIterator end) |
| Initializes the string from the values in the iterator range.
|
|
| RStr (const std::initializer_list< char > characters) |
| Initializes the string with the list of characters.
|
|
| RStr (RStr &&other) noexcept |
| Moves other to this RStr.
|
|
RStr & | operator= (const RStr &s) |
| Copies the contents of s to this RStr.
|
|
RStr & | operator= (const char *s) |
| Copies the null-terminated characters at s to this RStr, or empties if s is NULL.
|
|
RStr & | operator= (char c) |
| Sets the RStr to char c.
|
|
RStr & | operator= (std::initializer_list< char > characters) |
| Sets the contents of the RStr to the initializer list.
|
|
RStr & | operator= (RStr &&other) |
| Moves the contests of other to this RStr.
|
|
RStrIter | begin () |
| Returns a bounds-safe iterator to the first element. More...
|
|
RStrIter | end () |
| Returns a bounds-safe iterator which points past the last element. More...
|
|
size_t | size () const |
| Returns the length of the string.
|
|
size_t | length () const |
| Returns the length of the string.
|
|
size_t | max_size () const |
| Returns the maximum size of the string.
|
|
void | resize (size_t n, char c) |
| Resizes the string, filling with character c if enlarging.
|
|
void | resize (size_t n) |
| Resizes the string, filling with null characters if enlarging.
|
|
size_t | capacity () const |
| Returns the allocated storage space.
|
|
void | reserve (size_t capsize=0) |
| Request a storage capacity increase to capsize.
|
|
void | clear () |
| Make the string empty.
|
|
bool | empty () const |
| True of the string is empty.
|
|
char & | operator[] (size_t pos) |
| Returns the char at index pos, or throws ErrorMsgBounds if out of bounds.
|
|
const char & | operator[] (size_t pos) const |
| Const version of operator[].
|
|
char & | at (size_t pos) |
| Identical to operator[].
|
|
const char & | at (size_t pos) const |
| Const version of at.
|
|
RStr & | operator+= (const RStr &s) |
| Appends s to this RStr.
|
|
RStr & | operator+= (const char *s) |
| Appends s to this RStr if s is non-NULL.
|
|
RStr & | operator+= (char c) |
| Appends the char c to this RStr.
|
|
RStr & | append (const RStr &s) |
| Appends s to this RStr.
|
|
RStr & | append (const RStr &s, size_t pos, size_t n) |
| Appends n characters in s starting at pos to this RStr, or fewer characters if s is too short.
|
|
RStr & | append (const char *s, size_t n) |
| Appends n characters starting at s to this RStr, or fewer if null-termination is reached in s. More...
|
|
RStr & | append (const char *s) |
| Append s to this RStr if s is non-NULL.
|
|
RStr & | append (size_t n, char c) |
| Appends n copies of char c.
|
|
template<class InputIterator > |
RStr & | append (InputIterator first, InputIterator last) |
| Appends from first to one before last, or until a null character.
|
|
RStr & | append (std::initializer_list< char > characters) |
| Append the initializer list of characters.
|
|
void | push_back (char c) |
| Appends character c.
|
|
RStr & | assign (const RStr &s) |
| Copies s to this RStr.
|
|
RStr & | assign (const RStr &s, size_t pos, size_t n) |
| Sets this RStr to n characters in s at index pos, or until the end.
|
|
RStr & | assign (const char *s, size_t n) |
| Sets this RStr to n characters starting at s or until null-termination. More...
|
|
RStr & | assign (const char *s) |
| Sets this RStr to the characters at s until null-termination. More...
|
|
RStr & | assign (size_t n, char c) |
| Sets this RStr to n copies of character c.
|
|
template<class InputIterator > |
RStr & | assign (InputIterator first, InputIterator last) |
| Sets the RStr to characters from first to one before last, or until a null character.
|
|
RStr & | insert (size_t pos_this, const RStr &s) |
| Inserts s starting at index pos_this of this RStr, or throws ErrorMsgBounds.
|
|
RStr & | insert (size_t pos_this, const RStr &s, size_t pos_s, size_t n) |
| Inserts at index pos_this, n characters from s starting at pos_s. More...
|
|
RStr & | insert (size_t pos_this, const char *s, size_t n) |
| Inserts at index pos_this, n characters from s or until NULL-termination. More...
|
|
RStr & | insert (size_t pos_this, const char *s) |
| Inserts s at index pos_this until null-termination, or nothing if s is NULL.
|
|
RStr & | insert (size_t pos_this, size_t n, char c) |
| Inserts n copies of char c at pos_this.
|
|
RStrIter | insert (RStrIter p, char c) |
| Inserts char c at iterator position p.
|
|
void | insert (RStrIter p, size_t n, char c) |
| Inserts n copies of char c at iterator position p.
|
|
template<class InputIterator > |
void | insert (RStrIter p, InputIterator first, InputIterator last) |
| At iterator position p, inserts characters from first through one before last or until null-termination.
|
|
RStr & | insert (const RStrIter p, std::initializer_list< char > characters) |
| At iterator position p, inserts list of characters.
|
|
RStr & | erase (size_t pos=0, size_t n=npos) |
| Erases n characters at index pos, or until the end.
|
|
RStrIter | erase (const RStrIter pos) |
| Erases one character at index pos.
|
|
RStrIter | erase (const RStrIter first, const RStrIter last) |
| Erases from index first through one before index last.
|
|
RStr & | replace (size_t pos_this, size_t n_this, const RStr &s) |
| Replace n_this characters at pos_this with all of s.
|
|
RStr & | replace (RStrIter first, RStrIter last, const RStr &s) |
| Replace from first to one before last with all of s.
|
|
RStr & | replace (size_t pos_this, size_t n_this, const RStr &s, size_t pos_s, size_t n_s) |
| Replace n_this characters at pos_this with n_s characters from s starting at pos_s.
|
|
RStr & | replace (size_t pos_this, size_t n_this, const char *s, size_t n_s) |
| Replace n_this characters at pos_this with n_s characters from s, or until s's null-termination.
|
|
RStr & | replace (RStrIter first, RStrIter last, const char *s, size_t n_s) |
| Replace from first through one before last with n_s characters from s, or until s's null-termination.
|
|
RStr & | replace (size_t pos_this, size_t n_this, const char *s) |
| Replace n_this characters at pos_this with all of s, or nothing if s is NULL.
|
|
RStr & | replace (RStrIter first, RStrIter last, const char *s) |
| Replace from first to one before last with all of s, or nothing if s is NULL.
|
|
RStr & | replace (size_t pos_this, size_t n_this, size_t n_c, char c) |
| Replace n_this characters at pos_this with n_c copies of c.
|
|
RStr & | replace (RStrIter first, RStrIter last, size_t n_c, char c) |
| Replace from first through one before last with n_c copies of c.
|
|
template<class InputIterator > |
RStr & | replace (RStrIter first, RStrIter last, InputIterator in_first, InputIterator in_last) |
| Replace from first through one before lsat with in1 through one before in2, or until null-termination.
|
|
void | swap (RStr &s) |
| Swap contents with s.
|
|
const char * | c_str () const |
| Provides a null-terminated C style string corresponding to RStr.
|
|
const char * | data () const |
| Identical to c_str.
|
|
std::allocator< char > | get_allocator () const |
| Get the allocator used for string storage.
|
|
size_t | copy (char *s, size_t n, size_t pos=0) const |
| Copies n characters to s, starting from pos_this. More...
|
|
size_t | find (const RStr &s, size_t pos=0) const |
| Returns the index at pos or later which matches string s, or npos if no match.
|
|
size_t | find (const char *s, size_t pos, size_t n) const |
| Returns the index at pos or later which matches n characters of s, or npos if no match.
|
|
size_t | find (const char *s, size_t pos=0) const |
| Returns the index at pos or later which matches s until null-termination, or npos if no match.
|
|
size_t | find (char c, size_t pos=0) const |
| Returns the index at pos or later which matches character c.
|
|
size_t | rfind (const RStr &s, size_t pos=npos) const |
| Returns the index at pos or before which starts a match of string s, or npos if no match.
|
|
size_t | rfind (const char *s, size_t pos, size_t n) const |
| Returns the index at pos or before which matches n characters of s, or npos if no match.
|
|
size_t | rfind (const char *s, size_t pos=npos) const |
| Returns the index at pos or before which matches s until null-termination, or npos if no match.
|
|
size_t | rfind (char c, size_t pos=npos) const |
| Returns the index at pos or before which matches character c.
|
|
size_t | find_first_of (const RStr &s, size_t pos=0) const |
| Returns the first index at pos or later which matches a character in s, or npos if none match.
|
|
size_t | find_first_of (const char *s, size_t pos, size_t n) const |
| Returns the first index at pos or later which matches one of the first n characters in s, or npos if none match.
|
|
size_t | find_first_of (const char *s, size_t pos=0) const |
| Returns the first index at pos or later which matches a character in s, or npos if none match.
|
|
size_t | find_first_of (char c, size_t pos=0) const |
| Returns the index at pos or later which matches character c.
|
|
size_t | find_last_of (const RStr &s, size_t pos=npos) const |
| Returns the highest index at pos or before which matches a character in s, or npos if none match.
|
|
size_t | find_last_of (const char *s, size_t pos, size_t n) const |
| Returns the highest index at pos or before which matches the first n characters in s, or npos if none match.
|
|
size_t | find_last_of (const char *s, size_t pos=npos) const |
| Returns the highest index at pos or before which matches a character in s, or npos if none match.
|
|
size_t | find_last_of (char c, size_t pos=npos) const |
| Returns the highest index at pos or before which matches character c, or npos if none match.
|
|
size_t | find_first_not_of (const RStr &s, size_t pos=0) const |
| Returns the first index at pos or later which does not match a character in s, or npos if all match.
|
|
size_t | find_first_not_of (const char *s, size_t pos, size_t n) const |
| Returns the first index at pos or later which does not match the first n characters in s, or npos if all match.
|
|
size_t | find_first_not_of (const char *s, size_t pos=0) const |
| Returns the first index at pos or later which does not match a character in s, or npos if all match.
|
|
size_t | find_first_not_of (char c, size_t pos=0) const |
| Returns the first index at pos or later which does not match character c, or npos if all match.
|
|
size_t | find_last_not_of (const RStr &s, size_t pos=npos) const |
| Returns the highest index at pos or before which does not match a character in s, or npos if all match.
|
|
size_t | find_last_not_of (const char *s, size_t pos, size_t n) const |
| Returns the highest index at pos or before which does not match the first n characters in s, or npos if all match.
|
|
size_t | find_last_not_of (const char *s, size_t pos=npos) const |
| Returns the highest index at pos or before which does not match a character in s, or npos if all match.
|
|
size_t | find_last_not_of (char c, size_t pos=npos) const |
| Returns the highest index at pos or before which does not match character c, or npos if all match.
|
|
RStr | substr (size_t pos=0, size_t n=npos) const |
| Creates a substring from n characters starting at position pos, or until the end of the string.
|
|
int | compare (const RStr &s) const |
| Returns negative, 0, or positive if this string is lesser, equal, or greater than s.
|
|
int | compare (const char *s) const |
| Returns negative, 0, or positive if this string is lesser, equal, or greater than s.
|
|
int | compare (size_t pos_this, size_t n_this, const RStr &s) const |
| Returns negative, 0, or positive if the n_this characters at pos_this are lesser, equal, or greater than s.
|
|
int | compare (size_t pos_this, size_t n_this, const char *s) const |
| Returns negative, 0, or positive if the n_this characters at pos_this are lesser, equal, or greater than s.
|
|
int | compare (size_t pos_this, size_t n_this, const RStr &s, size_t pos_s, size_t n_s) const |
| Returns negative, 0, or positive if the n_this characters at pos_this are lesser, equal, or greater than the n_s characters at pos_s in s.
|
|
int | compare (size_t pos_this, size_t n_this, const char *s, size_t n_s) const |
| Returns negative, 0, or positive if the n_this characters at pos_this are lesser, equal, or greater than the n_s characters in s.
|
|
|
| RStr (char x) |
| The default constructor for a char, treating it as a character. More...
|
|
| RStr (char x, RStr_IntStyle style, i32 precision=-1) |
| Formats x as a string in the given style, and with at least precision 0-padded digits. More...
|
|
| RStr (u8 x, RStr_IntStyle style=DEC, i32 precision=-1) |
| Formats x as a string in the given style, and with at least precision 0-padded digits.
|
|
| RStr (i8 x, RStr_IntStyle style=DEC, i32 precision=-1) |
| Formats x as a string in the given style, and with at least precision 0-padded digits.
|
|
| RStr (u16 x, RStr_IntStyle style=DEC, i32 precision=-1) |
| Formats x as a string in the given style, and with at least precision 0-padded digits.
|
|
| RStr (i16 x, RStr_IntStyle style=DEC, i32 precision=-1) |
| Formats x as a string in the given style, and with at least precision 0-padded digits.
|
|
| RStr (u32 x, RStr_IntStyle style=DEC, i32 precision=-1) |
| Formats x as a string in the given style, and with at least precision 0-padded digits.
|
|
| RStr (i32 x, RStr_IntStyle style=DEC, i32 precision=-1) |
| Formats x as a string in the given style, and with at least precision 0-padded digits.
|
|
| RStr (u64 x, RStr_IntStyle style=DEC, i32 precision=-1) |
| Formats x as a string in the given style, and with at least precision 0-padded digits.
|
|
| RStr (i64 x, RStr_IntStyle style=DEC, i32 precision=-1) |
| Formats x as a string in the given style, and with at least precision 0-padded digits.
|
|
| RStr (f32 x, RStr_FloatStyle style=AUTO, u32 precision=std::numeric_limits< f32 >::digits10) |
| Formats x as a string in the given style, and with it rounded to precision digits. More...
|
|
| RStr (f64 x, RStr_FloatStyle style=AUTO, u32 precision=std::numeric_limits< f64 >::digits10) |
| Formats x as a string in the given style, and with it rounded to precision digits. More...
|
|
| RStr (f80 x, RStr_FloatStyle style=AUTO, u32 precision=std::numeric_limits< f80 >::digits10) |
| Formats x as a string in the given style, and with it rounded to precision digits. More...
|
|
| RStr (bool b) |
| "true" if b is true, or "false" if b is false.
|
|
| RStr (bool pad0s, void *ptr, bool use0x=true) |
| Constructor for displaying a pointer, with 0's prepended if pad0s is true, and 0x prepended if use0x is true.
|
|
template<class T > |
| RStr (const Data1D< T > &arr) |
| Initialize the string with the bytes stored in Data1D treated as raw character data.
|
|
| RStr (const std::wstring &wstr) |
| Convert a std::wstring to RStr, discarding the high bits.
|
|
| RStr (const QString &qstr) |
| Convert a QString to RStr, discarding the high bits.
|
|
f32 | Get_f32 () const |
| Convert the beginning characters of this string to a float. More...
|
|
f64 | Get_f64 () const |
| Convert the beginning characters of this string to a float.
|
|
f80 | Get_f80 () const |
| Convert the beginning characters of this string to a float.
|
|
u32 | Get_u32 (int base=0) const |
| Convert the beginning characters of this string to this integer type. More...
|
|
u64 | Get_u64 (int base=0) const |
| Convert the beginning characters of this string to this integer type.
|
|
i32 | Get_i32 (int base=0) const |
| Convert the beginning characters of this string to this integer type.
|
|
i64 | Get_i64 (int base=0) const |
| Convert the beginning characters of this string to this integer type.
|
|
u32 | Get_hex32 () const |
| Convert the beginning characters of this string as a hexadecimal to this integer type.
|
|
u64 | Get_hex64 () const |
| Convert the beginning characters of this string as a hexadecimal to this integer type.
|
|
bool | Get_bool () const |
| Returns true if case-insensitive "true", "T", or non-zero.
|
|
void | Get (f32 &x) const |
| Overloaded function to extract type f32 from this class. More...
|
|
void | Get (f64 &x) const |
| Overloaded function to extract type f64 from this class. More...
|
|
void | Get (f80 &x) const |
| Overloaded function to extract type f80 from this class. More...
|
|
void | Get (u32 &x) const |
| Overloaded function to extract type u32 from this class. More...
|
|
void | Get (u64 &x) const |
| Overloaded function to extract type u64 from this class. More...
|
|
void | Get (i32 &x) const |
| Overloaded function to extract type i32 from this class. More...
|
|
void | Get (i64 &x) const |
| Overloaded function to extract type i64 from this class. More...
|
|
void | Get (bool &x) const |
| Overloaded function to extract type bool from this class. More...
|
|
bool | Is_f32 (bool strict=false) const |
| True if the start of the string can be converted to an f32. More...
|
|
bool | Is_f64 (bool strict=false) const |
| True if the start of the string can be converted to an f64. More...
|
|
bool | Is_f80 (bool strict=false) const |
| True if the start of the string can be converted to an f80. More...
|
|
bool | Is_u32 (int base=0, bool strict=false) const |
| True if the start of the string can be converted to an u32. More...
|
|
bool | Is_u64 (int base=0, bool strict=false) const |
| True if the start of the can be converted to an u64. More...
|
|
bool | Is_i32 (int base=0, bool strict=false) const |
| True if the start of the string can be converted to an i32. More...
|
|
bool | Is_i64 (int base=0, bool strict=false) const |
| True if the start of the string can be converted to an i64. More...
|
|
bool | Is_hex32 (bool strict=false) const |
| True if the start of the string can be converted as hexadecimal to a u32. More...
|
|
bool | Is_hex64 (bool strict=false) const |
| True if the start of the string can be converted as hexadecimal to a u64. More...
|
|
bool | Is_bool () const |
| True if the string is a "0", "1", or case insensitive "true", "false", "T", or "F".
|
|
QString | ToQString () const |
| Convert the RStr to a QString.
|
|
std::wstring | wstring () |
| Convert the RStr to a std::wstring.
|
|
const char * | ToLPCSTR () const |
| For Win32, provides an LPCSTR to the string.
|
|
HoldRelated< std::wstring, const wchar_t * > | ToLPCWSTR () |
| For Win32, provides an LPCWSTR to the string. More...
|
|
const char * | ToLPCTSTR () |
| For Win32, provides an LPCTSTR to the string. More...
|
|
std::string & | Raw () |
| Provides raw access to the std::string this RStr wraps.
|
|
const std::string & | Raw () const |
| Provides const raw access to the std::string this RStr wraps.
|
|
Data1D< char > | ToData () const |
| Returns a Data1D<char> corresponding to the character data in the string.
|
|