Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::xpressive::c_regex_traits< Char > Struct Template Reference

Encapsaulates the standard C locale functions for use by the basic_regex<> class template. More...

#include <xpressive_fwd.hpp>

Inheritance diagram for boost::xpressive::c_regex_traits< Char >:
Collaboration diagram for boost::xpressive::c_regex_traits< Char >:

Public Types

typedef Char char_type
 
typedef std::basic_string
< char_type
string_type
 
typedef detail::empty_locale locale_type
 
typedef
detail::char_class_impl< Char >
::char_class_type 
char_class_type
 
typedef regex_traits_version_2_tag version_tag
 
typedef
detail::c_regex_traits_base
< Char > 
base_type
 

Public Member Functions

 c_regex_traits (locale_type const &loc=locale_type())
 Initialize a c_regex_traits object to use the global C locale. More...
 
bool operator== (c_regex_traits< char_type > const &) const
 Checks two c_regex_traits objects for equality. More...
 
bool operator!= (c_regex_traits< char_type > const &) const
 Checks two c_regex_traits objects for inequality. More...
 
string_type fold_case (char_type ch) const
 Returns a string_type containing all the characters that compare equal disregrarding case to the one passed in. More...
 
locale_type imbue (locale_type loc)
 No-op. More...
 
template<>
char widen (char ch)
 
template<>
wchar_t widen (char ch)
 
template<>
unsigned char hash (char ch)
 
template<>
unsigned char hash (wchar_t ch)
 
template<>
int value (char ch, int radix)
 
template<>
int value (wchar_t ch, int radix)
 

Static Public Member Functions

static char_type widen (char ch)
 Convert a char to a Char. More...
 
static unsigned char hash (char_type ch)
 Returns a hash value for a Char in the range [0, UCHAR_MAX]. More...
 
static char_type translate (char_type ch)
 No-op. More...
 
static char_type translate_nocase (char_type ch)
 Converts a character to lower-case using the current global C locale. More...
 
static char_type tolower (char_type ch)
 Converts a character to lower-case using the current global C locale. More...
 
static char_type toupper (char_type ch)
 Converts a character to upper-case using the current global C locale. More...
 
static bool in_range (char_type first, char_type last, char_type ch)
 Checks to see if a character is within a character range. More...
 
static bool in_range_nocase (char_type first, char_type last, char_type ch)
 Checks to see if a character is within a character range, irregardless of case. More...
 
template<typename FwdIter >
static string_type transform (FwdIter begin, FwdIter end)
 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). More...
 
template<typename FwdIter >
static string_type transform_primary (FwdIter begin, FwdIter end)
 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) when character case is not considered then v.transform_primary(G1, G2) < v.transform_primary(H1, H2). More...
 
template<typename FwdIter >
static string_type lookup_collatename (FwdIter begin, FwdIter end)
 Returns a sequence of characters that represents the collating element consisting of the character sequence designated by the iterator range [F1, F2). More...
 
template<typename FwdIter >
static char_class_type lookup_classname (FwdIter begin, FwdIter end, bool icase)
 For the character class name represented by the specified character sequence, return the corresponding bitmask representation. More...
 
static bool isctype (char_type ch, char_class_type mask)
 Tests a character against a character class bitmask. More...
 
static int value (char_type ch, int radix)
 Convert a digit character into the integer it represents. More...
 
static locale_type getloc ()
 No-op. More...
 

Protected Member Functions

void imbue (Traits const &tr)
 

Detailed Description

template<typename Char>
struct boost::xpressive::c_regex_traits< Char >

Encapsaulates the standard C locale functions for use by the basic_regex<> class template.

Member Typedef Documentation

template<typename Char >
typedef detail::c_regex_traits_base<Char> boost::xpressive::c_regex_traits< Char >::base_type
template<typename Char >
typedef detail::char_class_impl<Char>::char_class_type boost::xpressive::c_regex_traits< Char >::char_class_type
template<typename Char >
typedef Char boost::xpressive::c_regex_traits< Char >::char_type
template<typename Char >
typedef detail::empty_locale boost::xpressive::c_regex_traits< Char >::locale_type
template<typename Char >
typedef std::basic_string<char_type> boost::xpressive::c_regex_traits< Char >::string_type
template<typename Char >
typedef regex_traits_version_2_tag boost::xpressive::c_regex_traits< Char >::version_tag

