Loading...
Searching...
No Matches
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 T & | reference
typedef const T & | const_reference
typedef T * | pointer
typedef const T * | const_pointer
typedef const T * | iterator
typedef const T * | const_iterator
typedef ETL_OR_STD::reverse_iterator< const_iterator > | const_reverse_iterator

## Public Member Functions

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

## Friends

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

## Detailed Description

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

String view.

## Member Function Documentation

## back()

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

ETL_CONSTEXPR const_reference etl::basic_string_view< T, TTraits >::back | ( |  | ) | const

inline

Returns a const reference to the last element. If asserts or exceptions are enabled, throws an etl::string_view_empty if the view is empty.

## front()

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

ETL_CONSTEXPR const_reference etl::basic_string_view< T, TTraits >::front | ( |  | ) | const

inline

Returns a const reference to the first element. If asserts or exceptions are enabled, throws an etl::string_view_empty if the view is empty.

## operator[]()

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

ETL_CONSTEXPR const_reference etl::basic_string_view< T, TTraits >::operator[] | ( | size_t | i | ) | const

inline

Returns a const reference to the indexed value. If asserts or exceptions are enabled, throws an etl::string_view_bounds if the index is out of bounds.

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

- include/etl/basic_string.h
- include/etl/string_view.h