libstdc++
std::regex_traits Struct Reference

List of all members.

Public Types

Public Member Functions

Static Public Member Functions

Protected Attributes


Detailed Description

Describes aspects of a regular expression.

A regular expression traits class that satisfies the requirements of section [28.7].

The class regex is parameterized around a set of related types and functions used to complete the definition of its semantics. This class satisfies the requirements of such a traits class.


Constructor & Destructor Documentation

std::regex_traits::regex_traits ( ) [inline]

Constructs a default traits object.

Definition at line 65 of file regex.h.


Member Function Documentation

locale_type std::regex_traits::getloc ( ) const [inline]

Gets a copy of the current locale in use by the regex_traits object.

Definition at line 274 of file regex.h.

locale_type std::regex_traits::imbue ( locale_type  __loc) [inline]

Imbues the regex_traits object with a copy of a new locale.

Parameters:
locA locale.
Returns:
a copy of the previous locale in use by the regex_traits object.
Note:
Calling imbue with a different locale than the one currently in use invalidates all cached data held by *this.

Definition at line 263 of file regex.h.

static std::size_t std::regex_traits::length ( const char_type *  __p) [inline, static]

Gives the length of a C-style string starting at __p.

Parameters:
__pa pointer to the start of a character sequence.
Returns:
the number of characters between *__p and the first default-initialized value of type char_type. In other words, uses the C-string algorithm for determining the length of a sequence of characters.

Definition at line 79 of file regex.h.

References std::basic_string::length().

template<typename _Fwd_iter >
char_class_type std::regex_traits::lookup_classname ( _Fwd_iter  __first,
_Fwd_iter  __last,
bool  __icase = false 
) const [inline]

Maps one or more characters to a named character classification.

Parameters:
firstbeginning of the character sequence.
lastone-past-the-end of the character sequence.
icaseignores the case of the classification name.
Returns:
an unspecified value that represents the character classification named by the character sequence designated by the iterator range [first, last). If icase is true, the returned mask identifies the classification regardless of the case of the characters to be matched (for example, [[:lower:]] is the same as [[:alpha:]]), otherwise a case-dependant classification is returned. The value returned shall be independent of the case of the characters in the character sequence. If the name is not recognized then returns a value that compares equal to 0.

At least the following names (or their wide-character equivalent) are supported.

  • d
  • w
  • s
  • alnum
  • alpha
  • blank
  • cntrl
  • digit
  • graph
  • lower
  • print
  • punct
  • space
  • upper
  • xdigit
Todo:
Implement this function.

Definition at line 219 of file regex.h.

template<typename _Fwd_iter >
string_type std::regex_traits::lookup_collatename ( _Fwd_iter  __first,
_Fwd_iter  __last 
) const [inline]

Gets a collation element by name.

Parameters:
firstbeginning of the collation element name.
lastone-past-the-end of the collation element name.
Returns:
a sequence of one or more characters that represents the collating element consisting of the character sequence designated by the iterator range [first, last). Returns an empty string if the character sequence is not a valid collating element.
Todo:
Implement this function.

Definition at line 176 of file regex.h.

template<typename _Fwd_iter >
string_type std::regex_traits::transform ( _Fwd_iter  __first,
_Fwd_iter  __last 
) const [inline]

Gets a sort key for a character sequence.

Parameters:
firstbeginning of the character sequence.
lastone-past-the-end of the character sequence.

Returns a sort key for the character sequence designated by the iterator range [F1, F2) such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2) then v.transform(G1, G2) < v.transform(H1, H2).

What this really does is provide a more efficient way to compare a string to multiple other strings in locales with fancy collation rules and equivalence classes.

Returns:
a locale-specific sort key equivalent to the input range.
Exceptions:
std::bad_castif the current locale does not have a collate facet.

Definition at line 132 of file regex.h.

References std::regex_constants::collate, std::use_facet(), std::collate::transform(), std::basic_string::data(), and std::basic_string::size().

template<typename _Fwd_iter >
string_type std::regex_traits::transform_primary ( _Fwd_iter  __first,
_Fwd_iter  __last 
) const [inline]

Gets a sort key for a character sequence, independant of case.

Parameters:
firstbeginning of the character sequence.
lastone-past-the-end of the character sequence.

Effects: if typeid(use_facet<collate<_Ch_type> >) == typeid(collate_byname<_Ch_type>) and the form of the sort key returned by collate_byname<_Ch_type>::transform(first, last) is known and can be converted into a primary sort key then returns that key, otherwise returns an empty string.

Todo:
Implement this function.

Definition at line 158 of file regex.h.

char_type std::regex_traits::translate ( char_type  __c) const [inline]

Performs the identity translation.

Parameters:
cA character to the locale-specific character set.
Returns:
c.

Definition at line 90 of file regex.h.

char_type std::regex_traits::translate_nocase ( char_type  __c) const [inline]

Translates a character into a case-insensitive equivalent.

Parameters:
cA character to the locale-specific character set.
Returns:
the locale-specific lower-case equivalent of c.
Exceptions:
std::bad_castif the imbued locale does not support the ctype facet.

Definition at line 103 of file regex.h.

References std::use_facet(), and std::tolower().


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