MPD  0.20.15
Public Member Functions | Static Public Member Functions
StringView Struct Reference

#include <StringView.hxx>

Inheritance diagram for StringView:
[legend]
Collaboration diagram for StringView:
[legend]

Public Member Functions

 StringView ()=default
 
constexpr StringView (pointer_type _data, size_type _size)
 
constexpr StringView (pointer_type _begin, pointer_type _end)
 
 StringView (pointer_type _data)
 
constexpr StringView (std::nullptr_t n)
 
void SetEmpty () noexcept
 
gcc_pure pointer_type Find (char ch) const noexcept
 
StringViewoperator= (std::nullptr_t) noexcept
 
StringViewoperator= (pointer_type _data) noexcept
 
gcc_pure bool StartsWith (StringView needle) const noexcept
 
gcc_pure bool Equals (StringView other) const noexcept
 
template<size_t n>
bool EqualsLiteral (const char(&other)[n]) const noexcept
 
gcc_pure bool EqualsIgnoreCase (StringView other) const noexcept
 
template<size_t n>
bool EqualsLiteralIgnoreCase (const char(&other)[n]) const noexcept
 
void StripLeft () noexcept
 Skip all whitespace at the beginning. More...
 
void StripRight () noexcept
 Skip all whitespace at the end. More...
 
void Strip () noexcept
 
- Public Member Functions inherited from ConstBuffer< char >
 ConstBuffer ()=default
 
constexpr ConstBuffer (std::nullptr_t)
 
constexpr ConstBuffer (pointer_type _data, size_type _size)
 
constexpr ConstBuffer< void > ToVoid () const
 
constexpr bool IsNull () const
 
constexpr bool IsEmpty () const
 
gcc_pure bool Contains (U &&u) const noexcept
 
constexpr iterator begin () const
 
constexpr iterator end () const
 
constexpr const_iterator cbegin () const
 
constexpr const_iterator cend () const
 
reference_type operator[] (size_type i) const
 
reference_type front () const
 Returns a reference to the first element. More...
 
reference_type back () const
 Returns a reference to the last element. More...
 
void pop_front ()
 Remove the first element (by moving the head pointer, does not actually modify the buffer). More...
 
void pop_back ()
 Remove the last element (by moving the tail pointer, does not actually modify the buffer). More...
 
reference_type shift ()
 Remove the first element and return a reference to it. More...
 
void skip_front (size_type n)
 
void MoveFront (pointer_type new_data)
 Move the front pointer to the given address, and adjust the size attribute to retain the old end address. More...
 

Static Public Member Functions

static constexpr StringView Empty ()
 
template<size_t n>
static constexpr StringView Literal (const char(&_data)[n])
 
static constexpr StringView Literal ()
 
- Static Public Member Functions inherited from ConstBuffer< char >
static constexpr ConstBuffer Null ()
 
static ConstBuffer< char > FromVoid (ConstBuffer< void > other)
 Cast a ConstBuffer<void> to a ConstBuffer<T>. More...
 

Additional Inherited Members

- Public Types inherited from ConstBuffer< char >
typedef size_t size_type
 
typedef const char & reference_type
 
typedef reference_type const_reference_type
 
typedef const char * pointer_type
 
typedef pointer_type const_pointer_type
 
typedef pointer_type iterator
 
typedef pointer_type const_iterator
 
- Data Fields inherited from ConstBuffer< char >
pointer_type data
 
size_type size
 

Detailed Description

Definition at line 37 of file StringView.hxx.

Constructor & Destructor Documentation

◆ StringView() [1/5]

StringView::StringView ( )
default

◆ StringView() [2/5]

constexpr StringView::StringView ( pointer_type  _data,
size_type  _size 
)
inline

Definition at line 40 of file StringView.hxx.

◆ StringView() [3/5]

constexpr StringView::StringView ( pointer_type  _begin,
pointer_type  _end 
)
inline

Definition at line 43 of file StringView.hxx.

◆ StringView() [4/5]

StringView::StringView ( pointer_type  _data)
inline

Definition at line 46 of file StringView.hxx.

◆ StringView() [5/5]

constexpr StringView::StringView ( std::nullptr_t  n)
inline

Definition at line 50 of file StringView.hxx.

Member Function Documentation

◆ Empty()

static constexpr StringView StringView::Empty ( )
inlinestatic

Definition at line 53 of file StringView.hxx.

◆ Equals()

gcc_pure bool StringView::Equals ( StringView  other) const
inlinenoexcept

Definition at line 96 of file StringView.hxx.

◆ EqualsIgnoreCase()

gcc_pure bool StringView::EqualsIgnoreCase ( StringView  other) const
inlinenoexcept

Definition at line 107 of file StringView.hxx.

◆ EqualsLiteral()

template<size_t n>
bool StringView::EqualsLiteral ( const char(&)  other[n]) const
inlinenoexcept

Definition at line 102 of file StringView.hxx.

◆ EqualsLiteralIgnoreCase()

template<size_t n>
bool StringView::EqualsLiteralIgnoreCase ( const char(&)  other[n]) const
inlinenoexcept

Definition at line 113 of file StringView.hxx.

◆ Find()

gcc_pure pointer_type StringView::Find ( char  ch) const
inlinenoexcept

Definition at line 73 of file StringView.hxx.

◆ Literal() [1/2]

template<size_t n>
static constexpr StringView StringView::Literal ( const char(&)  _data[n])
inlinestatic

Definition at line 58 of file StringView.hxx.

◆ Literal() [2/2]

static constexpr StringView StringView::Literal ( )
inlinestatic

Definition at line 63 of file StringView.hxx.

◆ operator=() [1/2]

StringView& StringView::operator= ( std::nullptr_t  )
inlinenoexcept

Definition at line 77 of file StringView.hxx.

◆ operator=() [2/2]

StringView& StringView::operator= ( pointer_type  _data)
inlinenoexcept

Definition at line 83 of file StringView.hxx.

◆ SetEmpty()

void StringView::SetEmpty ( )
inlinenoexcept

Definition at line 67 of file StringView.hxx.

◆ StartsWith()

gcc_pure bool StringView::StartsWith ( StringView  needle) const
inlinenoexcept

Definition at line 90 of file StringView.hxx.

◆ Strip()

void StringView::Strip ( )
inlinenoexcept

Definition at line 127 of file StringView.hxx.

◆ StripLeft()

void StringView::StripLeft ( )
noexcept

Skip all whitespace at the beginning.

◆ StripRight()

void StringView::StripRight ( )
noexcept

Skip all whitespace at the end.


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