libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_string_view.h
Go to the documentation of this file.
1/*! \file
2 * \brief GblStringView structure and related functions
3 * \ingroup strings
4 *
5 * This file contains the GblStringView structure and related
6 * API. A GblStringView is an immutable slice of a string,
7 * containing simply a pointer to the string and its size.
8 * When doing non-mutating operations on strings, such as
9 * searching, this is the preferred string type for the job
10 * with the most detailed API.
11 *
12 * \note
13 * GblStringView also reserves one bit of its length field to
14 * store whether it's NULL-terminated or not. This allows for
15 * more efficient conversions between string_view types and
16 * NULL-terminated C strings, as a copy can be ellided when
17 * the view is already of a NULL-terminated C string.
18 *
19 * \author 2023 Falco Girgis
20 * \copyright MIT License
21 */
22
23#ifndef GIMBAL_STRING_VIEW_H
24#define GIMBAL_STRING_VIEW_H
25
26#include "../core/gimbal_ctx.h"
27#include "../algorithms/gimbal_hash.h"
28#include "../preprocessor/gimbal_compiler.h"
29#include "../preprocessor/gimbal_macro_utils.h"
30#include "gimbal_quark.h"
31#include <ctype.h>
32#include <stdint.h>
33#include <limits.h>
34
35//! Constant value used to signify the last position or an invalid position in a GblStringView
36#define GBL_STRING_VIEW_NPOS GBL_NPOS
37//! Convenience shorthand macro for creating a GblStringView from an existing string or substring
38#define GBL_STRV(/*const char* pString, size_t len=0*/...) GblStringView_fromString(__VA_ARGS__)
39//! Convenience macro for converting a GblStringView to a C string, elliding creation of a temporary when the view is already NULL terminated
40#define GBL_STRING_VIEW_CSTR(view) ((view).nullTerminated? (view).pData : GBL_STRING_VIEW_CSTR_ALLOCA((view)))
41//! Convenience macro for creating a NULL-terminated C string from a GblStringView on the stack, using alloca()
42#define GBL_STRING_VIEW_CSTR_ALLOCA(view) GblStringView_toCString(view, (char*)GBL_ALLOCA(view.length + 1), view.length + 1)
43
44#define GBL_SELF_TYPE GblStringView
45
47
48/*! \brief Immutable substring type
49 * \ingroup strings
50 *
51 * Represents an externally owned slice or "view"
52 * into a region of a string, storing its start
53 * address and length. NULL termination is not
54 * required, so a string view cannot be assumed
55 * to be a well-formed standalone C string.
56 */
57typedef struct GblStringView {
58 const char* pData; //!< Start address of the string being viewed
60 size_t nullTerminated : 1, //!< Whether the string is NULL-terminated or not
61 size_t length : sizeof(size_t) * 8 - 1 //!< Length of the string in bytes
62 )
63} GblStringView;
64
65/*! \name Construction
66 * \brief Methods for constructing a new view
67 * \relatesalso GblStringView
68 * @{
69 */
70//! Constructs an empty GblStringView (same as zero initializing one)
71GBL_EXPORT GblStringView GblStringView_fromEmpty (void) GBL_NOEXCEPT;
72//! Constructs a GblStringView from a(n optionally sized) character array
73GBL_EXPORT GblStringView GblStringView_fromString (const char* pString, size_t length/*=0*/) GBL_NOEXCEPT;
74//! Constructs a GblStringView from an existing GblQuark, or creating an empty view if it's invalid
75GBL_EXPORT GblStringView GblStringView_fromQuark (GblQuark quark) GBL_NOEXCEPT;
76//! @}
78/*! \name Comparisons
79 * \brief Methods providing string view comparison operators
80 * \relatesalso GblStringView
81 * @{
82 */
83//! Lexicographically compares the given view to \p pString, returning a positive or negative for inequality or 0 if equal
84GBL_EXPORT int GblStringView_compare (GBL_VSELF, const char* pString, size_t len/*=0*/) GBL_NOEXCEPT;
85//! Lexicographically compares the given view to \p pString, ignoring case, returning a positive or negative for inequality or 0 if equal
86GBL_EXPORT int GblStringView_compareIgnoreCase (GBL_VSELF, const char* pString, size_t len/*=0*/) GBL_NOEXCEPT;
87//! Returns GBL_TRUE if the given string view equals \p pString or returns GBL_FALSE otherwise
88GBL_EXPORT GblBool GblStringView_equals (GBL_VSELF, const char* pString, size_t len/*=0*/) GBL_NOEXCEPT;
89//! Returns GBL_TRUE if the given string view equals \p pString (ignoring casing on both operands) or returns GBL_FALSE otherwise
90GBL_EXPORT GblBool GblStringView_equalsIgnoreCase (GBL_VSELF, const char* pString, size_t len/*=0*/) GBL_NOEXCEPT;
91//! @}
93/*! \name Reading
94 * \brief Methods for retrieving characters and substrings
95 * \relatesalso GblStringView
96 * @{
97 */
98//! Returns the character within the given view at \p index, raising an error if it is out-of-range
99GBL_EXPORT char GblStringView_at (GBL_VSELF, size_t index) GBL_NOEXCEPT;
100//! Returns the first character within the given view, raising an error if the view is empty
101GBL_EXPORT char GblStringView_first (GBL_VSELF) GBL_NOEXCEPT;
102//! Returns the last character within the given view, raising an error if the view is empty
103GBL_EXPORT char GblStringView_last (GBL_VSELF) GBL_NOEXCEPT;
104//! Copies an arbitrary substring within teh view into the external buffer, \p pDst of size \p bytes starting at \p offset
105GBL_EXPORT GBL_RESULT GblStringView_copy (GBL_VSELF, void* pDst, size_t offset, size_t bytes) GBL_NOEXCEPT;
106//! @}
108/*! \name Trimming
109 * \brief Methods for creating substrings
110 * \relatesalso GblStringView
111 * @{
112 */
113///! Returns a new GblStringView which has had the first \p length characters chopped off, raising an error upon failure
114GBL_EXPORT GblStringView GblStringView_removePrefix (GBL_VSELF, size_t length) GBL_NOEXCEPT;
115//! Returns a new GblStringView which has the last \p length characters chopped off, raising an error upon failure
116GBL_EXPORT GblStringView GblStringView_removeSuffix (GBL_VSELF, size_t length) GBL_NOEXCEPT;
117//! Returns a new GblStringView which has any terminating newline characters (linux + windows) chopped off
118GBL_EXPORT GblStringView GblStringView_chomp (GBL_VSELF) GBL_NOEXCEPT;
119//! Retruns a new GblStringView as a subview of the given GblStringView, starting at \p offset of size \p length
120GBL_EXPORT GblStringView GblStringView_substr (GBL_VSELF, size_t offset, size_t length) GBL_NOEXCEPT;
121//! @}
123/*! \name Searching
124 * \brief Methods for finding, counting, and matching
125 * \relatesalso GblStringView
126 * @{
127 */
128//! Returns GBL_TRUE if the given GblStringView contains the substring, \p pString, otherwise returning GBL_FALSE if not found
129GBL_EXPORT GblBool GblStringView_contains (GBL_VSELF, const char* pString, size_t len/*=0*/) GBL_NOEXCEPT;
130//! Returns GBL_TRUE if the given GblStringView contains the substring, \p pString, (ignoring case) otherwise returning GBL_FALSE if not found
131GBL_EXPORT GblBool GblStringView_containsIgnoreCase (GBL_VSELF, const char* pString, size_t len/*=0*/) GBL_NOEXCEPT;
132//! Returns the number of times the substring, \p pString, appears within the given GblStringView
133GBL_EXPORT size_t GblStringView_count (GBL_VSELF, const char* pString, size_t len/*=0*/) GBL_NOEXCEPT;
134//! Returns the number of times the substring, \p pString, appears within the given GblStringView, ignoring casing
135GBL_EXPORT size_t GblStringView_countIgnoreCase (GBL_VSELF, const char* pString, size_t len/*=0*/) GBL_NOEXCEPT;
136//! Returns the starting index of the first occurrence of \p pStr appearing as a substring within the given GblStringView after \p offset
137GBL_EXPORT size_t GblStringView_find (GBL_VSELF, const char* pStr, size_t len/*=0*/, size_t offset/*=0*/) GBL_NOEXCEPT;
138//! Returns the starting index of the first occurrence of \p pStr appearing as a substring within the given GblStringView after \p offset (ignoring casing)
139GBL_EXPORT size_t GblStringView_findIgnoreCase (GBL_VSELF, const char* pStr, size_t len/*=0*/, size_t offset/*=0*/) GBL_NOEXCEPT;
140//! Returns the starting index of the last occurrence of \p pStr appearing as a substring within the given GblStringView before \p offset
141GBL_EXPORT size_t GblStringView_rfind (GBL_VSELF, const char* pStr, size_t len/*=0*/, size_t offset/*=GBL_NPOS*/) GBL_NOEXCEPT;
142//! Returns the starting index of the last occurrence of \p pStr appearing as a substring within the given GblStringView before \p offset (ignoring case)
143GBL_EXPORT size_t GblStringView_rfindIgnoreCase (GBL_VSELF, const char* pStr, size_t len/*=0*/, size_t offset/*=GBL_NPOS*/) GBL_NOEXCEPT;
144//! Returns GBL_TRUE if the given GblStringView starts with the substring given by \p pString, otherwise returning GBL_FALSE
145GBL_EXPORT GblBool GblStringView_startsWith (GBL_VSELF, const char* pString, size_t len/*=0*/) GBL_NOEXCEPT;
146//! Returns GBL_TRUE if the given GblStringView starts with the substring given by \p pString (ignoring casing), otherwise returning GBL_FALSE
147GBL_EXPORT GblBool GblStringView_startsWithIgnoreCase (GBL_VSELF, const char* pString, size_t len/*=0*/) GBL_NOEXCEPT;
148//! Returns GBL_TRUE if the given GblStringView ends with the substring given by \p pString, otherwise returning GBL_FALSE
149GBL_EXPORT GblBool GblStringView_endsWith (GBL_VSELF, const char* pString, size_t len/*=0*/) GBL_NOEXCEPT;
150//! Returns GBL_TRUE if the given GblStringView ends with the substring given by \p pString (ignoring casing), otherwise returning GBL_FALSE
151GBL_EXPORT GblBool GblStringView_endsWithIgnoreCase (GBL_VSELF, const char* pString, size_t len/*=0*/) GBL_NOEXCEPT;
152//! Returns the index of the first occurrence of one of the characters provided within \p pChars, starting at \p offset
153GBL_EXPORT size_t GblStringView_findFirstOf (GBL_VSELF, const char* pChars, size_t len/*=0*/, size_t offset/*=0*/) GBL_NOEXCEPT;
154//! Returns the index of the last occurrence of one of the characters provided within \p pChars, ending at \p offset
155GBL_EXPORT size_t GblStringView_findLastOf (GBL_VSELF, const char* pChars, size_t len/*=0*/, size_t offset/*=GBL_NPOS*/) GBL_NOEXCEPT;
156//! Returns the index of the first occurrence of a character NOT provided within \p pChars, starting at \p offset
157GBL_EXPORT size_t GblStringView_findFirstNotOf (GBL_VSELF, const char* pChars, size_t len/*=0*/, size_t offset/*=0*/) GBL_NOEXCEPT;
158//! Returns the index of the last occurrence of a character NOT provided within \p pChars, ending at \p offset
159GBL_EXPORT size_t GblStringView_findLastNotOf (GBL_VSELF, const char* pChars, size_t len/*=0*/, size_t offset/*=GBL_NPOS*/) GBL_NOEXCEPT;
160//! @}
162/*! \name Utilities
163 * \brief Methods providing miscellaneous functionality
164 * \relatesalso GblStringView
165 * @{
166 */
167//! Returns GBL_TRUE if the given GblStringView is empty, otherwise returning GBL_FALSE
168GBL_EXPORT GblBool GblStringView_empty (GBL_VSELF) GBL_NOEXCEPT;
169//! Returns GBL_TRUE if the given GblStringView contains only whitespace characters (spaces, tabs, newlines)
171//! Returns the GblHash for the given GblStringView, using the default libGimbal hashing algorithm
173//! Creates and returns a GblQuark interned string representation from the given GblStringView
175//! Attempts to return the GblQuark corresponding to the given GblStringView, retruning GBL_QUARK_INVALID if there isn't one
176GBL_EXPORT GblQuark GblStringView_tryQuark (GBL_VSELF) GBL_NOEXCEPT;
177//! Interns (creates a GblQuark) from the given GblStringView, returning its C string representation
178GBL_EXPORT const char* GblStringView_intern (GBL_VSELF) GBL_NOEXCEPT;
179//! Duplicates the given GblStringView as a heap-allocated NULL-terminated C string and returns it. Don't forget to free it!
180GBL_EXPORT char* GblStringView_strdup (GBL_VSELF) GBL_NOEXCEPT;
181//! Calls libC's `sscanf()` using the given GblStringView as the source buffer
182GBL_EXPORT int GblStringView_scanf (GBL_VSELF, const char* pFmt, ...) GBL_NOEXCEPT;
183//! Calls libC's `vsscanf()` using the given GblStringView as the source buffer
184GBL_EXPORT int GblStringView_scanfVa (GBL_VSELF, const char* pFmt, va_list* pVarArgs) GBL_NOEXCEPT;
185//! @}
187/*! \name Converting
188 * \brief Methods providing conversion operators from string views
189 * \relatesalso GblStringView
190 * @{
191 */
192//! Converts the given GblStringView to a NULL-terminated C string, copying it to the \p pDest buffer of \p destSize capacity
193GBL_EXPORT char* GblStringView_toCString (GBL_VSELF, char* pDest, size_t destSize) GBL_NOEXCEPT;
194//! Converts the given GblStringView to NIL (returns GBL_TRUE if it's empty or matches "nil")
196//! Converts the given GblStringView to a boolean value, optionally returning whether the conversion succeeded or not
197GBL_EXPORT GblBool GblStringView_toBool (GBL_VSELF, GblBool* pSuccess/*=NULL*/) GBL_NOEXCEPT;
198//! Converts the given GblStringView to a char value, optionally returning whether the conversion succeeded or not
199GBL_EXPORT char GblStringView_toChar (GBL_VSELF, GblBool* pSuccess/*=NULL*/) GBL_NOEXCEPT;
200//! Converts the given GblStringView to a uint8_t value, optionally returning whether the conversion succeeded or not
201GBL_EXPORT uint8_t GblStringView_toUint8 (GBL_VSELF, GblBool* pSuccess/*=NULL*/) GBL_NOEXCEPT;
202//! Converts the given GblStringView to a uint16_t value, optionally returning whether the conversion succeeded or not
203GBL_EXPORT uint16_t GblStringView_toUint16 (GBL_VSELF, GblBool* pSuccess/*=NULL*/) GBL_NOEXCEPT;
204//! Converts the given GblStringView to an int16_t value, optionally returning whether the conversion succeeded or not
205GBL_EXPORT int16_t GblStringView_toInt16 (GBL_VSELF, GblBool* pSuccess/*=NULL*/) GBL_NOEXCEPT;
206//! Converts the given GblStringView to a uint32_t value, optionally returning whether the conversion succeeded or not
207GBL_EXPORT uint32_t GblStringView_toUint32 (GBL_VSELF, GblBool* pSuccess/*=NULL*/) GBL_NOEXCEPT;
208//! Converts the given GblStringView to an int32_t value, optionally returning whether the conversion succeeded or not
209GBL_EXPORT int32_t GblStringView_toInt32 (GBL_VSELF, GblBool* pSuccess/*=NULL*/) GBL_NOEXCEPT;
210//! Converts the given GblStringView to a uint64_t value, optionally returning whether the conversion succeeded or not
211GBL_EXPORT uint64_t GblStringView_toUint64 (GBL_VSELF, GblBool* pSuccess/*=NULL*/) GBL_NOEXCEPT;
212//! Converts the given GblStringView to an int64_t value, optionally returning whether the conversion succeeded or not
213GBL_EXPORT int64_t GblStringView_toInt64 (GBL_VSELF, GblBool* pSuccess/*=NULL*/) GBL_NOEXCEPT;
214//! Converts the given GblStringView to a float value, optionally returning whether the conversion succeeded or not
215GBL_EXPORT float GblStringView_toFloat (GBL_VSELF, GblBool* pSuccess/*=NULL*/) GBL_NOEXCEPT;
216//! Converts the given GblStringView to a double value, optionally returning whether the conversion succeeded or not
217GBL_EXPORT double GblStringView_toDouble (GBL_VSELF, GblBool* pSuccess/*=NULL*/) GBL_NOEXCEPT;
218//! Converts the given GblStringView to a pointer value, optionally returning whether the conversion succeeded or not
219GBL_EXPORT void* GblStringView_toPointer (GBL_VSELF, GblBool* pSuccess/*=NULL*/) GBL_NOEXCEPT;
220//! @}
223
224//! \cond
225#define GblStringView_fromString(...)
226 GblStringView_fromStringDefault_(__VA_ARGS__)
227#define GblStringView_fromStringDefault_(...)
228 GblStringView_fromStringDefault__(__VA_ARGS__, 0)
229#define GblStringView_fromStringDefault__(string, length, ...)
230 (GblStringView_fromString)(string, length)
231
232#define GblStringView_compare(...)
233 GblStringView_compareDefault_(__VA_ARGS__)
234#define GblStringView_compareDefault_(...)
235 GblStringView_compareDefault__(__VA_ARGS__, 0)
236#define GblStringView_compareDefault__(view, string, length, ...)
237 (GblStringView_compare)(view, string, length)
238
239#define GblStringView_compareIgnoreCase(...)
240 GblStringView_compareIgnoreCaseDefault_(__VA_ARGS__)
241#define GblStringView_compareIgnoreCaseDefault_(...)
242 GblStringView_compareIgnoreCaseDefault__(__VA_ARGS__, 0)
243#define GblStringView_compareIgnoreCaseDefault__(view, string, length, ...)
244 (GblStringView_compareIgnoreCase)(view, string, length)
245
246#define GblStringView_equals(...)
247 GblStringView_equalsDefault_(__VA_ARGS__)
248#define GblStringView_equalsDefault_(...)
249 GblStringView_equalsDefault__(__VA_ARGS__, 0)
250#define GblStringView_equalsDefault__(view, string, length, ...)
251 (GblStringView_equals)(view, string, length)
252
253#define GblStringView_equalsIgnoreCase(...)
254 GblStringView_equalsIgnoreCaseDefault_(__VA_ARGS__)
255#define GblStringView_equalsIgnoreCaseDefault_(...)
256 GblStringView_equalsIgnoreCaseDefault__(__VA_ARGS__, 0)
257#define GblStringView_equalsIgnoreCaseDefault__(view, string, length, ...)
258 (GblStringView_equalsIgnoreCase)(view, string, length)
259
260#define GblStringView_contains(...)
261 GblStringView_containsDefault_(__VA_ARGS__)
262#define GblStringView_containsDefault_(...)
263 GblStringView_containsDefault__(__VA_ARGS__, 0)
264#define GblStringView_containsDefault__(view, string, length, ...)
265 (GblStringView_contains)(view, string, length)
266
267#define GblStringView_containsIgnoreCase(...)
268 GblStringView_containsIgnoreCaseDefault_(__VA_ARGS__)
269#define GblStringView_containsIgnoreCaseDefault_(...)
270 GblStringView_containsIgnoreCaseDefault__(__VA_ARGS__, 0)
271#define GblStringView_containsIgnoreCaseDefault__(view, string, length, ...)
272 (GblStringView_containsIgnoreCase)(view, string, length)
273
274#define GblStringView_count(...)
275 GblStringView_countDefault_(__VA_ARGS__)
276#define GblStringView_countDefault_(...)
277 GblStringView_countDefault__(__VA_ARGS__, 0)
278#define GblStringView_countDefault__(view, string, length, ...)
279 (GblStringView_count)(view, string, length)
280
281#define GblStringView_startsWith(...)
282 GblStringView_startsWithDefault_(__VA_ARGS__)
283#define GblStringView_startsWithDefault_(...)
284 GblStringView_startsWithDefault__(__VA_ARGS__, 0)
285#define GblStringView_startsWithDefault__(view, string, length, ...)
286 (GblStringView_startsWith)(view, string, length)
287
288#define GblStringView_startsWithIgnoreCase(...)
289 GblStringView_startsWithIgnoreCaseDefault_(__VA_ARGS__)
290#define GblStringView_startsWithIgnoreCaseDefault_(...)
291 GblStringView_startsWithIgnoreCaseDefault__(__VA_ARGS__, 0)
292#define GblStringView_startsWithIgnoreCaseDefault__(view, string, length, ...)
293 (GblStringView_startsWithIgnoreCase)(view, string, length)
294
295#define GblStringView_endsWith(...)
296 GblStringView_endsWithDefault_(__VA_ARGS__)
297#define GblStringView_endsWithDefault_(...)
298 GblStringView_endsWithDefault__(__VA_ARGS__, 0)
299#define GblStringView_endsWithDefault__(view, string, length, ...)
300 (GblStringView_endsWith)(view, string, length)
301
302#define GblStringView_endsWithIgnoreCase(...)
303 GblStringView_endsWithIgnoreCaseDefault_(__VA_ARGS__)
304#define GblStringView_endsWithIgnoreCaseDefault_(...)
305 GblStringView_endsWithIgnoreCaseDefault__(__VA_ARGS__, 0)
306#define GblStringView_endsWithIgnoreCaseDefault__(view, string, length, ...)
307 (GblStringView_endsWithIgnoreCase)(view, string, length)
308
309#define GblStringView_find(...)
310 GblStringView_findDefault_(__VA_ARGS__)
311#define GblStringView_findDefault_(...)
312 GblStringView_findDefault__(__VA_ARGS__, 0, 0)
313#define GblStringView_findDefault__(view, string, length, offset, ...)
314 (GblStringView_find)(view, string, length, offset)
315
316#define GblStringView_findIgnoreCase(...)
317 GblStringView_findIgnoreCaseDefault_(__VA_ARGS__)
318#define GblStringView_findIgnoreCaseDefault_(...)
319 GblStringView_findIgnoreCaseDefault__(__VA_ARGS__, 0, 0)
320#define GblStringView_findIgnoreCaseDefault__(view, string, length, offset, ...)
321 (GblStringView_findIgnoreCase)(view, string, length, offset)
322
323#define GblStringView_rfind(...)
324 GBL_VA_OVERLOAD_CALL_ARGC(GblStringView_rfind, __VA_ARGS__)
325#define GblStringView_rfind_2(view, str)
326 GblStringView_rfind_3(view, str, 0)
327#define GblStringView_rfind_3(view, str, len)
328 GblStringView_rfind_4(view, str, len, GBL_STRING_VIEW_NPOS)
329#define GblStringView_rfind_4(view, str, len, offset)
330 (GblStringView_rfind)(view, str, len, offset)
331
332#define GblStringView_rfindIgnoreCase(...)
333 GBL_VA_OVERLOAD_CALL_ARGC(GblStringView_rfindIgnoreCase, __VA_ARGS__)
334#define GblStringView_rfindIgnoreCase_2(view, str)
335 GblStringView_rfindIgnoreCase_3(view, str, 0)
336#define GblStringView_rfindIgnoreCase_3(view, str, len)
337 GblStringView_rfindIgnoreCase_4(view, str, len, GBL_STRING_VIEW_NPOS)
338#define GblStringView_rfindIgnoreCase_4(view, str, len, offset)
339 (GblStringView_rfindIgnoreCase)(view, str, len, offset)
340
341#define GblStringView_findFirstOf(...)
342 GblStringView_findFirstOfDefault_(__VA_ARGS__)
343#define GblStringView_findFirstOfDefault_(...)
344 GblStringView_findFirstOfDefault__(__VA_ARGS__, 0, 0)
345#define GblStringView_findFirstOfDefault__(view, string, length, offset, ...)
346 (GblStringView_findFirstOf)(view, string, length, offset)
347
348#define GblStringView_findFirstNotOf(...)
349 GblStringView_findFirstNotOfDefault_(__VA_ARGS__)
350#define GblStringView_findFirstNotOfDefault_(...)
351 GblStringView_findFirstNotOfDefault__(__VA_ARGS__, 0, 0)
352#define GblStringView_findFirstNotOfDefault__(view, string, length, offset, ...)
353 (GblStringView_findFirstNotOf)(view, string, length, offset)
354
355#define GblStringView_findLastOf(...)
356 GBL_VA_OVERLOAD_CALL_ARGC(GblStringView_findLastOf, __VA_ARGS__)
357#define GblStringView_findLastOf_2(view, str)
358 GblStringView_findLastOf_3(view, str, 0)
359#define GblStringView_findLastOf_3(view, str, len)
360 GblStringView_findLastOf_4(view, str, len, GBL_STRING_VIEW_NPOS)
361#define GblStringView_findLastOf_4(view, str, len, offset)
362 (GblStringView_findLastOf)(view, str, len, offset)
363
364#define GblStringView_findLastNotOf(...)
365 GBL_VA_OVERLOAD_CALL_ARGC(GblStringView_findLastNotOf, __VA_ARGS__)
366#define GblStringView_findLastNotOf_2(view, str)
367 GblStringView_findLastNotOf_3(view, str, 0)
368#define GblStringView_findLastNotOf_3(view, str, len)
369 GblStringView_findLastNotOf_4(view, str, len, GBL_STRING_VIEW_NPOS)
370#define GblStringView_findLastNotOf_4(view, str, len, offset)
371 (GblStringView_findLastNotOf)(view, str, len, offset)
372
373#define GblStringView_toBool(...)
374 GblStringView_toBoolDefault_(__VA_ARGS__)
375#define GblStringView_toBoolDefault_(...)
376 GblStringView_toBoolDefault__(__VA_ARGS__, NULL)
377#define GblStringView_toBoolDefault__(self, success, ...)
378 ((GblStringView_toBool)(self, success))
379
380#define GblStringView_toChar(...)
381 GblStringView_toCharDefault_(__VA_ARGS__)
382#define GblStringView_toCharDefault_(...)
383 GblStringView_toCharDefault__(__VA_ARGS__, NULL)
384#define GblStringView_toCharDefault__(self, success, ...)
385 ((GblStringView_toChar)(self, success))
386
387#define GblStringView_toUint8(...)
388 GblStringView_toUint8Default_(__VA_ARGS__)
389#define GblStringView_toUint8Default_(...)
390 GblStringView_toUint8Default__(__VA_ARGS__, NULL)
391#define GblStringView_toUint8Default__(self, success, ...)
392 ((GblStringView_toUint8)(self, success))
393
394#define GblStringView_toUint16(...)
395 GblStringView_toUint16Default_(__VA_ARGS__)
396#define GblStringView_toUint16Default_(...)
397 GblStringView_toUint16Default__(__VA_ARGS__, NULL)
398#define GblStringView_toUint16Default__(self, success, ...)
399 ((GblStringView_toUint16)(self, success))
400
401#define GblStringView_toInt16(...)
402 GblStringView_toInt16Default_(__VA_ARGS__)
403#define GblStringView_toInt16Default_(...)
404 GblStringView_toInt16Default__(__VA_ARGS__, NULL)
405#define GblStringView_toInt16Default__(self, success, ...)
406 ((GblStringView_toInt16)(self, success))
407
408#define GblStringView_toUint32(...)
409 GblStringView_toUint32Default_(__VA_ARGS__)
410#define GblStringView_toUint32Default_(...)
411 GblStringView_toUint32Default__(__VA_ARGS__, NULL)
412#define GblStringView_toUint32Default__(self, success, ...)
413 ((GblStringView_toUint32)(self, success))
414
415#define GblStringView_toInt32(...)
416 GblStringView_toInt32Default_(__VA_ARGS__)
417#define GblStringView_toInt32Default_(...)
418 GblStringView_toInt32Default__(__VA_ARGS__, NULL)
419#define GblStringView_toInt32Default__(self, success, ...)
420 ((GblStringView_toInt32)(self, success))
421
422#define GblStringView_toUint64(...)
423 GblStringView_toUint64Default_(__VA_ARGS__)
424#define GblStringView_toUint64Default_(...)
425 GblStringView_toUint64Default__(__VA_ARGS__, NULL)
426#define GblStringView_toUint64Default__(self, success, ...)
427 ((GblStringView_toUint64)(self, success))
428
429#define GblStringView_toInt64(...)
430 GblStringView_toInt64Default_(__VA_ARGS__)
431#define GblStringView_toInt64Default_(...)
432 GblStringView_toInt64Default__(__VA_ARGS__, NULL)
433#define GblStringView_toInt64Default__(self, success, ...)
434 ((GblStringView_toInt64)(self, success))
435
436#define GblStringView_toFloat(...)
437 GblStringView_toFloatDefault_(__VA_ARGS__)
438#define GblStringView_toFloatDefault_(...)
439 GblStringView_toFloatDefault__(__VA_ARGS__, NULL)
440#define GblStringView_toFloatDefault__(self, success, ...)
441 ((GblStringView_toFloat)(self, success))
442
443#define GblStringView_toDouble(...)
444 GblStringView_toDoubleDefault_(__VA_ARGS__)
445#define GblStringView_toDoubleDefault_(...)
446 GblStringView_toDoubleDefault__(__VA_ARGS__, NULL)
447#define GblStringView_toDoubleDefault__(self, success, ...)
448 ((GblStringView_toDouble)(self, success))
449
450#define GblStringView_toPointer(...)
451 GblStringView_toPointerDefault_(__VA_ARGS__)
452#define GblStringView_toPointerDefault_(...)
453 GblStringView_toPointerDefault__(__VA_ARGS__, NULL)
454#define GblStringView_toPointerDefault__(self, success, ...)
455 ((GblStringView_toPointer)(self, success))
456//! \endcond
457
458#undef GBL_SELF_TYPE
459
460#endif // GIMBAL_STRING_VIEW_H
#define GBL_NOEXCEPT
#define GBL_ALLOCA
#define GBL_DECLS_BEGIN
#define GBL_EXPORT
#define GBL_VSELF
#define GBL_VA_OVERLOAD_CALL_ARGC(BASE,...)
#define GBL_BIT_FIELDS(...)
Used to declare an endian-independent group of bitfields.
#define GBL_STRING_VIEW_NPOS
Constant value used to signify the last position or an invalid position in a GblStringView.
#define GBL_STRING_VIEW_CSTR_ALLOCA(view)
Convenience macro for creating a NULL-terminated C string from a GblStringView on the stack,...
uint32_t GblHash
Type representing a calculated numeric hash across the codebase.
uint8_t GblBool
Basic boolean type, standardized to sizeof(char)
#define GBL_NPOS
uintptr_t GblQuark
Uniquely identifiable interned string type.
Immutable substring type.
const char * pData
Start address of the string being viewed.