Definition at line 11 of file gimbal_string_ref.hpp.
◆ StringRef() [1/3]
gbl::StringRef::StringRef |
( |
const char * |
pStr, |
|
|
std::size_t |
len = 0 |
|
) |
| |
|
inlinenoexcept |
Definition at line 19 of file gimbal_string_ref.hpp.
19 :
GblStringRef * GblStringRef_create(const char *pString, size_t len, GblContext *pCtx)
Creates and returns a reference containing pString, with optional length and context.
◆ StringRef() [2/3]
gbl::StringRef::StringRef |
( |
const StringRef & |
rhs | ) |
|
|
inlinenoexcept |
Definition at line 22 of file gimbal_string_ref.hpp.
22 :
GblStringRef * GblStringRef_ref(const GblStringRef *pRef)
Returns a new reference to pRef, incrementing its internal reference count rather than actually copyi...
◆ StringRef() [3/3]
gbl::StringRef::StringRef |
( |
StringRef && |
rhs | ) |
|
|
inlinenoexcept |
◆ ~StringRef()
gbl::StringRef::~StringRef |
( |
| ) |
|
|
inlinenoexcept |
Definition at line 43 of file gimbal_string_ref.hpp.
43 {
45 }
GblRefCount GblStringRef_unref(const GblStringRef *pRef)
Releases a reference to pRef, freeing the allocation if it was the last, returning the new refCount.
◆ fromGblRef()
Definition at line 31 of file gimbal_string_ref.hpp.
31 {
32 StringRef ref;
33 ref.pRef_ = pRef;
34 return ref;
35 }
◆ toGblRef()
Definition at line 37 of file gimbal_string_ref.hpp.
37 {
39 pRef_ = nullptr;
40 return pTemp;
41 }
const char GblStringRef
Reference-counted, const char*-compatible string type.
◆ operator=() [1/3]
StringRef & gbl::StringRef::operator= |
( |
const char * |
pCStr | ) |
|
|
inlinenoexcept |
◆ operator=() [2/3]
◆ operator=() [3/3]
Definition at line 59 of file gimbal_string_ref.hpp.
59 {
61 pRef_ = rhs.pRef_;
62 rhs.pRef_ = nullptr;
63 return *this;
64 }
◆ operator const char *()
gbl::StringRef::operator const char * |
( |
| ) |
const |
|
inlinenoexcept |
◆ operator[]()
char gbl::StringRef::operator[] |
( |
std::size_t |
index | ) |
const |
|
inline |
Definition at line 70 of file gimbal_string_ref.hpp.
70 {
71 if(index >= length())
72 throw std::out_of_range {
73 "Attempt to index StringRef out-of-range!"
74 };
75
76 return pRef_[index];
77 }
◆ view()
StringView gbl::StringRef::view |
( |
std::size_t |
offset = 0 , |
|
|
std::size_t |
len = 0 |
|
) |
| const |
|
inline |
Definition at line 79 of file gimbal_string_ref.hpp.
79 {
80 if(!len)
81 len = length() - offset;
82
83 if(offset + len > length())
84 throw std::out_of_range {
85 "Attempt to create out-of-range StringView from StringRef"
86 };
87
88
90 .
pData = pRef_ + offset,
91 .nullTerminated = (offset + len == length()),
92 .length = len
93 };
94 }
Immutable substring type.
const char * pData
Start address of the string being viewed.
◆ refCount()
std::size_t gbl::StringRef::refCount |
( |
| ) |
const |
|
inlinenoexcept |
Definition at line 96 of file gimbal_string_ref.hpp.
96 {
98 }
GblRefCount GblStringRef_refCount(const GblStringRef *pSelf)
Returns the number of active references remaining to the given GblStringRef.
◆ length()
std::size_t gbl::StringRef::length |
( |
| ) |
const |
|
inlinenoexcept |
Definition at line 100 of file gimbal_string_ref.hpp.
100 {
102 }
size_t GblStringRef_length(const GblStringRef *pSelf)
Returns the cached length of the given GblStringRef.
◆ valid()
bool gbl::StringRef::valid |
( |
| ) |
const |
|
inlinenoexcept |
Definition at line 104 of file gimbal_string_ref.hpp.
104 {
106 }
GblBool GblStringRef_valid(const GblStringRef *pSelf)
Returns whether the given GblStringRef is valid (not NULL)
◆ empty()
bool gbl::StringRef::empty |
( |
| ) |
const |
|
inlinenoexcept |
Definition at line 108 of file gimbal_string_ref.hpp.
108 {
110 }
GblBool GblStringRef_empty(const GblStringRef *pSelf)
Returns whether the given GblStringRef is empty, with nothing but a NULL terminator.
◆ blank()
bool gbl::StringRef::blank |
( |
| ) |
const |
|
inlinenoexcept |
Definition at line 112 of file gimbal_string_ref.hpp.
112 {
114 }
GblBool GblStringRef_blank(const GblStringRef *pSelf)
Returns whether the given GblStringRef is blank, containing only NULL or spacing characters.
The documentation for this class was generated from the following file: