OpenSiv3D  v0.6.5
C++20 framework for creative coding
s3d::StringView Class Reference

所有権を持たない文字列クラス More...

#include <StringView.hpp>

Public Types

using string_view_type = std::u32string_view
 
using traits_type = typename string_view_type::traits_type
 
using value_type = typename string_view_type::value_type
 
using pointer = typename string_view_type::pointer
 
using const_pointer = typename string_view_type::const_pointer
 
using reference = typename string_view_type::reference
 
using const_reference = typename string_view_type::const_reference
 
using const_iterator = typename string_view_type::const_iterator
 
using iterator = typename string_view_type::iterator
 
using const_reverse_iterator = typename string_view_type::const_reverse_iterator
 
using reverse_iterator = typename string_view_type::reverse_iterator
 
using size_type = typename string_view_type::size_type
 
using difference_type = typename string_view_type::difference_type
 

Public Member Functions

constexpr SIV3D_NODISCARD_CXX20 StringView ()=default
 
constexpr SIV3D_NODISCARD_CXX20 StringView (const StringView &)=default
 
SIV3D_NODISCARD_CXX20 StringView (const std::u32string &s) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 StringView (std::u32string_view s) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 StringView (const value_type *s, size_type length) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 StringView (const value_type *s) noexcept
 
constexpr StringViewoperator= (const StringView &)=default
 
constexpr const_iterator begin () const noexcept
 
constexpr const_iterator end () const noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr const_iterator cend () const noexcept
 
constexpr const_reverse_iterator rbegin () const noexcept
 
constexpr const_reverse_iterator rend () const noexcept
 
constexpr const_reverse_iterator crbegin () const noexcept
 
constexpr const_reverse_iterator crend () const noexcept
 
constexpr const_reference operator[] (size_type index) const noexcept
 
constexpr const_reference at (size_type index) const
 
constexpr const_reference front () const noexcept
 
constexpr const_reference back () const noexcept
 
constexpr const_pointer data () const noexcept
 
constexpr size_type size () const noexcept
 
constexpr size_type size_bytes () const noexcept
 
constexpr size_type length () const noexcept
 
constexpr size_type max_size () const noexcept
 
constexpr bool empty () const noexcept
 
constexpr bool isEmpty () const noexcept
 
constexpr operator bool () const noexcept
 
constexpr void remove_prefix (size_type n) noexcept
 
constexpr void remove_suffix (size_type n) noexcept
 
constexpr void swap (StringView &other) noexcept
 
constexpr void clear () noexcept
 
size_type copy (value_type *dst, size_type n, size_type pos=0) const
 
constexpr StringView substr (size_type pos=0, size_type n=npos) const
 
constexpr int32 compare (StringView s) const noexcept
 
constexpr int32 compare (size_type pos1, size_type n1, StringView s) const noexcept
 
constexpr int32 compare (size_type pos1, size_type n1, StringView s, size_type pos2, size_type n2) const noexcept
 
constexpr int32 compare (const value_type *s) const noexcept
 
constexpr int32 compare (size_type pos1, size_type n1, const value_type *s) const noexcept
 
constexpr int32 compare (size_type pos1, size_type n1, const value_type *s, size_type n2) const noexcept
 
constexpr bool starts_with (value_type ch) const noexcept
 文字列が指定した文字から始まるかを返します。 More...
 
constexpr bool starts_with (StringView s) const noexcept
 文字列が指定した文字列から始まるかを返します。 More...
 
bool ends_with (value_type ch) const noexcept
 文字列が指定した文字で終わるかを返します。 More...
 
constexpr bool ends_with (StringView s) const noexcept
 文字列が指定した文字列で終わるかを返します。 More...
 
constexpr size_type indexOf (StringView s, size_type pos=0) const noexcept
 
constexpr size_type indexOf (value_type ch, size_type pos=0) const noexcept
 
constexpr size_type indexOf (const value_type *s, size_type pos, size_type count) const noexcept
 
constexpr size_type indexOf (const value_type *s, size_type pos=0) const noexcept
 
constexpr size_t indexOfNot (value_type ch, size_t pos=0) const noexcept
 
constexpr size_type lastIndexOf (StringView s, size_type pos=npos) const noexcept
 
constexpr size_type lastIndexOf (value_type ch, size_type pos=npos) const noexcept
 
constexpr size_type lastIndexOf (const value_type *s, size_type pos, size_type count) const noexcept
 
constexpr size_type lastIndexOf (const value_type *s, size_type pos=npos) const noexcept
 
constexpr size_t lastIndexNotOf (value_type ch, size_t pos=npos) const noexcept
 
constexpr size_t indexOfAny (StringView anyof, size_t pos=0) const noexcept
 
constexpr size_t indexOfAny (const value_type *anyof, size_t pos=0) const noexcept
 
constexpr size_t lastIndexOfAny (StringView anyof, size_t pos=0) const noexcept
 
constexpr size_t lastIndexOfAny (const value_type *anyof, size_t pos=0) const noexcept
 
constexpr size_t indexNotOfAny (StringView anyof, size_t pos=0) const noexcept
 
constexpr size_t indexNotOfAny (const value_type *anyof, size_t pos=0) const noexcept
 
constexpr size_t lastIndexNotOfAny (StringView anyof, size_t pos=0) const noexcept
 
constexpr size_t lastIndexNotOfAny (const value_type *anyof, size_t pos=0) const noexcept
 
constexpr bool includes (value_type ch) const noexcept
 文字列が指定した文字を含むかを返します。 More...
 
constexpr bool includes (StringView s) const noexcept
 文字列が指定した文字列を含むかを返します。 More...
 
std::string narrow () const
 文字列を std::string に変換します。 More...
 
std::wstring toWstr () const
 文字列を std::wstring に変換します。 More...
 
std::string toUTF8 () const
 文字列を UTF-8 文字列に変換します。 More...
 
uint64 hash () const noexcept
 文字列のハッシュを返します。 More...
 

Static Public Attributes

static constexpr size_type npos { static_cast<size_type>(-1) }
 

Friends

constexpr friend bool operator== (StringView lhs, StringView rhs) noexcept
 
constexpr friend bool operator!= (StringView lhs, StringView rhs) noexcept
 
constexpr friend bool operator< (StringView lhs, StringView rhs) noexcept
 
constexpr friend bool operator<= (StringView lhs, StringView rhs) noexcept
 
constexpr friend bool operator> (StringView lhs, StringView rhs) noexcept
 
constexpr friend bool operator>= (StringView lhs, StringView rhs) noexcept
 
std::ostream & operator<< (std::ostream &output, const StringView &value)
 
std::wostream & operator<< (std::wostream &output, const StringView &value)
 
std::basic_ostream< char32 > & operator<< (std::basic_ostream< char32 > &output, const StringView &value)
 
void Formatter (FormatData &formatData, StringView s)
 

Detailed Description

所有権を持たない文字列クラス

Member Typedef Documentation

◆ const_iterator

using s3d::StringView::const_iterator = typename string_view_type::const_iterator

◆ const_pointer

using s3d::StringView::const_pointer = typename string_view_type::const_pointer

◆ const_reference

using s3d::StringView::const_reference = typename string_view_type::const_reference

◆ const_reverse_iterator

using s3d::StringView::const_reverse_iterator = typename string_view_type::const_reverse_iterator

◆ difference_type

using s3d::StringView::difference_type = typename string_view_type::difference_type

◆ iterator

using s3d::StringView::iterator = typename string_view_type::iterator

◆ pointer

using s3d::StringView::pointer = typename string_view_type::pointer

◆ reference

using s3d::StringView::reference = typename string_view_type::reference

◆ reverse_iterator

using s3d::StringView::reverse_iterator = typename string_view_type::reverse_iterator

◆ size_type

using s3d::StringView::size_type = typename string_view_type::size_type

◆ string_view_type

using s3d::StringView::string_view_type = std::u32string_view

◆ traits_type

using s3d::StringView::traits_type = typename string_view_type::traits_type

◆ value_type

using s3d::StringView::value_type = typename string_view_type::value_type

Constructor & Destructor Documentation

◆ StringView() [1/6]

constexpr SIV3D_NODISCARD_CXX20 s3d::StringView::StringView ( )
constexprdefault

◆ StringView() [2/6]

constexpr SIV3D_NODISCARD_CXX20 s3d::StringView::StringView ( const StringView )
constexprdefault

◆ StringView() [3/6]

SIV3D_NODISCARD_CXX20 s3d::StringView::StringView ( const std::u32string &  s)
noexcept

◆ StringView() [4/6]

constexpr SIV3D_NODISCARD_CXX20 s3d::StringView::StringView ( std::u32string_view  s)
constexprnoexcept

◆ StringView() [5/6]

constexpr SIV3D_NODISCARD_CXX20 s3d::StringView::StringView ( const value_type s,
size_type  length 
)
constexprnoexcept

◆ StringView() [6/6]

constexpr SIV3D_NODISCARD_CXX20 s3d::StringView::StringView ( const value_type s)
constexprnoexcept

Member Function Documentation

◆ at()

constexpr const_reference s3d::StringView::at ( size_type  index) const
constexpr

◆ back()

constexpr const_reference s3d::StringView::back ( ) const
constexprnoexcept

◆ begin()

constexpr const_iterator s3d::StringView::begin ( ) const
constexprnoexcept

◆ cbegin()

constexpr const_iterator s3d::StringView::cbegin ( ) const
constexprnoexcept

◆ cend()

constexpr const_iterator s3d::StringView::cend ( ) const
constexprnoexcept

◆ clear()

constexpr void s3d::StringView::clear ( )
constexprnoexcept

◆ compare() [1/6]

constexpr int32 s3d::StringView::compare ( const value_type s) const
constexprnoexcept

◆ compare() [2/6]

constexpr int32 s3d::StringView::compare ( size_type  pos1,
size_type  n1,
const value_type s 
) const
constexprnoexcept

◆ compare() [3/6]

constexpr int32 s3d::StringView::compare ( size_type  pos1,
size_type  n1,
const value_type s,
size_type  n2 
) const
constexprnoexcept

◆ compare() [4/6]

constexpr int32 s3d::StringView::compare ( size_type  pos1,
size_type  n1,
StringView  s 
) const
constexprnoexcept

◆ compare() [5/6]

constexpr int32 s3d::StringView::compare ( size_type  pos1,
size_type  n1,
StringView  s,
size_type  pos2,
size_type  n2 
) const
constexprnoexcept

◆ compare() [6/6]

constexpr int32 s3d::StringView::compare ( StringView  s) const
constexprnoexcept

◆ copy()

size_type s3d::StringView::copy ( value_type dst,
size_type  n,
size_type  pos = 0 
) const

◆ crbegin()

constexpr const_reverse_iterator s3d::StringView::crbegin ( ) const
constexprnoexcept

◆ crend()

constexpr const_reverse_iterator s3d::StringView::crend ( ) const
constexprnoexcept

◆ data()

constexpr const_pointer s3d::StringView::data ( ) const
constexprnoexcept

◆ empty()

constexpr bool s3d::StringView::empty ( ) const
constexprnoexcept

◆ end()

constexpr const_iterator s3d::StringView::end ( ) const
constexprnoexcept

◆ ends_with() [1/2]

constexpr bool s3d::StringView::ends_with ( StringView  s) const
constexprnoexcept

文字列が指定した文字列で終わるかを返します。

Parameters
s検索する文字列
Returns
指定した文字列で終わる場合 true, それ以外の場合は false

◆ ends_with() [2/2]

bool s3d::StringView::ends_with ( value_type  ch) const
noexcept

文字列が指定した文字で終わるかを返します。

Parameters
ch検索する文字
Returns
指定した文字で終わる場合 true, それ以外の場合は false

◆ front()

constexpr const_reference s3d::StringView::front ( ) const
constexprnoexcept

◆ hash()

uint64 s3d::StringView::hash ( ) const
noexcept

文字列のハッシュを返します。

Returns
文字列のハッシュ

◆ includes() [1/2]

constexpr bool s3d::StringView::includes ( StringView  s) const
constexprnoexcept

文字列が指定した文字列を含むかを返します。

Parameters
ch検索する文字列
Returns
指定した文字列を含む場合 true, それ以外の場合は false

◆ includes() [2/2]

constexpr bool s3d::StringView::includes ( value_type  ch) const
constexprnoexcept

文字列が指定した文字を含むかを返します。

Parameters
ch検索する文字
Returns
指定した文字を含む場合 true, それ以外の場合は false

◆ indexNotOfAny() [1/2]

constexpr size_t s3d::StringView::indexNotOfAny ( const value_type anyof,
size_t  pos = 0 
) const
constexprnoexcept

◆ indexNotOfAny() [2/2]

constexpr size_t s3d::StringView::indexNotOfAny ( StringView  anyof,
size_t  pos = 0 
) const
constexprnoexcept

◆ indexOf() [1/4]

constexpr size_type s3d::StringView::indexOf ( const value_type s,
size_type  pos,
size_type  count 
) const
constexprnoexcept

◆ indexOf() [2/4]

constexpr size_type s3d::StringView::indexOf ( const value_type s,
size_type  pos = 0 
) const
constexprnoexcept

◆ indexOf() [3/4]

constexpr size_type s3d::StringView::indexOf ( StringView  s,
size_type  pos = 0 
) const
constexprnoexcept

◆ indexOf() [4/4]

constexpr size_type s3d::StringView::indexOf ( value_type  ch,
size_type  pos = 0 
) const
constexprnoexcept

◆ indexOfAny() [1/2]

constexpr size_t s3d::StringView::indexOfAny ( const value_type anyof,
size_t  pos = 0 
) const
constexprnoexcept

◆ indexOfAny() [2/2]

constexpr size_t s3d::StringView::indexOfAny ( StringView  anyof,
size_t  pos = 0 
) const
constexprnoexcept

◆ indexOfNot()

constexpr size_t s3d::StringView::indexOfNot ( value_type  ch,
size_t  pos = 0 
) const
constexprnoexcept

◆ isEmpty()

constexpr bool s3d::StringView::isEmpty ( ) const
constexprnoexcept

◆ lastIndexNotOf()

constexpr size_t s3d::StringView::lastIndexNotOf ( value_type  ch,
size_t  pos = npos 
) const
constexprnoexcept

◆ lastIndexNotOfAny() [1/2]

constexpr size_t s3d::StringView::lastIndexNotOfAny ( const value_type anyof,
size_t  pos = 0 
) const
constexprnoexcept

◆ lastIndexNotOfAny() [2/2]

constexpr size_t s3d::StringView::lastIndexNotOfAny ( StringView  anyof,
size_t  pos = 0 
) const
constexprnoexcept

◆ lastIndexOf() [1/4]

constexpr size_type s3d::StringView::lastIndexOf ( const value_type s,
size_type  pos,
size_type  count 
) const
constexprnoexcept

◆ lastIndexOf() [2/4]

constexpr size_type s3d::StringView::lastIndexOf ( const value_type s,
size_type  pos = npos 
) const
constexprnoexcept

◆ lastIndexOf() [3/4]

constexpr size_type s3d::StringView::lastIndexOf ( StringView  s,
size_type  pos = npos 
) const
constexprnoexcept

◆ lastIndexOf() [4/4]

constexpr size_type s3d::StringView::lastIndexOf ( value_type  ch,
size_type  pos = npos 
) const
constexprnoexcept

◆ lastIndexOfAny() [1/2]

constexpr size_t s3d::StringView::lastIndexOfAny ( const value_type anyof,
size_t  pos = 0 
) const
constexprnoexcept

