scnlib  0.1.2
FormattedinputformodernC++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
scn::basic_string_view< CharT > Class Template Reference

A view over a (sub)string. More...

#include <string_view.h>

Public Types

using value_type = CharT
 
using span_type = span< const value_type >
 
using pointer = value_type *
 
using const_pointer = const value_type *
 
using reference = value_type &
 
using const_reference = const value_type &
 
using iterator = typename span_type::const_iterator
 
using const_iterator = iterator
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = reverse_iterator
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using span_index_type = typename span_type::index_type
 

Public Member Functions

SCN_CONSTEXPR basic_string_view () noexcept=default
 
SCN_CONSTEXPR basic_string_view (const_pointer s, size_type c)
 
SCN_CONSTEXPR basic_string_view (const_pointer s)
 
template<size_t N>
SCN_CONSTEXPR basic_string_view (const CharT(&s)[N])
 
SCN_CONSTEXPR const_iterator begin () const noexcept
 
SCN_CONSTEXPR const_iterator cbegin () const noexcept
 
SCN_CONSTEXPR const_iterator end () const noexcept
 
SCN_CONSTEXPR const_iterator cend () const noexcept
 
SCN_CONSTEXPR const_iterator rbegin () const noexcept
 
SCN_CONSTEXPR const_iterator crbegin () const noexcept
 
SCN_CONSTEXPR const_iterator rend () const noexcept
 
SCN_CONSTEXPR const_iterator crend () const noexcept
 
SCN_CONSTEXPR const_reference operator[] (size_type pos) const
 
SCN_CONSTEXPR14 const_reference at (size_type pos) const
 
SCN_CONSTEXPR const_reference front () const
 
SCN_CONSTEXPR const_reference back () const
 
SCN_CONSTEXPR const_pointer data () const noexcept
 
SCN_CONSTEXPR size_type size () const noexcept
 
SCN_CONSTEXPR size_type length () const noexcept
 
SCN_CONSTEXPR size_type max_size () const noexcept
 
SCN_NODISCARD SCN_CONSTEXPR bool empty () const noexcept
 
SCN_CONSTEXPR14 void remove_prefix (size_type n)
 
SCN_CONSTEXPR14 void remove_suffix (size_type n)
 
SCN_CONSTEXPR14 void swap (basic_string_view &v) noexcept
 
size_type copy (pointer dest, size_type count, size_type pos=0) const
 
SCN_CONSTEXPR14 basic_string_view substr (size_type pos=0, size_type count=npos) const
 
int compare (basic_string_view v) const noexcept
 
int compare (size_type pos1, size_type count1, basic_string_view v) const
 
int compare (size_type pos1, size_type count1, basic_string_view v, size_type pos2, size_type count2) const
 
int compare (const_pointer s) const
 
int compare (size_type pos1, size_type count1, const_pointer s) const
 
int compare (size_type pos1, size_type count1, const_pointer s, size_type count2) const
 

Static Public Attributes

static SCN_CONSTEXPR_DECL
const size_type 
npos = size_type(-1)
 

Detailed Description

template<typename CharT>
class scn::basic_string_view< CharT >

A view over a (sub)string.

Used even when std::string_view is available to avoid compatibility issues.

Definition at line 56 of file string_view.h.

Member Typedef Documentation

template<typename CharT>
using scn::basic_string_view< CharT >::const_iterator = iterator

Definition at line 66 of file string_view.h.

template<typename CharT>
using scn::basic_string_view< CharT >::const_pointer = const value_type*

Definition at line 62 of file string_view.h.

template<typename CharT>
using scn::basic_string_view< CharT >::const_reference = const value_type&

Definition at line 64 of file string_view.h.

template<typename CharT>
using scn::basic_string_view< CharT >::const_reverse_iterator = reverse_iterator

Definition at line 68 of file string_view.h.

template<typename CharT>
using scn::basic_string_view< CharT >::difference_type = std::ptrdiff_t

Definition at line 70 of file string_view.h.

template<typename CharT>
using scn::basic_string_view< CharT >::iterator = typename span_type::const_iterator

Definition at line 65 of file string_view.h.

template<typename CharT>
using scn::basic_string_view< CharT >::pointer = value_type*

Definition at line 61 of file string_view.h.

template<typename CharT>
using scn::basic_string_view< CharT >::reference = value_type&

Definition at line 63 of file string_view.h.

template<typename CharT>
using scn::basic_string_view< CharT >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 67 of file string_view.h.

template<typename CharT>
using scn::basic_string_view< CharT >::size_type = std::size_t

Definition at line 69 of file string_view.h.

template<typename CharT>
using scn::basic_string_view< CharT >::span_index_type = typename span_type::index_type

Definition at line 71 of file string_view.h.

template<typename CharT>
using scn::basic_string_view< CharT >::span_type = span<const value_type>

Definition at line 59 of file string_view.h.

template<typename CharT>
using scn::basic_string_view< CharT >::value_type = CharT

Definition at line 58 of file string_view.h.

Constructor & Destructor Documentation