Constructor & Destructor Documentation

template<typename Char >
boost::xpressive::c_regex_traits< Char >::c_regex_traits ( locale_type const &  loc = locale_type())
inline

Initialize a c_regex_traits object to use the global C locale.

References boost::xpressive::imbue().

Member Function Documentation

template<typename Char >
string_type boost::xpressive::c_regex_traits< Char >::fold_case ( char_type  ch) const
inline

Returns a string_type containing all the characters that compare equal disregrarding case to the one passed in.

This function can only be called if has_fold_case<c_regex_traits<Char> >::value is true.

Parameters
chThe source character.
Returns
string_type containing all chars which are equal to ch when disregarding case

References BOOST_MPL_ASSERT, boost::xpressive::detail::c_tolower(), and boost::xpressive::detail::c_toupper().

template<typename Char >
static locale_type boost::xpressive::c_regex_traits< Char >::getloc ( )
inlinestatic

No-op.

template<typename Char >
static unsigned char boost::xpressive::c_regex_traits< Char >::hash ( char_type  ch)
inlinestatic

Returns a hash value for a Char in the range [0, UCHAR_MAX].

Parameters
chThe source character.
Returns
a value between 0 and UCHAR_MAX, inclusive.
template<>
unsigned char boost::xpressive::c_regex_traits< char >::hash ( char  ch)
inline
template<>
unsigned char boost::xpressive::c_regex_traits< wchar_t >::hash ( wchar_t  ch)
inline
void boost::xpressive::detail::c_regex_traits_base< Char, SizeOfChar >::imbue ( Traits const &  tr)
inlineprotectedinherited
template<typename Char >
locale_type boost::xpressive::c_regex_traits< Char >::imbue ( locale_type  loc)
inline

No-op.

References boost::iostreams::imbue().

template<typename Char >
static bool boost::xpressive::c_regex_traits< Char >::in_range ( char_type  first,
char_type  last,
char_type  ch 
)
inlinestatic

Checks to see if a character is within a character range.

Parameters
firstThe bottom of the range, inclusive.
lastThe top of the range, inclusive.
chThe source character.
Returns
first <= ch && ch <= last.

References boost::last.

Referenced by boost::xpressive::c_regex_traits< Char >::in_range_nocase().

template<typename Char >
static bool boost::xpressive::c_regex_traits< Char >::in_range_nocase ( char_type  first,
char_type  last,
char_type  ch 
)
inlinestatic

Checks to see if a character is within a character range, irregardless of case.

Parameters
firstThe bottom of the range, inclusive.
lastThe top of the range, inclusive.
chThe source character.
Returns
in_range(first, last, ch) || in_range(first, last, tolower(ch)) || in_range(first, last, toupper(ch))
Attention
The default implementation doesn't do proper Unicode case folding, but this is the best we can do with the standard C locale functions.

References boost::xpressive::detail::c_tolower(), boost::xpressive::detail::c_toupper(), and boost::xpressive::c_regex_traits< Char >::in_range().

template<typename Char >
static bool boost::xpressive::c_regex_traits< Char >::isctype ( char_type  ch,
char_class_type  mask 
)
inlinestatic

Tests a character against a character class bitmask.

Parameters
chThe character to test.
maskThe character class bitmask against which to test.
Precondition
mask is a bitmask returned by lookup_classname, or is several such masks bit-or'ed together.
Returns
true if the character is a member of any of the specified character classes, false otherwise.
template<typename Char >
template<typename FwdIter >
static char_class_type boost::xpressive::c_regex_traits< Char >::lookup_classname ( FwdIter  begin,
FwdIter  end,
bool  icase 
)
inlinestatic

For the character class name represented by the specified character sequence, return the corresponding bitmask representation.