◆ lastIndexOfAny() [2/2]

constexpr size_t s3d::StringView::lastIndexOfAny ( StringView  anyof,
size_t  pos = 0 
) const
constexprnoexcept

◆ length()

constexpr size_type s3d::StringView::length ( ) const
constexprnoexcept

◆ max_size()

constexpr size_type s3d::StringView::max_size ( ) const
constexprnoexcept

◆ narrow()

std::string s3d::StringView::narrow ( ) const

文字列を std::string に変換します。

Returns
変換された文字列

◆ operator bool()

constexpr s3d::StringView::operator bool ( ) const
explicitconstexprnoexcept

◆ operator=()

constexpr StringView& s3d::StringView::operator= ( const StringView )
constexprdefault

◆ operator[]()

constexpr const_reference s3d::StringView::operator[] ( size_type  index) const
constexprnoexcept

◆ rbegin()

constexpr const_reverse_iterator s3d::StringView::rbegin ( ) const
constexprnoexcept

◆ remove_prefix()

constexpr void s3d::StringView::remove_prefix ( size_type  n)
constexprnoexcept

◆ remove_suffix()

constexpr void s3d::StringView::remove_suffix ( size_type  n)
constexprnoexcept

◆ rend()

constexpr const_reverse_iterator s3d::StringView::rend ( ) const
constexprnoexcept

◆ size()

constexpr size_type s3d::StringView::size ( ) const
constexprnoexcept

◆ size_bytes()

constexpr size_type s3d::StringView::size_bytes ( ) const
constexprnoexcept

◆ starts_with() [1/2]

constexpr bool s3d::StringView::starts_with ( StringView  s) const
constexprnoexcept

文字列が指定した文字列から始まるかを返します。

Parameters
s検索する文字列
Returns
指定した文字列から始まる場合 true, それ以外の場合は false

◆ starts_with() [2/2]

constexpr bool s3d::StringView::starts_with ( value_type  ch) const
constexprnoexcept

文字列が指定した文字から始まるかを返します。

Parameters
ch検索する文字
Returns
指定した文字から始まる場合 true, それ以外の場合は false

◆ substr()

constexpr StringView s3d::StringView::substr ( size_type  pos = 0,
size_type  n = npos 
) const
constexpr

◆ swap()

constexpr void s3d::StringView::swap ( StringView other)
constexprnoexcept

◆ toUTF8()

std::string s3d::StringView::toUTF8 ( ) const

文字列を UTF-8 文字列に変換します。

Returns
変換された文字列

◆ toWstr()

std::wstring s3d::StringView::toWstr ( ) const

文字列を std::wstring に変換します。

Returns
変換された文字列

Friends And Related Function Documentation

◆ Formatter

void Formatter ( FormatData formatData,
StringView  s 
)
friend

◆ operator!=

constexpr friend bool operator!= ( StringView  lhs,
StringView  rhs 
)
friend

◆ operator<

constexpr friend bool operator< ( StringView  lhs,
StringView  rhs 
)
friend

◆ operator<< [1/3]

std::basic_ostream<char32>& operator<< ( std::basic_ostream< char32 > &  output,
const StringView value 
)
friend

◆ operator<< [2/3]

std::ostream& operator<< ( std::ostream &  output,
const StringView value 
)
friend

◆ operator<< [3/3]

std::wostream& operator<< ( std::wostream &  output,
const StringView value 
)
friend

◆ operator<=

constexpr friend bool operator<= ( StringView  lhs,
StringView  rhs 
)
friend

◆ operator==

constexpr friend bool operator== ( StringView  lhs,
StringView  rhs 
)
friend

◆ operator>

constexpr friend bool operator> ( StringView  lhs,
StringView  rhs 
)
friend

◆ operator>=

constexpr friend bool operator>= ( StringView  lhs,
StringView  rhs 
)
friend

Member Data Documentation

◆ npos

constexpr size_type s3d::StringView::npos { static_cast<size_type>(-1) }
staticconstexpr

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