nlib
|
std::string
が持つメソッドをstd::string
を構築せずに利用するためのクラスです。 C++17のstring_viewにtypedefされる予定です。 StringViewを引数に取るフリー関数についてはこちらを御覧ください。
[詳解]
#include "nn/nlib/StringView.h"
公開型 | |
typedef char | charT |
現在はchar 型専用のクラスです。 | |
typedef charT | value_type |
文字の型です。 | |
typedef const charT * | pointer |
const_pointer と同一です。 | |
typedef const charT * | const_pointer |
要素への読み取り専用ポインタです。 | |
typedef const charT & | reference |
const_reference と同一です。 | |
typedef const charT & | const_reference |
要素への読み取り専用参照です。 | |
typedef const_pointer | const_iterator |
読み取り専用ランダムアクセス反復子です。 | |
typedef const_iterator | iterator |
const_iterator と同一です。 | |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
読み取り専用逆反復子です。 | |
typedef const_reverse_iterator | reverse_iterator |
const_reverse_iterator と同一です。 | |
typedef size_t | size_type |
非負整数型で、現在はsize_t にtypedef されています。 | |
typedef ptrdiff_t | difference_type |
反復子の差分をとったときに返される型です。 | |
公開メンバ関数 | |
constexpr | StringView () noexcept |
デフォルトコンストラクタです。 空文字列で初期化されます。 | |
StringView (const charT *str) noexcept | |
str を参照するように初期化されます。内部で文字列長が計算されます。 | |
StringView (const charT *str, size_type len) noexcept | |
(計算済みの)文字列長を与えて初期化します。 | |
const_iterator | begin () const noexcept |
先頭要素を指す読み取り専用反復子を取得します。 | |
const_iterator | end () const noexcept |
末尾の次を指す読み取り専用反復子を取得します。 | |
const_iterator | cbegin () const noexcept |
先頭要素を指す読み取り専用反復子を取得します。 | |
const_iterator | cend () const noexcept |
末尾の次を指す読み取り専用反復子を取得します。 | |
const_reverse_iterator | rbegin () const noexcept |
末尾要素を指す読み取り専用逆反復子を取得します。 | |
const_reverse_iterator | rend () const noexcept |
先頭の前を指す読み取り専用逆反復子を取得します。 | |
const_reverse_iterator | crbegin () const noexcept |
末尾要素を指す読み取り専用逆反復子を取得します。 | |
const_reverse_iterator | crend () const noexcept |
先頭の前を指す読み取り専用逆反復子を取得します。 | |
size_type | size () const noexcept |
文字列長を返します。 | |
size_type | length () const noexcept |
文字列長を返します。 | |
size_type | max_size () const noexcept |
文字列長の最大値を返します。 | |
bool | empty () const noexcept |
空文字列であればtrue 、そうでなければfalse を返します。 | |
const charT & | operator[] (size_type pos) const |
pos 番目の文字を取得します。 [詳解] | |
const charT & | at (size_type pos) const |
pos 番目の文字を取得します。 [詳解] | |
const charT & | front () const |
最初の要素への参照を取得します。 | |
const charT & | back () const |
最後の要素への参照を取得します。 | |
const charT * | data () const noexcept |
最初の文字へのポインタを返します。 | |
void | clear () noexcept |
空文字列を設定します。 | |
void | remove_prefix (size_type n) noexcept |
最初のn 文字を取り除きます。 [詳解] | |
void | remove_suffix (size_type n) noexcept |
最後のn 文字を取り除きます。 [詳解] | |
StringView | substr (size_type pos, size_type n=npos) const noexcept |
部分文字列[pos, pos + n) を返します。 [詳解] | |
int | compare (const StringView &s) const noexcept |
文字列を比較します。 [詳解] | |
int | compare (const charT *s) const noexcept |
文字列を比較します。 [詳解] | |
静的公開変数類 | |
static const size_type | npos = size_type(-1) |
std::string のnpos と同様に用います。 | |
std::string
が持つメソッドをstd::string
を構築せずに利用するためのクラスです。 C++17のstring_viewにtypedefされる予定です。 StringViewを引数に取るフリー関数についてはこちらを御覧ください。
StringView.h の 46 行目に定義があります。
|
inline |
|
noexcept |
文字列を比較します。
[in] | s | 比較対象の文字列 |
std::strcmp()
と同様の値
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
部分文字列[pos, pos + n)
を返します。
[in] | pos | 部分文字列の最初の位置 |
[in] | n | 部分文字列の長さ |
[pos, pos + n)
、を表すStringView
オブジェクト StringView.h の 135 行目に定義があります。
© Nintendo Co., Ltd. All rights reserved.