Parameters
beginA forward iterator to the start of the character sequence representing the name of the character class.
endThe end of the character sequence.
icaseSpecifies whether the returned bitmask should represent the case-insensitive version of the character class.
Returns
A bitmask representing the character class.

References boost::xpressive::lookup_classname().

template<typename Char >
template<typename FwdIter >
static string_type boost::xpressive::c_regex_traits< Char >::lookup_collatename ( FwdIter  begin,
FwdIter  end 
)
inlinestatic

Returns a sequence of characters that represents the collating element consisting of the character sequence designated by the iterator range [F1, F2).

Returns an empty string if the character sequence is not a valid collating element.

Attention
Not currently used

References BOOST_ASSERT.

template<typename Char >
bool boost::xpressive::c_regex_traits< Char >::operator!= ( c_regex_traits< char_type > const &  ) const
inline

Checks two c_regex_traits objects for inequality.

Returns
false.
template<typename Char >
bool boost::xpressive::c_regex_traits< Char >::operator== ( c_regex_traits< char_type > const &  ) const
inline

Checks two c_regex_traits objects for equality.

Returns
true.
template<typename Char >
static char_type boost::xpressive::c_regex_traits< Char >::tolower ( char_type  ch)
inlinestatic

Converts a character to lower-case using the current global C locale.

Parameters
chThe source character.
Returns
std::tolower(ch) if Char is char, std::towlower(ch) if Char is wchar_t.

References boost::xpressive::detail::c_tolower().

template<typename Char >
static char_type boost::xpressive::c_regex_traits< Char >::toupper ( char_type  ch)
inlinestatic

Converts a character to upper-case using the current global C locale.

Parameters
chThe source character.
Returns
std::toupper(ch) if Char is char, std::towupper(ch) if Char is wchar_t.

References boost::xpressive::detail::c_toupper().

template<typename Char >
template<typename FwdIter >
static string_type boost::xpressive::c_regex_traits< Char >::transform ( FwdIter  begin,
FwdIter  end 
)
inlinestatic

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).

Attention
Not currently used

References BOOST_ASSERT.

template<typename Char >
template<typename FwdIter >
static string_type boost::xpressive::c_regex_traits< Char >::transform_primary ( FwdIter  begin,
FwdIter  end 
)
inlinestatic

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) when character case is not considered then v.transform_primary(G1, G2) < v.transform_primary(H1, H2).

Attention
Not currently used

References BOOST_ASSERT.

template<typename Char >
static char_type boost::xpressive::c_regex_traits< Char >::translate ( char_type  ch)
inlinestatic

No-op.

Parameters
chThe source character.
Returns
ch
template<typename Char >
static char_type boost::xpressive::c_regex_traits< Char >::translate_nocase ( char_type  ch)
inlinestatic

Converts a character to lower-case using the current global C locale.

Parameters
chThe source character.
Returns
std::tolower(ch) if Char is char, std::towlower(ch) if Char is wchar_t.

References boost::xpressive::detail::c_tolower().

template<typename Char >
static int boost::xpressive::c_regex_traits< Char >::value ( char_type  ch,
int  radix 
)
static

Convert a digit character into the integer it represents.

Parameters
chThe digit character.
radixThe radix to use for the conversion.
Precondition
radix is one of 8, 10, or 16.
Returns
-1 if ch is not a digit character, the integer value of the character otherwise. If char_type is char, std::strtol is used for the conversion. If char_type is wchar_t, std::wcstol is used.
template<>
int boost::xpressive::c_regex_traits< char >::value ( char  ch,
int  radix 
)
inline
template<>
int boost::xpressive::c_regex_traits< wchar_t >::value ( wchar_t  ch,
int  radix 
)
inline
template<typename Char >
static char_type boost::xpressive::c_regex_traits< Char >::widen ( char  ch)
static

Convert a char to a Char.

Parameters
chThe source character.
Returns
ch if Char is char, std::btowc(ch) if Char is wchar_t.
template<>
char boost::xpressive::c_regex_traits< char >::widen ( char  ch)
inline
template<>
wchar_t boost::xpressive::c_regex_traits< wchar_t >::widen ( char  ch)
inline

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