libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gbl::StringView Struct Reference

#include <gimbal_string_view.hpp>

Inheritance diagram for gbl::StringView:
GblStringView gbl::ReadWriteContiguousIndexable< const StringView, std::size_t, char, false > gbl::RandomAccessIterable< const StringView, std::size_t, char > gbl::ReadWriteIndexable< CRTP, Key, Value, Writable >

Public Member Functions

const char & getElement_ (std::size_t idx) const
 
std::size_t getElementCount_ () const noexcept
 
auto spaceShip_ (int result) const noexcept
 
constexpr StringView (const char *pStr, size_t size=0) noexcept
 
constexpr StringView (const StringView &rhs) noexcept
 
constexpr StringView (GblStringView gblStrv) noexcept
 
constexpr StringView (std::string_view view) noexcept
 
constexpr const char * data () const noexcept
 
constexpr std::size_t length () const noexcept
 
constexpr bool isNullTerminated () const noexcept
 
int compareIgnoreCase (const char *pString, std::size_t len=0) const noexcept
 
bool equalsIgnoreCase (const char *pString, std::size_t len=0) const noexcept
 
void copy (void *pDst, std::size_t offset, std::size_t bytes) const noexcept
 
bool empty () const noexcept
 
bool isBlank () const noexcept
 
constexpr char operator[] (std::size_t index) const
 
char first () const
 
char last () const
 
StringView removePrefix (std::size_t len) const
 
StringView removeSuffix (std::size_t len) const
 
StringView chomp () const noexcept
 
StringView substr (std::size_t offset, std::size_t length) const noexcept
 
bool contains (const char *pStr, std::size_t len=0) const noexcept
 
bool containsIgnoreCase (const char *pStr, std::size_t len=0) const noexcept
 
std::size_t count (const char *pStr, std::size_t len=0) const noexcept
 
std::size_t countIgnoreCase (const char *pStr, std::size_t len=0) const noexcept
 
std::size_t find (const char *pStr, std::size_t len=0) const noexcept
 
std::size_t findIgnoreCase (const char *pStr, std::size_t len=0) const noexcept
 
std::size_t rfind (const char *pStr, std::size_t len=0) const noexcept
 
std::size_t rfindIgnoreCase (const char *pStr, std::size_t len=0) const noexcept
 
bool startsWith (const char *pStr, std::size_t len=0) const noexcept
 
bool startsWithIgnoreCase (const char *pStr, std::size_t len=0) const noexcept
 
bool endsWith (const char *pStr, std::size_t len=0) const noexcept
 
bool endsWithIgnoreCase (const char *pStr, std::size_t len=0) const noexcept
 
std::size_t findFirstOf (const char *pChars, std::size_t len=0, std::size_t offset=0) const noexcept
 
std::size_t findLastOf (const char *pChars, std::size_t len=0, std::size_t offset=npos) const noexcept
 
std::size_t findFirstNotOf (const char *pChars, std::size_t len=0, std::size_t offset=0) const noexcept
 
std::size_t findLastNotOf (const char *pChars, std::size_t len=0, std::size_t offset=npos) const noexcept
 
std::string toStdString () const
 
Quark quark () const noexcept
 
Quark tryQuark () const noexcept
 
const charintern () const noexcept
 
bool toNil () const noexcept
 
template<typename T >
auto toValue () const noexcept
 
bool operator== (const char *pStr) const noexcept
 
auto operator<=> (const char *pStr) const noexcept
 
bool operator== (StringView rhs) const noexcept
 
auto operator<=> (StringView rhs) const noexcept
 
bool operator== (const std::string &rhs) const noexcept
 
auto operator<=> (const std::string &rhs) const noexcept
 
- Public Member Functions inherited from gbl::ReadWriteContiguousIndexable< const StringView, std::size_t, char, false >
void checkBounds (std::size_t index) const
 
std::size_t size (void) const
 
std::size_t length (void) const
 
std::size_t empty (void) const
 
char at (std::size_t index) const
 
IndexableProxy at (std::size_t index)
 
char front (std::size_t index) const
 
IndexableProxy front (void)
 
char back (void) const
 
IndexableProxy back (void)
 
- Public Member Functions inherited from gbl::ReadWriteIndexable< CRTP, Key, Value, Writable >
Value operator[] (Key key) const
 
