Definition at line 9 of file gimbal_string_ref.hpp.
◆ StringRef() [1/3]
| gbl::StringRef::StringRef |
( |
const char * | pStr, |
|
|
std::size_t | len = 0 ) |
|
inlinenoexcept |
Definition at line 17 of file gimbal_string_ref.hpp.
17 :
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 20 of file gimbal_string_ref.hpp.
20 :
GblStringRef * GblStringRef_ref(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 41 of file gimbal_string_ref.hpp.
41 {
43 }
GblRefCount GblStringRef_unref(GblStringRef *pRef)
Releases a reference to pRef, freeing the allocation if it was the last, returning the new refCount.
◆ fromGblRef()
Definition at line 29 of file gimbal_string_ref.hpp.
29 {
30 StringRef ref;
31 ref.pRef_ = pRef;
32 return ref;
33 }
◆ toGblRef()
Definition at line 35 of file gimbal_string_ref.hpp.
35 {
37 pRef_ = nullptr;
38 return pTemp;
39 }
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 57 of file gimbal_string_ref.hpp.
57 {
59 pRef_ = rhs.pRef_;
60 rhs.pRef_ = nullptr;
61 return *this;
62 }
◆ operator const char *()
| gbl::StringRef::operator const char * |
( |
| ) |
const |
|
inlinenoexcept |
◆ operator[]()
| char gbl::StringRef::operator[] |
( |
std::size_t | index | ) |
const |
|
inline |
Definition at line 68 of file gimbal_string_ref.hpp.
68 {
69 if(index >= length())
70 throw std::out_of_range {
71 "Attempt to index StringRef out-of-range!"
72 };
73
74 return pRef_[index];
75 }
◆ view()
| StringView gbl::StringRef::view |
( |
std::size_t | offset = 0, |
|
|
std::size_t | len = 0 ) const |
|
inline |
Definition at line 77 of file gimbal_string_ref.hpp.
77 {
78 if(!len)
79 len = length() - offset;
80
81 if(offset + len > length())
82 throw std::out_of_range {
83 "Attempt to create out-of-range StringView from StringRef"
84 };
85
86
87 GblStringView view;
88 view.pData = pRef_ + offset;
89 view.length = len;
90 view.nullTerminated = (offset + len == length());
91
92 return view;
93 }
◆ refCount()
| std::size_t gbl::StringRef::refCount |
( |
| ) |
const |
|
inlinenoexcept |
Definition at line 95 of file gimbal_string_ref.hpp.
95 {
97 }
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 99 of file gimbal_string_ref.hpp.
99 {
101 }
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 103 of file gimbal_string_ref.hpp.
103 {
105 }
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 107 of file gimbal_string_ref.hpp.
107 {
109 }
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 111 of file gimbal_string_ref.hpp.
111 {
113 }
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: