Embedded Template Library  1.0
etl::basic_string_view< T, TTraits > Class Template Reference

String view. More...

#include <string_view.h>

Public Types

enum  { npos = etl::integral_limits<size_t>::max }
 
typedef T value_type
 
typedef TTraits traits_type
 
typedef size_t size_type
 
typedef const T & const_reference
 
typedef const T * const_pointer
 
typedef const T * const_iterator
 
typedef ETL_OR_STD::reverse_iterator< const_iterator > const_reverse_iterator
 

Public Member Functions

ETL_CONSTEXPR17 basic_string_view ()
 Default constructor.
 
ETL_CONSTEXPR17 basic_string_view (const etl::ibasic_string< T > &str)
 Construct from string.
 
ETL_EXPLICIT_STRING_FROM_CHAR ETL_CONSTEXPR17 basic_string_view (const T *begin_)
 Construct from T*.
 
ETL_CONSTEXPR17 basic_string_view (const T *begin_, const T *end_)
 Construct from pointer range.
 
ETL_CONSTEXPR17 basic_string_view (const T *begin_, size_t size_)
 Construct from pointer/size.
 
ETL_CONSTEXPR17 basic_string_view (const basic_string_view &other)
 Copy constructor.
 
const_reference front () const
 Returns a const reference to the first element.
 
const_reference back () const
 Returns a const reference to the last element.
 
const_pointer data () const
 Returns a const pointer to the first element of the internal storage.
 
const_iterator begin () const
 Returns a const iterator to the beginning of the array.
 
const_iterator cbegin () const
 Returns a const iterator to the beginning of the array.
 
const_iterator end () const
 Returns a const iterator to the end of the array.
 
const_iterator cend () const
 
const_reverse_iterator rbegin () const
 Returns a const reverse iterator to the reverse beginning of the array.
 
const_reverse_iterator crbegin () const
 Returns a const reverse iterator to the reverse beginning of the array.
 
const_reverse_iterator rend () const
 Returns a const reverse iterator to the end of the array.
 
const_reverse_iterator crend () const
 Returns a const reverse iterator to the end of the array.
 
bool empty () const
 Returns true if the array size is zero.
 
size_t size () const
 Returns the size of the array.
 
size_t length () const
 Returns the size of the array.
 
size_t max_size () const
 Returns the maximum possible size of the array.
 
etl::basic_string_view< T, TTraits > & operator= (const etl::basic_string_view< T, TTraits > &other)
 Assign from a view.
 
template<typename TIterator >
void assign (TIterator begin_, TIterator end_)
 Assign from iterators.
 
template<typename TIterator >
void assign (TIterator begin_, size_t size_)
 Assign from iterator and size.
 
const_reference operator[] (size_t i) const
 Returns a const reference to the indexed value.
 
const_reference at (size_t i) const
 Returns a const reference to the indexed value.
 
void swap (basic_string_view &other)
 Swaps with another basic_string_view.
 
size_type copy (T *destination, size_type count, size_type position=0) const
 Copies characters.
 
basic_string_view substr (size_type position=0, size_type count=npos) const
 Returns a substring.
 
void remove_prefix (size_type n)
 Shrinks the view by moving its start forward.
 
void remove_suffix (size_type n)
 Shrinks the view by moving its end backward.
 
int compare (basic_string_view< T, TTraits > view) const
 Compares two views.
 
int compare (size_type position, size_type count, basic_string_view view) const
 
int compare (size_type position1, size_type count1, basic_string_view view, size_type position2, size_type count2) const
 
int compare (const T *text) const
 
int compare (size_type position, size_type count, const T *text) const
 
int compare (size_type position, size_type count1, const T *text, size_type count2) const
 
bool starts_with (etl::basic_string_view< T, TTraits > view) const
 Checks if the string view starts with the given prefix.
 
bool starts_with (T c) const
 
bool starts_with (const T *text) const
 
bool ends_with (etl::basic_string_view< T, TTraits > view) const
 Checks if the string view ends with the given suffix.
 
bool ends_with (T c) const
 
bool ends_with (const T *text) const
 
size_type find (etl::basic_string_view< T, TTraits > view, size_type position=0) const
 Find characters in the view.
 
size_type find (T c, size_type position=0) const
 
size_type find (const T *text, size_type position, size_type count) const
 
size_type find (const T *text, size_type position=0) const
 
size_type rfind (etl::basic_string_view< T, TTraits > view, size_type position=npos) const
 Find the last occurrence of a substring.
 
size_type rfind (T c, size_type position=npos) const
 
size_type rfind (const T *text, size_type position, size_type count) const
 
size_type rfind (const T *text, size_type position=npos) const
 
size_type find_first_of (etl::basic_string_view< T, TTraits > view, size_type position=0) const
 Find first occurrence of characters.
 
size_type find_first_of (T c, size_type position=0) const
 
size_type find_first_of (const T *text, size_type position, size_type count) const
 
size_type find_first_of (const T *text, size_type position=0) const
 
size_type find_last_of (etl::basic_string_view< T, TTraits > view, size_type position=npos) const
 Find last occurrence of characters.
 
size_type find_last_of (T c, size_type position=npos) const
 
size_type find_last_of (const T *text, size_type position, size_type count) const
 
size_type find_last_of (const T *text, size_type position=npos) const
 
size_type find_first_not_of (etl::basic_string_view< T, TTraits > view, size_type position=0) const
 Find first absence of characters.
 
size_type find_first_not_of (T c, size_type position=0) const
 
size_type find_first_not_of (const T *text, size_type position, size_type count) const
 
size_type find_first_not_of (const T *text, size_type position=0) const
 
size_type find_last_not_of (etl::basic_string_view< T, TTraits > view, size_type position=npos) const
 Find last absence of characters.
 
size_type find_last_not_of (T c, size_type position=npos) const
 
size_type find_last_not_of (const T *text, size_type position, size_type count) const
 
size_type find_last_not_of (const T *text, size_type position=npos) const
 

Friends

bool operator== (const etl::basic_string_view< T, TTraits > &lhs, const etl::basic_string_view< T, TTraits > &rhs)
 Equality for array views.
 
bool operator!= (const etl::basic_string_view< T, TTraits > &lhs, const etl::basic_string_view< T, TTraits > &rhs)
 Inequality for array views.
 
bool operator< (const etl::basic_string_view< T, TTraits > &lhs, const etl::basic_string_view< T, TTraits > &rhs)
 Less-than for array views.
 
bool operator> (const etl::basic_string_view< T, TTraits > &lhs, const etl::basic_string_view< T, TTraits > &rhs)
 Greater-than for array views.
 
bool operator<= (const etl::basic_string_view< T, TTraits > &lhs, const etl::basic_string_view< T, TTraits > &rhs)
 Less-than-equal for array views.
 
bool operator>= (const etl::basic_string_view< T, TTraits > &lhs, const etl::basic_string_view< T, TTraits > &rhs)
 Greater-than-equal for array views.
 

Detailed Description

template<typename T, typename TTraits = etl::char_traits<T>>
class etl::basic_string_view< T, TTraits >

String view.


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