- Public Member Functions inherited from gbl::RandomAccessIterable< const StringView, std::size_t, char >
iterator begin (void)
 
auto begin (void) const
 
auto rbegin (void)
 
auto rbegin (void) const
 
iterator end (void)
 
auto end (void) const
 
auto rend (void)
 
auto rend (void) const
 
const_iterator cbegin (void) const
 
auto crbegin (void) const
 
const_iterator cend (void) const
 
auto crend (void) const
 

Static Public Attributes

static constinit const std::size_t npos
 

Friends

std::ostream & operator<< (std::ostream &os, StringView view)
 
void swap (StringView &lhs, StringView &rhs) noexcept
 

Additional Inherited Members

- Public Types inherited from gbl::RandomAccessIterable< const StringView, std::size_t, char >
using iterator = RandomAccessIterator< const StringView, std::size_t, char, false >
 
using reverse_iterator = RandomAccessIterator< const StringView, std::size_t, char, true >
 
using const_iterator = RandomAccessIterator< std::add_const_t< const StringView >, std::size_t, char, false >
 
using reverse_const_iterator = RandomAccessIterator< std::add_const_t< const StringView >, std::size_t, char, true >
 
- Data Fields inherited from GblStringView
const char * pData
 
size_t nullTerminated: 1
 
size_t length: 63
 

Detailed Description

OO C++ binding object around GblStringView.

gbl::StringView is intended to be a complete all-in-one replacement for the builtin std::string_view, including all of its functionality and more.

Definition at line 47 of file gimbal_string_view.hpp.

Constructor & Destructor Documentation

◆ StringView() [1/5]

constexpr gbl::StringView::StringView ( )
inlineconstexprnoexcept

Definition at line 66 of file gimbal_string_view.hpp.

66 :
67 GblStringView({0}) {}
Immutable substring type.

◆ StringView() [2/5]

constexpr gbl::StringView::StringView ( const char pStr,
size_t  size = 0 
)
inlineconstexprnoexcept

Definition at line 69 of file gimbal_string_view.hpp.

69 :
70 GblStringView({ .pData = pStr })
71 {
72 if(!size) {
73 static_cast<GblStringView*>(this)->length = std::char_traits<char>::length(pStr);
74 this->nullTerminated = true;
75 } else {
76 static_cast<GblStringView*>(this)->length = size;
77 this->nullTerminated = false;
78 }
79 }
size_t nullTerminated
Reserved bit for maintaining whether the string is NULL terminated or not.

◆ StringView() [3/5]

constexpr gbl::StringView::StringView ( const StringView rhs)
inlineconstexprnoexcept

Definition at line 81 of file gimbal_string_view.hpp.

81 :
82 GblStringView(rhs) {}

◆ StringView() [4/5]

constexpr gbl::StringView::StringView ( GblStringView  gblStrv)
inlineconstexprnoexcept

Definition at line 84 of file gimbal_string_view.hpp.

84 :
85 GblStringView(gblStrv) {}

◆ StringView() [5/5]

constexpr gbl::StringView::StringView ( std::string_view  view)
inlineconstexprnoexcept

Definition at line 87 of file gimbal_string_view.hpp.

87 :
88 StringView(view.data(), view.length()) {}

Member Function Documentation

◆ getElement_()

const char & gbl::StringView::getElement_ ( std::size_t  idx) const
inline

Definition at line 54 of file gimbal_string_view.hpp.

54{ return data()[idx]; }

◆ getElementCount_()

std::size_t gbl::StringView::getElementCount_ ( ) const
inlinenoexcept

Definition at line 55 of file gimbal_string_view.hpp.

55{ return length(); }

◆ spaceShip_()

auto gbl::StringView::spaceShip_ ( int  result) const
inlinenoexcept

Definition at line 57 of file gimbal_string_view.hpp.

57 {
58 if(result < 0)
59 return std::strong_ordering::less;
60 else if(result > 0)
61 return std::strong_ordering::greater;
62 else
63 return std::strong_ordering::equal;
64 }

◆ data()

constexpr const char * gbl::StringView::data ( ) const
inlineconstexprnoexcept

Definition at line 90 of file gimbal_string_view.hpp.

90{ return pData; }
const char * pData
Start address of the string being viewed.

◆ length()

constexpr std::size_t gbl::StringView::length ( void  ) const
inlineconstexprnoexcept

