cpp_regex_traits 構造体テンプレート
-
template<typename Char>
struct cpp_regex_traits basic_regex<>
クラステンプレートで使用するためにstd::locale
をカプセル化する。
概要
// ヘッダ:<boost/xpressive/xpressive_fwd.hpp
> template<typename Char> structcpp_regex_traits
{ // 構築、コピー、解体cpp_regex_traits
(locale_type const & = locale_type()); // 公開メンバ関数 booloperator==
(cpp_regex_traits
< char_type > const &) const; booloperator!=
(cpp_regex_traits
< char_type > const &) const; char_typewiden
(char) const; char_typetranslate_nocase
(char_type) const; char_typetolower
(char_type) const; char_typetoupper
(char_type) const; string_typefold_case
(char_type) const; boolin_range_nocase
(char_type, char_type, char_type) const; template<typename FwdIter> string_typetransform_primary
(FwdIter, FwdIter) const; template<typename FwdIter> string_typelookup_collatename
(FwdIter, FwdIter) const; template<typename FwdIter> char_class_typelookup_classname
(FwdIter, FwdIter, bool) const; boolisctype
(char_type, char_class_type) const; intvalue
(char_type, int) const; locale_typeimbue
(locale_type); locale_typegetloc
() const; template<> unsigned charhash
(unsigned char); template<> unsigned charhash
(char); template<> unsigned charhash
(signed char); template<> unsigned charhash
(wchar_t); // 公開静的メンバ関数 static unsigned charhash
(char_type); static char_typetranslate
(char_type); static boolin_range
(char_type, char_type, char_type); };
説明
cpp_regex_traits
構築、コピー、解体の公開演算
-
cpp_regex_traits(locale_type const &loc = locale_type())
指定した
std::locale
を使用するcpp_regex_traits
オブジェクトを初期化する。引数を省略した場合はグローバルなstd::locale
を使用する。
cpp_regex_traits
公開メンバ関数
-
bool operator==(cpp_regex_traits<char_type> const &that) const
2 つの
cpp_regex_traits
オブジェクトが等値か調べる。- 戻り値
this->getloc() == that.getloc()。
-
bool operator!=(cpp_regex_traits<char_type> const &that) const
2 つの
cpp_regex_traits
オブジェクトが等値でないか調べる。- 戻り値
this->getloc() != that.getloc()。
-
char_type widen(char ch) const
char
型の値をChar
型に変換する。- パラメータ
ch -- 元の文字。
- 戻り値
std::use_facet<std::ctype<char_type>>(this->getloc()).widen(ch)。
-
char_type translate_nocase(char_type ch)
内部保持した
std::locale
を使用して、文字を小文字に変換する。- パラメータ
ch -- 元の文字。
- 戻り値
std::tolower(ch, this->getloc())。
-
char_type tolower(char_type ch)
内部保持した
std::locale
を使用して、文字を小文字に変換する。- パラメータ
ch -- 元の文字。
- 戻り値
std::tolower(ch, this->getloc())。
-
char_type toupper(char_type ch)
内部保持した
std::locale
を使用して、文字を大文字に変換する。- パラメータ
ch -- 元の文字。
- 戻り値
std::toupper(ch, this->getloc())。
-
string_type fold_case(char_type ch) const
渡した文字と大文字小文字を区別せずに比較すると等値となる文字をすべて含む
string_type
を返す。この関数が呼び出されるのは has_fold_case<cpp_regex_traits<Char>> が真の場合のみである。- パラメータ
ch -- 元の文字。
- 戻り値
ch
と大文字小文字を区別せずに比較すると等値となる文字をすべて含むstring_type
-
bool in_range_nocase(char_type first, char_type last, char_type ch)
文字が文字範囲に含まれるか調べる。大文字小文字を区別しない。
注釈
既定の実装は適正な Unicode ケースフォールディングを行わないが、標準の
ctype
ファセットではこれが最善である。
-
template<typename FwdIter>
string_type transform_primary(FwdIter, FwdIter) イテレータ範囲
[F1, F2)
が示す文字シーケンスのソートキーを返す。大文字小文字を区別せずにソートして文字シーケンス[G1, G2)
が文字シーケンス[H1, H2)
の前に現れる場合に v.transform(G1, G2) < v.transform(H1, H2) とならなければならない。注釈
現在使用していない。
-
template<typename FwdIter>
string_type lookup_collatename(FwdIter begin, FwdIter end) イテレータ範囲
[F1, F2)
が示す文字シーケンスが構成する照合要素を表す文字シーケンスを返す。文字シーケンスが正しい照合要素でなければ空文字列を返す。注釈
現在使用していない。
-
template<typename FwdIter>
char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase) 指定した文字シーケンスが表す文字分類について、相当するビットマスクを返す。
- パラメータ
begin -- 文字分類の名前を表す文字シーケンスの先頭を指す前進イテレータ。
end -- 文字シーケンスの終端。
icase -- 戻り値のビットマスクが大文字小文字を区別しない文字分類を表すかを指定する。
- 戻り値
文字分類を表すビットマスク。
-
bool isctype(char_type ch, char_class_type mask)
文字分類ビットマスクに対して文字をテストする。
- パラメータ
ch -- テストする文字。
mask -- テストする文字分類のビットマスク。
- 要件
mask
はlookup_classname
が返したビットマスクか、それらのビット和。- 戻り値
文字が指定した文字分類に含まれれば真、それ以外は偽。
-
int value(char_type ch, int radix) const
数字を数値に変換する。
- パラメータ
ch -- 数字。
radix -- 変換に使用する序数。
- 要件
radix
は 8 、10 、16 のいずれか。- 戻り値
ch
が数字でなければ-1
、それ以外は文字が表す数値。変換は次の要領で行う:std::stringstream
に this->getloc() を指示する。序数を 8 、16 、10 のいずれかに設定する。ch
をストリームに挿入する。int
を抽出する。
-
locale_type imbue(locale_type loc)
*this に
loc
を指示する。- パラメータ
loc --
std::locale
。- 戻り値
*this が直前まで使用していた
std::locale
。
-
locale_type getloc() const
*this が現在使用している
std::locale
を返す。
-
template<>
unsigned char hash(unsigned char ch)
-
template<>
unsigned char hash(char ch)
-
template<>
unsigned char hash(signed char ch)
-
template<>
unsigned char hash(wchar_t ch)
cpp_regex_traits
公開静的メンバ関数
-
static unsigned char hash(char_type ch)
[0, UCHAR_MAX]
の範囲でChar
のハッシュ値を返す。- パラメータ
ch -- 元の文字。
- 戻り値
0
以上UCHAR_MAX
以下の値。
-
static char_type translate(char_type ch)
何もしない。
- パラメータ
ch -- 元の文字。
- 戻り値
ch