|
libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
|
#include <gimbal_string_view.h>

Public Member Functions | |
| GBL_TUPLE_FOREACH__GBL_NARG | GBL_BIT_FIELDS_ENDIAN_XFORM_ (size_t nullTerminated :1, size_t length :sizeof(size_t) *8 - 1)(GBL_BIT_FIELDS_ENTRY_ |
Data Fields | |
| const char * | pData |
| GBL_TUPLE_FOREACH__GBL_NARG | GBL_PHONY |
Related Symbols | |
(Note that these are not member symbols.) | |
Construction | |
Methods for constructing a new view | |
| GblStringView | GblStringView_fromEmpty (void) |
| GblStringView | GblStringView_fromString (const char *pString, size_t length) |
| GblStringView | GblStringView_fromQuark (GblQuark quark) |
Comparisons | |
Methods providing string view comparison operators | |
| int | GblStringView_compare (GblStringView self, const char *pString, size_t len) |
| int | GblStringView_compareIgnoreCase (GblStringView self, const char *pString, size_t len) |
| GblBool | GblStringView_equals (GblStringView self, const char *pString, size_t len) |
| GblBool | GblStringView_equalsIgnoreCase (GblStringView self, const char *pString, size_t len) |
Reading | |
Methods for retrieving characters and substrings | |
| char | GblStringView_at (GblStringView self, size_t index) |
| char | GblStringView_first (GblStringView self) |
| char | GblStringView_last (GblStringView self) |
| GBL_RESULT | GblStringView_copy (GblStringView self, void *pDst, size_t offset, size_t bytes) |
Trimming | |
Methods for creating substrings | |
| GblStringView | GblStringView_removePrefix (GblStringView self, size_t length) |
| GblStringView | GblStringView_removeSuffix (GblStringView self, size_t length) |
| GblStringView | GblStringView_chomp (GblStringView self) |
| GblStringView | GblStringView_substr (GblStringView self, size_t offset, size_t length) |
Searching | |
Methods for finding, counting, and matching | |
| GblBool | GblStringView_contains (GblStringView self, const char *pString, size_t len) |
| GblBool | GblStringView_containsIgnoreCase (GblStringView self, const char *pString, size_t len) |
| size_t | GblStringView_count (GblStringView self, const char *pString, size_t len) |
| size_t | GblStringView_countIgnoreCase (GblStringView self, const char *pString, size_t len) |
| size_t | GblStringView_find (GblStringView self, const char *pStr, size_t len, size_t offset) |
| size_t | GblStringView_findIgnoreCase (GblStringView self, const char *pStr, size_t len, size_t offset) |
| size_t | GblStringView_rfind (GblStringView self, const char *pStr, size_t len, size_t offset) |
| size_t | GblStringView_rfindIgnoreCase (GblStringView self, const char *pStr, size_t len, size_t offset) |
| GblBool | GblStringView_startsWith (GblStringView self, const char *pString, size_t len) |
| GblBool | GblStringView_startsWithIgnoreCase (GblStringView self, const char *pString, size_t len) |
| GblBool | GblStringView_endsWith (GblStringView self, const char *pString, size_t len) |
| GblBool | GblStringView_endsWithIgnoreCase (GblStringView self, const char *pString, size_t len) |
| size_t | GblStringView_findFirstOf (GblStringView self, const char *pChars, size_t len, size_t offset) |
| size_t | GblStringView_findLastOf (GblStringView self, const char *pChars, size_t len, size_t offset) |
| size_t | GblStringView_findFirstNotOf (GblStringView self, const char *pChars, size_t len, size_t offset) |
| size_t | GblStringView_findLastNotOf (GblStringView self, const char *pChars, size_t len, size_t offset) |
Utilities | |
Methods providing miscellaneous functionality | |
| GblBool | GblStringView_empty (GblStringView self) |
| GblBool | GblStringView_blank (GblStringView self) |
| GblHash | GblStringView_hash (GblStringView self) |
| GblQuark | GblStringView_quark (GblStringView self) |
| GblQuark | GblStringView_tryQuark (GblStringView self) |
| const char * | GblStringView_intern (GblStringView self) |
| char * | GblStringView_strdup (GblStringView self) |
| int | GblStringView_scanf (GblStringView self, const char *pFmt,...) |
| int | GblStringView_scanfVa (GblStringView self, const char *pFmt, va_list *pVarArgs) |
Converting | |
Methods providing conversion operators from string views | |
| char * | GblStringView_toCString (GblStringView self, char *pDest, size_t destSize) |
| GblBool | GblStringView_toNil (GblStringView self) |
| GblBool | GblStringView_toBool (GblStringView self, GblBool *pSuccess) |
| char | GblStringView_toChar (GblStringView self, GblBool *pSuccess) |
| uint8_t | GblStringView_toUint8 (GblStringView self, GblBool *pSuccess) |
| uint16_t | GblStringView_toUint16 (GblStringView self, GblBool *pSuccess) |
| int16_t | GblStringView_toInt16 (GblStringView self, GblBool *pSuccess) |
| uint32_t | GblStringView_toUint32 (GblStringView self, GblBool *pSuccess) |
| int32_t | GblStringView_toInt32 (GblStringView self, GblBool *pSuccess) |
| uint64_t | GblStringView_toUint64 (GblStringView self, GblBool *pSuccess) |
| int64_t | GblStringView_toInt64 (GblStringView self, GblBool *pSuccess) |
| float | GblStringView_toFloat (GblStringView self, GblBool *pSuccess) |
| double | GblStringView_toDouble (GblStringView self, GblBool *pSuccess) |
| void * | GblStringView_toPointer (GblStringView self, GblBool *pSuccess) |
Immutable substring type.
Represents an externally owned slice or "view" into a region of a string, storing its start address and length. NULL termination is not required, so a string view cannot be assumed to be a well-formed standalone C string.
Definition at line 57 of file gimbal_string_view.h.
| GBL_TUPLE_FOREACH__GBL_NARG GblStringView::GBL_BIT_FIELDS_ENDIAN_XFORM_ | ( | size_t nullTerminated :1 | , |
| size_t length :sizeof(size_t) *8 - | 1 ) |
| 1 | Length of the string in bytes |
|
Constructs an empty GblStringView (same as zero initializing one)
|
Constructs a GblStringView from a(n optionally sized) character array.
|
Constructs a GblStringView from an existing GblQuark, or creating an empty view if it's invalid.
|
Lexicographically compares the given view to pString, returning a positive or negative for inequality or 0 if equal.
|
Lexicographically compares the given view to pString, ignoring case, returning a positive or negative for inequality or 0 if equal.
|
Returns GBL_TRUE if the given string view equals pString or returns GBL_FALSE otherwise.
|
Returns GBL_TRUE if the given string view equals pString (ignoring casing on both operands) or returns GBL_FALSE otherwise.
|
Returns the character within the given view at index, raising an error if it is out-of-range.
|
Returns the first character within the given view, raising an error if the view is empty.
|
Returns the last character within the given view, raising an error if the view is empty.
|
Copies an arbitrary substring within teh view into the external buffer, pDst of size bytes starting at offset.
|
! Returns a new GblStringView which has had the first length characters chopped off, raising an error upon failure
|
Returns a new GblStringView which has the last length characters chopped off, raising an error upon failure.
|
Returns a new GblStringView which has any terminating newline characters (linux + windows) chopped off.
|
Retruns a new GblStringView as a subview of the given GblStringView, starting at offset of size length.
|
Returns GBL_TRUE if the given GblStringView contains the substring, pString, otherwise returning GBL_FALSE if not found.
|
Returns GBL_TRUE if the given GblStringView contains the substring, pString, (ignoring case) otherwise returning GBL_FALSE if not found.
|
Returns the number of times the substring, pString, appears within the given GblStringView.
|
Returns the number of times the substring, pString, appears within the given GblStringView, ignoring casing.
|
Returns the starting index of the first occurrence of pStr appearing as a substring within the given GblStringView after offset.
|
Returns the starting index of the first occurrence of pStr appearing as a substring within the given GblStringView after offset (ignoring casing)
|
Returns the starting index of the last occurrence of pStr appearing as a substring within the given GblStringView before offset.
|
Returns the starting index of the last occurrence of pStr appearing as a substring within the given GblStringView before offset (ignoring case)
|
Returns GBL_TRUE if the given GblStringView starts with the substring given by pString, otherwise returning GBL_FALSE.
|
Returns GBL_TRUE if the given GblStringView starts with the substring given by pString (ignoring casing), otherwise returning GBL_FALSE.
|
Returns GBL_TRUE if the given GblStringView ends with the substring given by pString, otherwise returning GBL_FALSE.
|
Returns GBL_TRUE if the given GblStringView ends with the substring given by pString (ignoring casing), otherwise returning GBL_FALSE.
|
Returns the index of the first occurrence of one of the characters provided within pChars, starting at offset.
|
Returns the index of the last occurrence of one of the characters provided within pChars, ending at offset.
|
Returns the index of the first occurrence of a character NOT provided within pChars, starting at offset.
|
Returns the index of the last occurrence of a character NOT provided within pChars, ending at offset.
|
Returns GBL_TRUE if the given GblStringView is empty, otherwise returning GBL_FALSE.
|
Returns GBL_TRUE if the given GblStringView contains only whitespace characters (spaces, tabs, newlines)
|
Returns the GblHash for the given GblStringView, using the default libGimbal hashing algorithm.
|
Creates and returns a GblQuark interned string representation from the given GblStringView.
|
Attempts to return the GblQuark corresponding to the given GblStringView, retruning GBL_QUARK_INVALID if there isn't one.
|
Interns (creates a GblQuark) from the given GblStringView, returning its C string representation.
|
Duplicates the given GblStringView as a heap-allocated NULL-terminated C string and returns it. Don't forget to free it!
|
Calls libC's sscanf() using the given GblStringView as the source buffer.
|
Calls libC's vsscanf() using the given GblStringView as the source buffer.
|
Converts the given GblStringView to a NULL-terminated C string, copying it to the pDest buffer of destSize capacity.
|
Converts the given GblStringView to NIL (returns GBL_TRUE if it's empty or matches "nil")
|
Converts the given GblStringView to a boolean value, optionally returning whether the conversion succeeded or not.
|
Converts the given GblStringView to a char value, optionally returning whether the conversion succeeded or not.
|
Converts the given GblStringView to a uint8_t value, optionally returning whether the conversion succeeded or not.
|
Converts the given GblStringView to a uint16_t value, optionally returning whether the conversion succeeded or not.
|
Converts the given GblStringView to an int16_t value, optionally returning whether the conversion succeeded or not.
|
Converts the given GblStringView to a uint32_t value, optionally returning whether the conversion succeeded or not.
|
Converts the given GblStringView to an int32_t value, optionally returning whether the conversion succeeded or not.
|
Converts the given GblStringView to a uint64_t value, optionally returning whether the conversion succeeded or not.
|
Converts the given GblStringView to an int64_t value, optionally returning whether the conversion succeeded or not.
|
Converts the given GblStringView to a float value, optionally returning whether the conversion succeeded or not.
|
Converts the given GblStringView to a double value, optionally returning whether the conversion succeeded or not.
|
Converts the given GblStringView to a pointer value, optionally returning whether the conversion succeeded or not.
| const char* GblStringView::pData |
Start address of the string being viewed.
Definition at line 58 of file gimbal_string_view.h.
| GBL_TUPLE_FOREACH__GBL_NARG GblStringView::GBL_PHONY |
Definition at line 62 of file gimbal_string_view.h.