#include <gimbal_quark.hpp>
OO C++ wrapper object around GblQuark.
gbl::Quark is the high-level C++ wrapper around GblQuark, which represents an interned string.
- See also
- GblQuark
Definition at line 33 of file gimbal_quark.hpp.
◆ Quark() [1/4]
◆ Quark() [2/4]
gbl::Quark::Quark |
( |
const char * |
pString, |
|
|
std::size_t |
length = 0 |
|
) |
| |
|
inline |
Definition at line 44 of file gimbal_quark.hpp.
44 :
GblQuark GblQuark_tryString(const char *pStr, size_t len)
Returns the GblQuark associated with the given string, returning GBL_QUARK_INVALID if it was not prev...
◆ Quark() [3/4]
gbl::Quark::Quark |
( |
const std::string & |
stdStr | ) |
|
|
inline |
◆ Quark() [4/4]
gbl::Quark::Quark |
( |
std::string_view |
strv | ) |
|
|
inline |
Definition at line 50 of file gimbal_quark.hpp.
50 :
51 Quark(strv.data(), strv.length()) {}
◆ isValid()
bool gbl::Quark::isValid |
( |
void |
| ) |
const |
|
inline |
Definition at line 53 of file gimbal_quark.hpp.
53 {
55 }
#define GBL_QUARK_INVALID
Value of an invalid or NULL GblQuark.
◆ toString()
const char * gbl::Quark::toString |
( |
void |
| ) |
const |
|
inline |
Definition at line 57 of file gimbal_quark.hpp.
57 {
59 }
const char * GblQuark_toString(GblQuark quark)
Returns the NULL-terminated interned C string associated with a given GblQuark.
◆ length()
std::size_t gbl::Quark::length |
( |
void |
| ) |
const |
|
inline |
◆ operator GblQuark()
gbl::Quark::operator GblQuark |
( |
void |
| ) |
const |
|
inline |
◆ operator[]()
char gbl::Quark::operator[] |
( |
std::size_t |
index | ) |
const |
|
inline |
Definition at line 71 of file gimbal_quark.hpp.
71 {
72 if(index >= length())
73 throw std::out_of_range("Out-of-range GblQuark access!");
74
75 return toString()[index];
76 }
◆ operator=() [1/4]
Definition at line 80 of file gimbal_quark.hpp.
80 {
81 value_ = cQuark;
82 return *this;
83 }
◆ operator=() [2/4]
Quark & gbl::Quark::operator= |
( |
const char * |
pString | ) |
|
|
inline |
◆ operator=() [3/4]
Quark & gbl::Quark::operator= |
( |
const std::string & |
stdStr | ) |
|
|
inline |
Definition at line 90 of file gimbal_quark.hpp.
90 {
91 return *this = stdStr.c_str();
92 }
◆ operator=() [4/4]
Quark & gbl::Quark::operator= |
( |
std::string_view |
strv | ) |
|
|
inline |
◆ fromString() [1/3]
static Quark gbl::Quark::fromString |
( |
const char * |
pString, |
|
|
std::size_t |
length = 0 |
|
) |
| |
|
inlinestatic |
Definition at line 101 of file gimbal_quark.hpp.
101 {
103 }
GblQuark GblQuark_fromString(const char *pStr, size_t len)
Returns the GblQuark associated with the given string, adding a new entry to the registry if necessar...
◆ fromString() [2/3]
static Quark gbl::Quark::fromString |
( |
const std::string & |
stdStr | ) |
|
|
inlinestatic |
Definition at line 105 of file gimbal_quark.hpp.
105 {
106 return fromString(stdStr.c_str());
107 }
◆ fromString() [3/3]
static Quark gbl::Quark::fromString |
( |
std::string_view |
strv | ) |
|
|
inlinestatic |
Definition at line 109 of file gimbal_quark.hpp.
109 {
110 return fromString(strv.data(), strv.length());
111 }
◆ fromStatic()
static Quark gbl::Quark::fromStatic |
( |
const char * |
pString | ) |
|
|
inlinestatic |
Definition at line 113 of file gimbal_quark.hpp.
113 {
115 }
GblQuark GblQuark_fromStatic(const char *pSstring)
Returns the GblQuark associated with the given STATIC string, which can save an allocation when initi...
◆ internString()
static const char * gbl::Quark::internString |
( |
const char * |
pString, |
|
|
std::size_t |
length = 0 |
|
) |
| |
|
inlinestatic |
Definition at line 117 of file gimbal_quark.hpp.
117 {
119 }
const char * GblQuark_internString(const char *pStr, size_t len)
Creates a GblQuark from the given string (if necessary), also returning its interned string.
◆ internStatic()
Definition at line 121 of file gimbal_quark.hpp.
121 {
123 }
const char * GblQuark_internStatic(const char *pString)
Creates a GblQuark from the given STATIC string (if necessary, saving on allocating),...
◆ operator<<
Definition at line 125 of file gimbal_quark.hpp.
125 {
126 os << quark.toString();
127 return os;
128 }
◆ Invalid
The documentation for this class was generated from the following file: