openMSX
|
#include <TemporaryString.hh>
Public Member Functions | |
TemporaryString () | |
TemporaryString (const char *s) | |
TemporaryString (zstring_view s) | |
TemporaryString (size_t n_, std::invocable< char * > auto fillOp) | |
TemporaryString (const TemporaryString &)=delete | |
TemporaryString (TemporaryString &&)=delete | |
TemporaryString & | operator= (const TemporaryString &)=delete |
TemporaryString & | operator= (TemporaryString &&)=delete |
~TemporaryString ()=default | |
auto | size () const |
auto | empty () const |
const char * | data () const |
const char * | c_str () const |
std::string_view | view () const |
operator std::string_view () const | |
operator zstring_view () const | |
bool | starts_with (std::string_view s) const |
bool | starts_with (char c) const |
bool | starts_with (const char *s) const |
bool | ends_with (std::string_view s) const |
bool | ends_with (char c) const |
bool | ends_with (const char *s) const |
Static Public Attributes | |
static constexpr size_t | BUFSIZE = 127 |
Friends | |
bool | operator== (const TemporaryString &x, const TemporaryString &y) |
bool | operator== (const TemporaryString &x, const zstring_view &y) |
bool | operator== (const TemporaryString &x, const std::string &y) |
bool | operator== (const TemporaryString &x, const std::string_view &y) |
bool | operator== (const TemporaryString &x, const char *y) |
std::ostream & | operator<< (std::ostream &os, const TemporaryString &str) |
This a type meant to store temporary strings. Typically it stores the string in the object itself. Except when the string is too large, then it falls back to heap-allocation. So it's more or less like a std::string but with a relatively large (127 character) "small-string-buffer". (Typical std::string implementations only have a buffer for 15 or 23 characters).
Because of this internal buffer, TemporaryString objects are quite large. The intention is that they are only used as local variable (so stored on the stack). Not as member variables.
The API of this type is still very minimal. It can be extended when needed.
Definition at line 27 of file TemporaryString.hh.
|
inlineexplicit |
Definition at line 31 of file TemporaryString.hh.
|
inlineexplicit |
Definition at line 38 of file TemporaryString.hh.
|
inlineexplicit |
Definition at line 40 of file TemporaryString.hh.
|
inlineexplicit |
Definition at line 43 of file TemporaryString.hh.
References allocate_string_storage(), and BUFSIZE.
|
delete |
|
delete |
|
default |
|
inline |
Definition at line 68 of file TemporaryString.hh.
Referenced by openmsx::ImGuiSymbols::paint().
|
inline |
Definition at line 67 of file TemporaryString.hh.
|
inline |
Definition at line 65 of file TemporaryString.hh.
|
inline |
Definition at line 78 of file TemporaryString.hh.
References view().
|
inline |
Definition at line 79 of file TemporaryString.hh.
References view().
|
inline |
Definition at line 77 of file TemporaryString.hh.
References view().
|
inline |
Definition at line 71 of file TemporaryString.hh.
|
inline |
Definition at line 72 of file TemporaryString.hh.
|
delete |
|
delete |
|
inline |
Definition at line 64 of file TemporaryString.hh.
|
inline |
Definition at line 75 of file TemporaryString.hh.
References view().
|
inline |
Definition at line 76 of file TemporaryString.hh.
References view().
|
inline |
Definition at line 74 of file TemporaryString.hh.
References view().
|
inline |
Definition at line 70 of file TemporaryString.hh.
Referenced by ends_with(), ends_with(), ends_with(), starts_with(), starts_with(), and starts_with().
|
friend |
Definition at line 97 of file TemporaryString.hh.
|
friend |
Definition at line 93 of file TemporaryString.hh.
|
friend |
Definition at line 87 of file TemporaryString.hh.
|
friend |
Definition at line 90 of file TemporaryString.hh.
|
friend |
Definition at line 81 of file TemporaryString.hh.
|
friend |
Definition at line 84 of file TemporaryString.hh.
|
staticconstexpr |
Definition at line 29 of file TemporaryString.hh.
Referenced by TemporaryString().