Definition at line 91 of file gimbal_string_view.hpp.

91{ return static_cast<const GblStringView*>(this)->length; }

◆ isNullTerminated()

constexpr bool gbl::StringView::isNullTerminated ( ) const
inlineconstexprnoexcept

Definition at line 92 of file gimbal_string_view.hpp.

92{ return nullTerminated; }

◆ compareIgnoreCase()

int gbl::StringView::compareIgnoreCase ( const char pString,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 94 of file gimbal_string_view.hpp.

94 {
95 return GblStringView_compareIgnoreCase(*this, pString, len);
96 }
int GblStringView_compareIgnoreCase(GblStringView self, const char *pString, size_t len)
Lexicographically compares the given view to pString, ignoring case, returning a positive or negative...

◆ equalsIgnoreCase()

bool gbl::StringView::equalsIgnoreCase ( const char pString,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 98 of file gimbal_string_view.hpp.

98 {
99 return GblStringView_equalsIgnoreCase(*this, pString, len);
100 }
GblBool GblStringView_equalsIgnoreCase(GblStringView self, const char *pString, size_t len)
Returns GBL_TRUE if the given string view equals pString (ignoring casing on both operands) or return...

◆ copy()

void gbl::StringView::copy ( void pDst,
std::size_t  offset,
std::size_t  bytes 
) const
inlinenoexcept

Definition at line 103 of file gimbal_string_view.hpp.

103 {
104 GblStringView_copy(*this, pDst, offset, bytes);
105 }
GBL_RESULT GblStringView_copy(GblStringView self, void *pDst, size_t offset, size_t bytes)
Copies an arbitrary substring within teh view into the external buffer, pDst of size bytes starting a...

◆ empty()

bool gbl::StringView::empty ( void  ) const
inlinenoexcept

Definition at line 107 of file gimbal_string_view.hpp.

107 {
108 return GblStringView_empty(*this);
109 }
GblBool GblStringView_empty(GblStringView self)
Returns GBL_TRUE if the given GblStringView is empty, otherwise returning GBL_FALSE.

◆ isBlank()

bool gbl::StringView::isBlank ( ) const
inlinenoexcept

Definition at line 111 of file gimbal_string_view.hpp.

111 {
112 return GblStringView_blank(*this);
113 }
GblBool GblStringView_blank(GblStringView self)
Returns GBL_TRUE if the given GblStringView contains only whitespace characters (spaces,...

◆ operator[]()

constexpr char gbl::StringView::operator[] ( std::size_t  index) const
inlineconstexpr

Definition at line 115 of file gimbal_string_view.hpp.

115 {
116 if(index >= length())
117 throw std::out_of_range("Invalid StringView index!");
118 if (std::is_constant_evaluated()) {
119 return data()[index];
120 } else {
121 return GblStringView_at(*this, index);
122 }
123 }
char GblStringView_at(GblStringView self, size_t index)
Returns the character within the given view at index, raising an error if it is out-of-range.

◆ first()

char gbl::StringView::first ( ) const
inline

Definition at line 125 of file gimbal_string_view.hpp.

125 {
126 if(empty())
127 throw std::out_of_range("Cannot get first char of empty StringView!");
128
129 return GblStringView_first(*this);
130 }
char GblStringView_first(GblStringView self)
Returns the first character within the given view, raising an error if the view is empty.

◆ last()

char gbl::StringView::last ( ) const
inline

Definition at line 132 of file gimbal_string_view.hpp.

132 {
133 if(empty())
134 throw std::out_of_range("Cannot get last char of empty StringView!");
135
136 return GblStringView_last(*this);
137 }
char GblStringView_last(GblStringView self)
Returns the last character within the given view, raising an error if the view is empty.

◆ removePrefix()

StringView gbl::StringView::removePrefix ( std::size_t  len) const
inline

Definition at line 139 of file gimbal_string_view.hpp.

139 {
140 if(len > length())
141 throw std::out_of_range("Cannot remove prefix length > StringView.length!");
142 return GblStringView_removePrefix(*this, len);
143
144 }
GblStringView GblStringView_removePrefix(GblStringView self, size_t length)
! Returns a new GblStringView which has had the first length characters chopped off,...

◆ removeSuffix()

StringView gbl::StringView::removeSuffix ( std::size_t  len) const
inline

Definition at line 146 of file gimbal_string_view.hpp.

146 {
147 if(len > length())
148 throw std::out_of_range("Cannot remove suffix length > StringView.length!");
149 return GblStringView_removeSuffix(*this, len);
150
151 }
GblStringView GblStringView_removeSuffix(GblStringView self, size_t length)
Returns a new GblStringView which has the last length characters chopped off, raising an error upon f...

◆ chomp()

StringView gbl::StringView::chomp ( ) const
inlinenoexcept

Definition at line 153 of file gimbal_string_view.hpp.

153 {
154 return GblStringView_chomp(*this);
155 }
GblStringView GblStringView_chomp(GblStringView self)
Returns a new GblStringView which has any terminating newline characters (linux + windows) chopped of...

◆ substr()

StringView gbl::StringView::substr ( std::size_t  offset,
std::size_t  length 
) const
inlinenoexcept

Definition at line 157 of file gimbal_string_view.hpp.

157 {
158 return GblStringView_substr(*this, offset, length);
159 }
GblStringView GblStringView_substr(GblStringView self, size_t offset, size_t length)
Retruns a new GblStringView as a subview of the given GblStringView, starting at offset of size lengt...

◆ contains()

bool gbl::StringView::contains ( const char pStr,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 161 of file gimbal_string_view.hpp.

161 {
162 return GblStringView_contains(*this, pStr, len);
163 }
GblBool GblStringView_contains(GblStringView self, const char *pString, size_t len)
Returns GBL_TRUE if the given GblStringView contains the substring, pString, otherwise returning GBL_...

◆ containsIgnoreCase()

bool gbl::StringView::containsIgnoreCase ( const char pStr,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 165 of file gimbal_string_view.hpp.

165 {
166 return GblStringView_containsIgnoreCase(*this, pStr, len);
167 }
GblBool GblStringView_containsIgnoreCase(GblStringView self, const char *pString, size_t len)
Returns GBL_TRUE if the given GblStringView contains the substring, pString, (ignoring case) otherwis...

◆ count()

std::size_t gbl::StringView::count ( const char pStr,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 169 of file gimbal_string_view.hpp.

169 {
170 return GblStringView_count(*this, pStr, len);
171 }
size_t GblStringView_count(GblStringView self, const char *pString, size_t len)
Returns the number of times the substring, pString, appears within the given GblStringView.

◆ countIgnoreCase()

std::size_t gbl::StringView::countIgnoreCase ( const char pStr,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 173 of file gimbal_string_view.hpp.

173 {
174 return GblStringView_countIgnoreCase(*this, pStr, len);
175 }
size_t GblStringView_countIgnoreCase(GblStringView self, const char *pString, size_t len)
Returns the number of times the substring, pString, appears within the given GblStringView,...

◆ find()

std::size_t gbl::StringView::find ( const char pStr,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 177 of file gimbal_string_view.hpp.

177 {
178 return GblStringView_find(*this, pStr, len);
179 }
size_t GblStringView_find(GblStringView self, const char *pStr, size_t len, size_t offset)
Returns the starting index of the first occurrence of pStr appearing as a substring within the given ...

◆ findIgnoreCase()

std::size_t gbl::StringView::findIgnoreCase ( const char pStr,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 181 of file gimbal_string_view.hpp.

181 {
182 return GblStringView_findIgnoreCase(*this, pStr, len);
183 }
size_t GblStringView_findIgnoreCase(GblStringView self, const char *pStr, size_t len, size_t offset)
Returns the starting index of the first occurrence of pStr appearing as a substring within the given ...

◆ rfind()

std::size_t gbl::StringView::rfind ( const char pStr,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 185 of file gimbal_string_view.hpp.

185 {
186 return GblStringView_rfind(*this, pStr, len);
187 }
size_t GblStringView_rfind(GblStringView self, const char *pStr, size_t len, size_t offset)
Returns the starting index of the last occurrence of pStr appearing as a substring within the given G...

◆ rfindIgnoreCase()

std::size_t gbl::StringView::rfindIgnoreCase ( const char pStr,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 189 of file gimbal_string_view.hpp.

189 {
190 return GblStringView_rfindIgnoreCase(*this, pStr, len);
191 }
size_t GblStringView_rfindIgnoreCase(GblStringView self, const char *pStr, size_t len, size_t offset)
Returns the starting index of the last occurrence of pStr appearing as a substring within the given G...

◆ startsWith()

bool gbl::StringView::startsWith ( const char pStr,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 193 of file gimbal_string_view.hpp.

193 {
194 return GblStringView_startsWith(*this, pStr, len);
195 }
GblBool GblStringView_startsWith(GblStringView self, const char *pString, size_t len)
Returns GBL_TRUE if the given GblStringView starts with the substring given by pString,...

◆ startsWithIgnoreCase()

bool gbl::StringView::startsWithIgnoreCase ( const char pStr,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 197 of file gimbal_string_view.hpp.

197 {
198 return GblStringView_startsWithIgnoreCase(*this, pStr, len);
199 }
GblBool GblStringView_startsWithIgnoreCase(GblStringView self, const char *pString, size_t len)
Returns GBL_TRUE if the given GblStringView starts with the substring given by pString (ignoring casi...

◆ endsWith()

bool gbl::StringView::endsWith ( const char pStr,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 201 of file gimbal_string_view.hpp.

201 {
202 return GblStringView_endsWith(*this, pStr, len);
203 }
GblBool GblStringView_endsWith(GblStringView self, const char *pString, size_t len)
Returns GBL_TRUE if the given GblStringView ends with the substring given by pString,...

◆ endsWithIgnoreCase()

bool gbl::StringView::endsWithIgnoreCase ( const char pStr,
std::size_t  len = 0 
) const
inlinenoexcept

Definition at line 205 of file gimbal_string_view.hpp.

205 {
206 return GblStringView_endsWithIgnoreCase(*this, pStr, len);
207 }
GblBool GblStringView_endsWithIgnoreCase(GblStringView self, const char *pString, size_t len)
Returns GBL_TRUE if the given GblStringView ends with the substring given by pString (ignoring casing...

◆ findFirstOf()

std::size_t gbl::StringView::findFirstOf ( const char pChars,
std::size_t  len = 0,
std::size_t  offset = 0 
) const
inlinenoexcept

Definition at line 209 of file gimbal_string_view.hpp.

209 {
210 return GblStringView_findFirstOf(*this, pChars, len, offset);
211 }
size_t GblStringView_findFirstOf(GblStringView self, const char *pChars, size_t len, size_t offset)
Returns the index of the first occurrence of one of the characters provided within pChars,...

◆ findLastOf()

std::size_t gbl::StringView::findLastOf ( const char pChars,
std::size_t  len = 0,
std::size_t  offset = npos 
) const
inlinenoexcept

Definition at line 213 of file gimbal_string_view.hpp.

213 {
214 return GblStringView_findLastOf(*this, pChars, len, offset);
215 }
size_t GblStringView_findLastOf(GblStringView self, const char *pChars, size_t len, size_t offset)
Returns the index of the last occurrence of one of the characters provided within pChars,...

◆ findFirstNotOf()

std::size_t gbl::StringView::findFirstNotOf ( const char pChars,
std::size_t  len = 0,
std::size_t  offset = 0 
) const
inlinenoexcept

Definition at line 217 of file gimbal_string_view.hpp.

217 {
218 return GblStringView_findFirstNotOf(*this, pChars, len, offset);
219 }
size_t GblStringView_findFirstNotOf(GblStringView self, const char *pChars, size_t len, size_t offset)
Returns the index of the first occurrence of a character NOT provided within pChars,...

◆ findLastNotOf()

std::size_t gbl::StringView::findLastNotOf ( const char pChars,
std::size_t  len = 0,
std::size_t  offset = npos 
) const
inlinenoexcept

Definition at line 221 of file gimbal_string_view.hpp.

221 {
222 return GblStringView_findLastNotOf(*this, pChars, len, offset);
223 }
size_t GblStringView_findLastNotOf(GblStringView self, const char *pChars, size_t len, size_t offset)
Returns the index of the last occurrence of a character NOT provided within pChars,...

◆ toStdString()

std::string gbl::StringView::toStdString ( ) const
inline

Definition at line 225 of file gimbal_string_view.hpp.

225 {
226 std::string str;
227 str.resize(length());
228 GblStringView_toCString(*this, str.data(), str.capacity());
229 return str;
230 }
char * GblStringView_toCString(GblStringView self, char *pDest, size_t destSize)
Converts the given GblStringView to a NULL-terminated C string, copying it to the pDest buffer of des...

◆ quark()

Quark gbl::StringView::quark ( ) const
inlinenoexcept

Definition at line 232 of file gimbal_string_view.hpp.

232 {
233 return GblStringView_quark(*this);
234 }
GblQuark GblStringView_quark(GblStringView self)
Creates and returns a GblQuark interned string representation from the given GblStringView.

◆ tryQuark()

Quark gbl::StringView::tryQuark ( ) const
inlinenoexcept

Definition at line 236 of file gimbal_string_view.hpp.

236 {
237 return GblStringView_tryQuark(*this);
238 }
GblQuark GblStringView_tryQuark(GblStringView self)
Attempts to return the GblQuark corresponding to the given GblStringView, retruning GBL_QUARK_INVALID...

◆ intern()

const char * gbl::StringView::intern ( ) const
inlinenoexcept

Definition at line 240 of file gimbal_string_view.hpp.

240 {
241 return GblStringView_intern(*this);
242 }
const char * GblStringView_intern(GblStringView self)
Interns (creates a GblQuark) from the given GblStringView, returning its C string representation.

◆ toNil()

bool gbl::StringView::toNil ( ) const
inlinenoexcept

Definition at line 244 of file gimbal_string_view.hpp.

244{ return GblStringView_toNil(*this); }
GblBool GblStringView_toNil(GblStringView self)
Converts the given GblStringView to NIL (returns GBL_TRUE if it's empty or matches "nil")

◆ toValue()

template<typename T >
auto gbl::StringView::toValue ( ) const
inlinenoexcept

Definition at line 247 of file gimbal_string_view.hpp.

247{ return string_view_to_value<T>(*this); }

◆ operator==() [1/3]

bool gbl::StringView::operator== ( const char pStr) const
inlinenoexcept

Definition at line 254 of file gimbal_string_view.hpp.

254 {
255 return GblStringView_equals(*this, pStr);
256 }
GblBool GblStringView_equals(GblStringView self, const char *pString, size_t len)
Returns GBL_TRUE if the given string view equals pString or returns GBL_FALSE otherwise.

◆ operator<=>() [1/3]

auto gbl::StringView::operator<=> ( const char pStr) const
inlinenoexcept

Definition at line 258 of file gimbal_string_view.hpp.

258 {
259 return spaceShip_(GblStringView_compare(*this, pStr));
260 }
int GblStringView_compare(GblStringView self, const char *pString, size_t len)
Lexicographically compares the given view to pString, returning a positive or negative for inequality...

◆ operator==() [2/3]

bool gbl::StringView::operator== ( StringView  rhs) const
inlinenoexcept

Definition at line 262 of file gimbal_string_view.hpp.

262 {
263 return GblStringView_equals(*this, rhs.data(), rhs.length());
264 }

◆ operator<=>() [2/3]

auto gbl::StringView::operator<=> ( StringView  rhs) const
inlinenoexcept

Definition at line 266 of file gimbal_string_view.hpp.

266 {
267 return spaceShip_(GblStringView_compare(*this, rhs.data(), rhs.length()));
268 }

◆ operator==() [3/3]

bool gbl::StringView::operator== ( const std::string &  rhs) const
inlinenoexcept

Definition at line 270 of file gimbal_string_view.hpp.

270 {
271 return GblStringView_equals(*this, rhs.data(), rhs.length());
272 }

◆ operator<=>() [3/3]

auto gbl::StringView::operator<=> ( const std::string &  rhs) const
inlinenoexcept

Definition at line 274 of file gimbal_string_view.hpp.

274 {
275 return spaceShip_(GblStringView_compare(*this, rhs.data(), rhs.length()));
276 }

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
StringView  view 
)
friend

Definition at line 249 of file gimbal_string_view.hpp.

249 {
250 os << std::string_view(view.data(), view.length());
251 return os;
252 }

◆ swap

void swap ( StringView lhs,
StringView rhs 
)
friend

Definition at line 278 of file gimbal_string_view.hpp.

278 {
279 std::swap(static_cast<GblStringView&>(lhs),
280 static_cast<GblStringView&>(rhs));
281 }

Field Documentation

◆ npos

constinit const std::size_t gbl::StringView::npos
static

Definition at line 52 of file gimbal_string_view.hpp.


The documentation for this struct was generated from the following file: