module
CnxStringViewA CnxStringView
is a "view" into a CnxString
. It allows you to lazily inspect the contents of its associated string, but not modify them. It is effectively a fat reference to the contents of its associated string.
Classes
- struct CnxStringView
- Cnx stringview type. A stringview is a "view" into a
CnxString
. It allows you to lazily inspect the contents of the string, but not modify them. It is effectively a fat pointer into the contents of the associatedCnxString
- struct CnxStringViewIterator
- Cnx stringview const iterator storage type
CnxStringViewIterator
is the underlying storage type used byCnxStringView
for its const iterator type (CnxRandomAccessIterator(const_
)char_ ptr)
Typedefs
-
using cnx_stringview_vtable_t = struct cnx_
stringview_ vtable_ t - The function vector table of methods associated with
CnxStringView
- using CnxStringView = struct CnxStringView
- Cnx stringview type. A stringview is a "view" into a
CnxString
. It allows you to lazily inspect the contents of the string, but not modify them. It is effectively a fat pointer into the contents of the associatedCnxString
- using CnxStringViewIterator = struct CnxStringViewIterator
- Cnx stringview const iterator storage type
CnxStringViewIterator
is the underlying storage type used byCnxStringView
for its const iterator type (CnxRandomAccessIterator(const_
)char_ ptr)
Functions
- CnxStringView cnx_stringview_new(const CnxString*restrict string)
- Returns a new
CnxStringView
into the givenCnxString
-
CnxStringView cnx_stringview_from(restrict const_
cstring string, usize index, usize length) cnx_disable_if(!string - Returns a new
CnxStringView
into the given cstring. -
const_
char_ ptr cnx_stringview_at(const CnxStringView*restrict self, usize index) - Returns the character in the view located at the given index.
- usize cnx_stringview_length(const CnxStringView*restrict self)
- Returns the length of the
CnxStringView
- usize cnx_stringview_size(const CnxStringView*restrict self)
- Returns the size of the
CnxStringView
- bool cnx_stringview_equal(const CnxStringView*restrict self, const CnxStringView*restrict to_compare) cnx_disable_if(!to_compare
- Returns whether the given
CnxStringView
s are equivalent. - bool cnx_stringview_equal_string(const CnxStringView*restrict self, const CnxString*restrict to_compare) cnx_disable_if(!to_compare
- Returns whether the given
CnxStringView
s are equivalent. -
bool cnx_stringview_equal_cstring(const CnxStringView*restrict self,
restrict const_
cstring to_compare, usize to_compare_length) cnx_disable_if(!to_compare - Returns whether the given
CnxStringView
is equivalent to the givencstring
-
const_
cstring cnx_stringview_into_cstring(const CnxStringView*restrict self) - Returns a
const_cstring
(const char*
) representation of theCnxStringView
- CnxRandomAccessIteratorconst_char_ref cnx_stringview_begin(const CnxStringView*restrict self)
- Returns a
CnxRandomAccessIterator(const_
into the givenchar_ ref) CnxStringView
, at the beginning of the iteration (pointing at the beginning of the view) - CnxRandomAccessIteratorconst_char_ref cnx_stringview_end(const CnxStringView*restrict self)
- Returns a
CnxRandomAccessIterator(const_
into the givenchar_ ref) CnxStringView
, at the end of the iteration (pointing at the end of the view) - CnxRandomAccessIteratorconst_char_ref cnx_stringview_rbegin(const CnxStringView*restrict self)
- Returns a
CnxRandomAccessIterator(const_
into the givenchar_ ref) CnxStringView
in reverse, at the beginning of the iteration (pointing at the end of the view) - CnxRandomAccessIteratorconst_char_ref cnx_stringview_rend(const CnxStringView*restrict self)
- Returns a
CnxRandomAccessIterator(const_
into the givenchar_ ref) CnxStringView
in reverse, at the end of the iteration (pointing at the beginning of the view)
Defines
- #define cnx_stringview_at(self, index)
- Returns a const reference to the character at
index
in the givenCnxStringView
- #define cnx_stringview_length(self)
- Returns the current length of the given
CnxStringView
- #define cnx_stringview_size(self)
- Returns the current size of the given
CnxStringView
- #define cnx_stringview_equal(self, to_compare)
- Returns whether the given
CnxStringView
s are equivalent. - #define cnx_stringview_into_cstring(self)
- Returns the
cstring
view of the givenCnxStringView
- #define cnx_stringview_begin(self)
- Returns a
CnxRandomAccessIterator(const_
into the givenchar_ ref) CnxStringView
, at the beginning of the iteration (pointing at the beginning of the view) - #define cnx_stringview_end(self)
- Returns a
CnxRandomAccessIterator(const_
into the givenchar_ ref) CnxStringView
, at the end of the iteration (pointing at the end of the view) - #define cnx_stringview_rbegin(self)
- Returns a
CnxRandomAccessIterator(const_
into the givenchar_ ref) CnxStringView
, at the beginning of the reversed iteration (pointing at the end of the view) - #define cnx_stringview_rend(self)
- Returns a
CnxRandomAccessIterator(const_
into the givenchar_ ref) CnxStringView
, at the end of the reversed iteration (pointing at the beginning of the view) - #define cnx_stringview_cbegin(self)
- Returns a
CnxRandomAccessIterator(const_
into the givenchar_ ref) CnxStringView
, at the beginning of the iteration (pointing at the beginning of the view) - #define cnx_stringview_cend(self)
- Returns a
CnxRandomAccessIterator(const_
into the givenchar_ ref) CnxStringView
, at the end of the iteration (pointing at the end of the view) - #define cnx_stringview_crbegin(self)
- Returns a
CnxRandomAccessIterator(const_
into the givenchar_ ref) CnxStringView
, at the beginning of the reversed iteration (pointing at the end of the view) - #define cnx_stringview_crend(self)
- Returns a
CnxRandomAccessIterator(const_
into the givenchar_ ref) CnxStringView
, at the end of the reversed iteration (pointing at the beginning of the view)
Typedef documentation
typedef struct cnx_ stringview_ vtable_ t cnx_stringview_vtable_t
#include <include/Cnx/String.h>
The function vector table of methods associated with CnxStringView
typedef struct CnxStringView CnxStringView
#include <include/Cnx/String.h>
Cnx stringview type. A stringview is a "view" into a CnxString
. It allows you to lazily inspect the contents of the string, but not modify them. It is effectively a fat pointer into the contents of the associated CnxString
typedef struct CnxStringViewIterator CnxStringViewIterator
#include <include/Cnx/String.h>
Cnx stringview const iterator storage type CnxStringViewIterator
is the underlying storage type used by CnxStringView
for its const iterator type (CnxRandomAccessIterator(const_
)
Function documentation
CnxStringView cnx_stringview_new(const CnxString*restrict string)
#include <include/Cnx/String.h>
Returns a new CnxStringView
into the given CnxString
Parameters | |
---|---|
string | - The CnxString to get the view of |
Returns | a CnxStringView into the given string |
CnxStringView cnx_stringview_from(restrict const_ cstring string,
usize index,
usize length) cnx_disable_if(!string
#include <include/Cnx/String.h>
Returns a new CnxStringView
into the given cstring.
Parameters | |
---|---|
string | - The cstring to get the view of |
index | - The index to begin the view at |
length | - The length of the view |
Returns | a CnxStringView into the given string |
const_ char_ ptr cnx_stringview_at(const CnxStringView*restrict self,
usize index)
#include <include/Cnx/String.h>
Returns the character in the view located at the given index.
Parameters | |
---|---|
self | - The CnxStringView to retrieve a character from |
index | - The index of the character to get |
Returns | the character at index |
usize cnx_stringview_length(const CnxStringView*restrict self)
#include <include/Cnx/String.h>
Returns the length of the CnxStringView
Parameters | |
---|---|
self | - The CnxStringView to get the length of |
Returns | the length of the stringview |
usize cnx_stringview_size(const CnxStringView*restrict self)
#include <include/Cnx/String.h>
Returns the size of the CnxStringView
Parameters | |
---|---|
self | - The CnxStringView to get the size of |
Returns | the size of the stringview |
bool cnx_stringview_equal(const CnxStringView*restrict self,
const CnxStringView*restrict to_compare) cnx_disable_if(!to_compare
#include <include/Cnx/String.h>
Returns whether the given CnxStringView
s are equivalent.
Parameters | |
---|---|
self | - The first CnxStringView to compare |
to_compare | - The CnxStringView to compare to |
Returns | whether the stringviews are equal |
bool cnx_stringview_equal_string(const CnxStringView*restrict self,
const CnxString*restrict to_compare) cnx_disable_if(!to_compare
#include <include/Cnx/String.h>
Returns whether the given CnxStringView
s are equivalent.
Parameters | |
---|---|
self | - The first CnxStringView to compare |
to_compare | - The CnxStringView to compare to |
Returns | whether the stringviews are equal |
bool cnx_stringview_equal_cstring(const CnxStringView*restrict self,
restrict const_ cstring to_compare,
usize to_compare_length) cnx_disable_if(!to_compare
#include <include/Cnx/String.h>
Returns whether the given CnxStringView
is equivalent to the given cstring
Parameters | |
---|---|
self | - The first CnxStringView to compare |
to_compare | - The cstring to compare to |
to_compare_length | - The length of the cstring |
Returns | whether self is equalivalent to the given cstring |
const_ cstring cnx_stringview_into_cstring(const CnxStringView*restrict self)
#include <include/Cnx/String.h>
Returns a const_cstring
(const char*
) representation of the CnxStringView
Parameters | |
---|---|
self | - The CnxStringView to get the const_cstring representation of |
Returns | the const_cstring representation of the stringview |
CnxRandomAccessIteratorconst_char_ref cnx_stringview_begin(const CnxStringView*restrict self)
#include <include/Cnx/String.h>
Returns a CnxRandomAccessIterator(const_
into the given CnxStringView
, at the beginning of the iteration (pointing at the beginning of the view)
Parameters | |
---|---|
self | - The CnxStringView to get an iterator into |
Returns | an iterator at the beginning of the iteration (pointing at the beginning of the view) |
CnxRandomAccessIteratorconst_char_ref cnx_stringview_end(const CnxStringView*restrict self)
#include <include/Cnx/String.h>
Returns a CnxRandomAccessIterator(const_
into the given CnxStringView
, at the end of the iteration (pointing at the end of the view)
Parameters | |
---|---|
self | - The CnxStringView to get an iterator into |
Returns | an iterator at the end of the iteration (pointing at the end of the view) |
CnxRandomAccessIteratorconst_char_ref cnx_stringview_rbegin(const CnxStringView*restrict self)
#include <include/Cnx/String.h>
Returns a CnxRandomAccessIterator(const_
into the given CnxStringView
in reverse, at the beginning of the iteration (pointing at the end of the view)
Parameters | |
---|---|
self | - The CnxStringView to get an iterator into |
Returns | an iterator at the beginning of the reverse iteration (pointing at the end of the view) |
CnxRandomAccessIteratorconst_char_ref cnx_stringview_rend(const CnxStringView*restrict self)
#include <include/Cnx/String.h>
Returns a CnxRandomAccessIterator(const_
into the given CnxStringView
in reverse, at the end of the iteration (pointing at the beginning of the view)
Parameters | |
---|---|
self | - The CnxStringView to get an iterator into |
Returns | an iterator at the end of the reverse iteration (pointing at the beginning of the view) |
Define documentation
#define cnx_stringview_at(self,
index)
#include <include/Cnx/String.h>
Returns a const reference to the character at index
in the given CnxStringView
Parameters | |
---|---|
self | - The CnxStringView to get a character from |
index | - The index of the desired character in self |
Returns | a const reference to the character at index in `self |
#define cnx_stringview_length(self)
#include <include/Cnx/String.h>
Returns the current length of the given CnxStringView
Parameters | |
---|---|
self | - The CnxStringView to get the length of |
Returns | the length of self |
#define cnx_stringview_size(self)
#include <include/Cnx/String.h>
Returns the current size of the given CnxStringView
Parameters | |
---|---|
self | - The CnxStringView to get the size of |
Returns | the size of self |
#define cnx_stringview_equal(self,
to_compare)
#include <include/Cnx/String.h>
Returns whether the given CnxStringView
s are equivalent.
Parameters | |
---|---|
self | - The first CnxStringView to compare |
to_compare | - The CnxStringView to compare to |
Returns | whether the stringviews are equal |
#define cnx_stringview_into_cstring(self)
#include <include/Cnx/String.h>
Returns the cstring
view of the given CnxStringView
Parameters | |
---|---|
self | - The CnxStringView to get the cstring view of |
Returns | self as a cstring |
#define cnx_stringview_begin(self)
#include <include/Cnx/String.h>
Returns a CnxRandomAccessIterator(const_
into the given CnxStringView
, at the beginning of the iteration (pointing at the beginning of the view)
Parameters | |
---|---|
self | - The CnxStringView to get an iterator into |
Returns | an iterator at the beginning of the iteration (pointing at the beginning of the view) |
#define cnx_stringview_end(self)
#include <include/Cnx/String.h>
Returns a CnxRandomAccessIterator(const_
into the given CnxStringView
, at the end of the iteration (pointing at the end of the view)
Parameters | |
---|---|
self | - The CnxStringView to get an iterator into |
Returns | an iterator at the end of the iteration (pointing at the end of the view) |
#define cnx_stringview_rbegin(self)
#include <include/Cnx/String.h>
Returns a CnxRandomAccessIterator(const_
into the given CnxStringView
, at the beginning of the reversed iteration (pointing at the end of the view)
Parameters | |
---|---|
self | - The CnxStringView to get an iterator into |
Returns | an iterator at the beginning of the reversed iteration (pointing at the end of the view) |
#define cnx_stringview_rend(self)
#include <include/Cnx/String.h>
Returns a CnxRandomAccessIterator(const_
into the given CnxStringView
, at the end of the reversed iteration (pointing at the beginning of the view)
Parameters | |
---|---|
self | - The CnxStringView to get an iterator into |
Returns | an iterator at the end of the reversed iteration (pointing at the beginning of the view) |
#define cnx_stringview_cbegin(self)
#include <include/Cnx/String.h>
Returns a CnxRandomAccessIterator(const_
into the given CnxStringView
, at the beginning of the iteration (pointing at the beginning of the view)
Parameters | |
---|---|
self | - The CnxStringView to get an iterator into |
Returns | an iterator at the beginning of the iteration (pointing at the beginning of the view) |
#define cnx_stringview_cend(self)
#include <include/Cnx/String.h>
Returns a CnxRandomAccessIterator(const_
into the given CnxStringView
, at the end of the iteration (pointing at the end of the view)
Parameters | |
---|---|
self | - The CnxStringView to get an iterator into |
Returns | an iterator at the end of the iteration (pointing at the end of the view) |
#define cnx_stringview_crbegin(self)
#include <include/Cnx/String.h>
Returns a CnxRandomAccessIterator(const_
into the given CnxStringView
, at the beginning of the reversed iteration (pointing at the end of the view)
Parameters | |
---|---|
self | - The CnxStringView to get an iterator into |
Returns | an iterator at the beginning of the reversed iteration (pointing at the end of the view) |
#define cnx_stringview_crend(self)
#include <include/Cnx/String.h>
Returns a CnxRandomAccessIterator(const_
into the given CnxStringView
, at the end of the reversed iteration (pointing at the beginning of the view)
Parameters | |
---|---|
self | - The CnxStringView to get an iterator into |
Returns | an iterator at the end of the reversed iteration (pointing at the beginning of the view) |