libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
|
#include <gimbal_string_view.h>
Data Fields | |
const char * | pData |
size_t | nullTerminated: 1 |
size_t | length: 63 |
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.
|
related |
Constructs an empty GblStringView (same as zero initializing one)
|
related |
Constructs a GblStringView from a(n optionally sized) character array.
|
related |
Constructs a GblStringView from an existing GblQuark, or creating an empty view if it's invalid.
|
related |
Lexicographically compares the given view to pString
, returning a positive or negative for inequality or 0 if equal.
|
related |
Lexicographically compares the given view to pString
, ignoring case, returning a positive or negative for inequality or 0 if equal.
|
related |
Returns GBL_TRUE if the given string view equals pString
or returns GBL_FALSE otherwise.
|
related |
Returns GBL_TRUE if the given string view equals pString
(ignoring casing on both operands) or returns GBL_FALSE otherwise.
|
related |
Returns the character within the given view at index
, raising an error if it is out-of-range.
|
related |
Returns the first character within the given view, raising an error if the view is empty.
|
related |
Returns the last character within the given view, raising an error if the view is empty.
|
related |
Copies an arbitrary substring within teh view into the external buffer, pDst
of size bytes
starting at offset
.
|
related |
! Returns a new GblStringView which has had the first length
characters chopped off, raising an error upon failure
|
related |
Returns a new GblStringView which has the last length
characters chopped off, raising an error upon failure.
|
related |
Returns a new GblStringView which has any terminating newline characters (linux + windows) chopped off.
|
related |
Retruns a new GblStringView as a subview of the given GblStringView, starting at offset
of size length
.
|
related |
Returns GBL_TRUE if the given GblStringView contains the substring, pString
, otherwise returning GBL_FALSE if not found.
|
related |
Returns GBL_TRUE if the given GblStringView contains the substring, pString
, (ignoring case) otherwise returning GBL_FALSE if not found.
|
related |
Returns the number of times the substring, pString
, appears within the given GblStringView.
|
related |
Returns the number of times the substring, pString
, appears within the given GblStringView, ignoring casing.
|
related |
Returns the starting index of the first occurrence of pStr
appearing as a substring within the given GblStringView after offset
.
|
related |
Returns the starting index of the first occurrence of pStr
appearing as a substring within the given GblStringView after offset
(ignoring casing)
|
related |
Returns the starting index of the last occurrence of pStr
appearing as a substring within the given GblStringView before offset
.
|
related |
Returns the starting index of the last occurrence of pStr
appearing as a substring within the given GblStringView before offset
(ignoring case)
|
related |
Returns GBL_TRUE if the given GblStringView starts with the substring given by pString
, otherwise returning GBL_FALSE.
|
related |
Returns GBL_TRUE if the given GblStringView starts with the substring given by pString
(ignoring casing), otherwise returning GBL_FALSE.
|
related |
Returns GBL_TRUE if the given GblStringView ends with the substring given by pString
, otherwise returning GBL_FALSE.
|
related |
Returns GBL_TRUE if the given GblStringView ends with the substring given by pString
(ignoring casing), otherwise returning GBL_FALSE.
|
related |
Returns the index of the first occurrence of one of the characters provided within pChars
, starting at offset
.
|
related |
Returns the index of the last occurrence of one of the characters provided within pChars
, ending at offset
.
|
related |
Returns the index of the first occurrence of a character NOT provided within pChars
, starting at offset
.
|
related |
Returns the index of the last occurrence of a character NOT provided within pChars
, ending at offset
.
|
related |
Returns GBL_TRUE if the given GblStringView is empty, otherwise returning GBL_FALSE.
|
related |
Returns GBL_TRUE if the given GblStringView contains only whitespace characters (spaces, tabs, newlines)
|
related |
Returns the GblHash for the given GblStringView, using the default libGimbal hashing algorithm.
|
related |
Creates and returns a GblQuark interned string representation from the given GblStringView.
|
related |
Attempts to return the GblQuark corresponding to the given GblStringView, retruning GBL_QUARK_INVALID if there isn't one.
|
related |
Interns (creates a GblQuark) from the given GblStringView, returning its C string representation.
|
related |
Duplicates the given GblStringView as a heap-allocated NULL-terminated C string and returns it. Don't forget to free it!
|
related |
Calls libC's sscanf()
using the given GblStringView as the source buffer.
|
related |
Calls libC's vsscanf()
using the given GblStringView as the source buffer.
|
related |
Converts the given GblStringView to a NULL-terminated C string, copying it to the pDest
buffer of destSize
capacity.
|
related |
Converts the given GblStringView to NIL (returns GBL_TRUE if it's empty or matches "nil")
|
related |
Converts the given GblStringView to a boolean value, optionally returning whether the conversion succeeded or not.
|
related |
Converts the given GblStringView to a char value, optionally returning whether the conversion succeeded or not.
|
related |
Converts the given GblStringView to a uint8_t value, optionally returning whether the conversion succeeded or not.
|
related |
Converts the given GblStringView to a uint16_t value, optionally returning whether the conversion succeeded or not.
|
related |
Converts the given GblStringView to an int16_t value, optionally returning whether the conversion succeeded or not.
|
related |
Converts the given GblStringView to a uint32_t value, optionally returning whether the conversion succeeded or not.
|
related |
Converts the given GblStringView to an int32_t value, optionally returning whether the conversion succeeded or not.
|
related |
Converts the given GblStringView to a uint64_t value, optionally returning whether the conversion succeeded or not.
|
related |
Converts the given GblStringView to an int64_t value, optionally returning whether the conversion succeeded or not.
|
related |
Converts the given GblStringView to a float value, optionally returning whether the conversion succeeded or not.
|
related |
Converts the given GblStringView to a double value, optionally returning whether the conversion succeeded or not.
|
related |
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.
size_t GblStringView::nullTerminated |
Reserved bit for maintaining whether the string is NULL terminated or not.
Definition at line 59 of file gimbal_string_view.h.
size_t GblStringView::length |
Length (bytes) of the substring being viewed.
Definition at line 61 of file gimbal_string_view.h.