template<typename CharT>
SCN_CONSTEXPR scn::basic_string_view< CharT >::basic_string_view ( )
defaultnoexcept
template<typename CharT>
SCN_CONSTEXPR scn::basic_string_view< CharT >::basic_string_view ( const_pointer  s,
size_type  c 
)
inline

Definition at line 76 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR scn::basic_string_view< CharT >::basic_string_view ( const_pointer  s)
inline

Definition at line 80 of file string_view.h.

template<typename CharT>
template<size_t N>
SCN_CONSTEXPR scn::basic_string_view< CharT >::basic_string_view ( const CharT(&)  s[N])
inline

Definition at line 85 of file string_view.h.

Member Function Documentation

template<typename CharT>
SCN_CONSTEXPR14 const_reference scn::basic_string_view< CharT >::at ( size_type  pos) const
inline

Definition at line 127 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR const_reference scn::basic_string_view< CharT >::back ( ) const
inline

Definition at line 137 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR const_iterator scn::basic_string_view< CharT >::begin ( ) const
inlinenoexcept

Definition at line 89 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR const_iterator scn::basic_string_view< CharT >::cbegin ( ) const
inlinenoexcept

Definition at line 93 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR const_iterator scn::basic_string_view< CharT >::cend ( ) const
inlinenoexcept

Definition at line 101 of file string_view.h.

template<typename CharT>
int scn::basic_string_view< CharT >::compare ( basic_string_view< CharT >  v) const
inlinenoexcept

Definition at line 196 of file string_view.h.

template<typename CharT>
int scn::basic_string_view< CharT >::compare ( size_type  pos1,
size_type  count1,
basic_string_view< CharT >  v 
) const
inline

Definition at line 211 of file string_view.h.

template<typename CharT>
int scn::basic_string_view< CharT >::compare ( size_type  pos1,
size_type  count1,
basic_string_view< CharT >  v,
size_type  pos2,
size_type  count2 
) const
inline

Definition at line 215 of file string_view.h.

template<typename CharT>
int scn::basic_string_view< CharT >::compare ( const_pointer  s) const
inline

Definition at line 223 of file string_view.h.

template<typename CharT>
int scn::basic_string_view< CharT >::compare ( size_type  pos1,
size_type  count1,
const_pointer  s 
) const
inline

Definition at line 227 of file string_view.h.

template<typename CharT>
int scn::basic_string_view< CharT >::compare ( size_type  pos1,
size_type  count1,
const_pointer  s,
size_type  count2 
) const
inline

Definition at line 231 of file string_view.h.

template<typename CharT>
size_type scn::basic_string_view< CharT >::copy ( pointer  dest,
size_type  count,
size_type  pos = 0 
) const
inline

Definition at line 180 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR const_iterator scn::basic_string_view< CharT >::crbegin ( ) const
inlinenoexcept

Definition at line 110 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR const_iterator scn::basic_string_view< CharT >::crend ( ) const
inlinenoexcept

Definition at line 118 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR const_pointer scn::basic_string_view< CharT >::data ( ) const
inlinenoexcept

Definition at line 141 of file string_view.h.

template<typename CharT>
SCN_NODISCARD SCN_CONSTEXPR bool scn::basic_string_view< CharT >::empty ( ) const
inlinenoexcept

Definition at line 158 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR const_iterator scn::basic_string_view< CharT >::end ( ) const
inlinenoexcept

Definition at line 97 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR const_reference scn::basic_string_view< CharT >::front ( ) const
inline

Definition at line 133 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR size_type scn::basic_string_view< CharT >::length ( ) const
inlinenoexcept

Definition at line 150 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR size_type scn::basic_string_view< CharT >::max_size ( ) const
inlinenoexcept

Definition at line 154 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR const_reference scn::basic_string_view< CharT >::operator[] ( size_type  pos) const
inline

Definition at line 123 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR const_iterator scn::basic_string_view< CharT >::rbegin ( ) const
inlinenoexcept

Definition at line 106 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR14 void scn::basic_string_view< CharT >::remove_prefix ( size_type  n)
inline

Definition at line 163 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR14 void scn::basic_string_view< CharT >::remove_suffix ( size_type  n)
inline

Definition at line 168 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR const_iterator scn::basic_string_view< CharT >::rend ( ) const
inlinenoexcept

Definition at line 114 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR size_type scn::basic_string_view< CharT >::size ( ) const
inlinenoexcept

Definition at line 146 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR14 basic_string_view scn::basic_string_view< CharT >::substr ( size_type  pos = 0,
size_type  count = npos 
) const
inline

Definition at line 188 of file string_view.h.

template<typename CharT>
SCN_CONSTEXPR14 void scn::basic_string_view< CharT >::swap ( basic_string_view< CharT > &  v)
inlinenoexcept

Definition at line 174 of file string_view.h.

Member Data Documentation

template<typename CharT>
SCN_CONSTEXPR_DECL const size_type scn::basic_string_view< CharT >::npos = size_type(-1)
static

Definition at line 73 of file string_view.h.


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