Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)
« « « Anklang Documentation |
Compact, deduplicating string variant for constant strings. More...
#include "memory.hh"
Public Types | |
using | size_type = std::string::size_type |
using | const_iterator = std::string::const_iterator |
using | const_reference = std::string::const_reference |
using | const_reverse_iterator = std::string::const_reverse_iterator |
Public Member Functions | |
CString (const char *c) | |
CString (const char *c, size_type s) | |
CString (const std::string &s) | |
constexpr | CString (const CString &c) noexcept |
constexpr | CString (CString &&c) noexcept |
constexpr CString & | operator= (const CString &c) noexcept |
constexpr CString & | operator= (CString &&c) noexcept |
CString & | operator= (const std::string &s) noexcept |
CString & | operator= (const char *c) noexcept |
CString & | operator= (char ch) noexcept |
CString & | operator= (std::initializer_list< char > l) |
constexpr CString & | assign (const CString &c) noexcept |
CString & | assign (const std::string &s) noexcept |
CString & | assign (const char *c, size_type s) |
CString & | assign (const char *c) noexcept |
CString & | assign (size_type count, char ch) noexcept |
const std::string & | string () const |
Convert CString into a std::string. | |
const char * | c_str () const noexcept |
const char * | data () const noexcept |
const_reference | at (size_type pos) const |
const_reference | operator[] (size_type pos) const |
size_type | capacity () const noexcept |
size_type | length () const noexcept |
bool | empty () const noexcept |
size_type | size () const noexcept |
const_iterator | begin () const noexcept |
const_iterator | cbegin () const noexcept |
const_iterator | end () const noexcept |
const_iterator | cend () const noexcept |
const_reverse_iterator | rbegin () const noexcept |
const_reverse_iterator | crbegin () const noexcept |
const_reverse_iterator | rend () const noexcept |
const_reverse_iterator | crend () const noexcept |
operator std::string () const noexcept | |
Static Public Member Functions | |
static CString | lookup (const std::string &s) |
static uint | temp_quark_impl (CString c) |
static CString | temp_quark_impl (uint maybequark) |
Static Public Attributes | |
static constexpr const std::string::size_type | npos |
Friends | |
bool | operator== (CString a, CString b) |
bool | operator== (CString a, const std::string &b) |
bool | operator== (const std::string &a, CString b) |
bool | operator== (CString a, const char *b) |
bool | operator== (const char *a, CString b) |
std::strong_ordering | operator<=> (CString a, CString b) |
std::strong_ordering | operator<=> (CString a, const String &b) |
std::strong_ordering | operator<=> (const String &a, CString b) |
std::strong_ordering | operator<=> (CString a, const char *b) |
std::strong_ordering | operator<=> (const char *a, CString b) |
std::string | operator+ (const std::string &s, CString c) |
std::string | operator+ (CString c, const std::string &s) |
std::ostream & | operator<< (std::ostream &os, CString c) |
Compact, deduplicating string variant for constant strings.
using Ase::CString::const_iterator = std::string::const_iterator |
using Ase::CString::const_reference = std::string::const_reference |
using Ase::CString::const_reverse_iterator = std::string::const_reverse_iterator |
Ase::CString::CString | ( | const std::string & | s | ) |
|
constexprnoexcept |
|
constexprnoexcept |
|
noexcept |
Assign a std::string to a CString, after deduplication, its memory is never released. In contrast to lookup(), the resulting CString is guaranteed to resolve to the contents of std::string s
, memory is allocated if needed. Note that CString::assign() is not particularly fast, use it only to save memory for strings that are known to persist throughout runtime.
|
noexcept |
|
noexcept |
|
static |
Lookup a previously existing CString for a std::string s
. If s
has never been assigned to a CString before, the returned CString is empty. In constrast to assign(), no new memory is allocated.
Definition at line 631 of file memory.cc.
Referenced by Ase::AudioProcessor::find_ibus(), Ase::AudioProcessor::find_obus(), and Ase::AudioProcessor::find_param().
|
noexcept |
|
noexcept |
CString & Ase::CString::operator= | ( | std::initializer_list< char > | l | ) |
const_reference Ase::CString::operator[] | ( | size_type | pos | ) | const |
|
noexcept |
|
noexcept |
const std::string & Ase::CString::string | ( | ) | const |
Convert CString
into a std::string.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
staticconstexpr |