Hermes
hermes::ConstStrView Class Reference

Public Member Functions

bool operator== (const std::string &s) const
 Checks if this sub-string with the string s are equal. More...
 
size_t size () const
 Gets the size of the view. More...
 

Static Public Member Functions

static Result< ConstStrViewfrom (const std::string &str, size_t pos=0, i64 len=-1)
 Constructs a sub-string view from a std::string object. More...
 
static Result< ConstStrViewfrom (const char *str, size_t len, size_t pos=0)
 Constructs a sub-string view reference from a raw string data. More...
 

Member Function Documentation

◆ from() [1/2]

Result< ConstStrView > hermes::ConstStrView::from ( const char *  str,
size_t  len,
size_t  pos = 0 
)
static

Constructs a sub-string view reference from a raw string data.

Note
This function does not check for the real ending of str.
Parameters
strinput raw string pointer.
lennumber of characters in the sub-string (assumed to be within str bounds).
posposition of the first character of the sub-string in str (assumed to be within str bounds).
Returns
The ConstStrView object representing the sub-string of str.

◆ from() [2/2]

Result< ConstStrView > hermes::ConstStrView::from ( const std::string &  str,
size_t  pos = 0,
i64  len = -1 
)
static

Constructs a sub-string view from a std::string object.

Parameters
strinput string.
posposition of the first character of the sub-string in str.
lennumber of characters of the sub-string. If len = -1, then the size is str.size() - pos.
Returns
The ConstStrView object representing the sub-string of str.

◆ operator==()

bool hermes::ConstStrView::operator== ( const std::string &  s) const

Checks if this sub-string with the string s are equal.

Parameters
s
Returns
true if both string are equal.

◆ size()

size_t hermes::ConstStrView::size ( ) const

Gets the size of the view.

Returns
the number of characters in the sub-string.

The documentation for this class was generated from the following files: