Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Struct template cpp_regex_traits

boost::xpressive::cpp_regex_traits — Encapsaulates a std::locale for use by the basic_regex<> class template.

Synopsis

// In header: <boost/xpressive/traits/cpp_regex_traits.hpp>

template<typename Char> 
struct cpp_regex_traits {
  // types
  typedef                            ;      
  typedef  ;    
  typedef                     ;    
  typedef                     ;
  typedef regex_traits_version_2_tag     ;    
  typedef                     ;      

  // construct/copy/destruct
  ( = );

  // public member functions
   (cpp_regex_traits< ) ;
   (cpp_regex_traits< ) ;
   () ;
   () ;
   () ;
   () ;
   () ;
   (, , ) ;
  template<typename FwdIter> 
     (, ) ;
  template<typename FwdIter> 
     (, ) ;
  template<typename FwdIter> 
     (, , ) ;
   (, ) ;
   (, ) ;
   ();
   () ;
   ();
   ();
   ();
   ();

  // public static functions
   ();
   ();
   (, , );
};

Description

cpp_regex_traits public construct/copy/destruct

  1. ( loc = );

    Initialize a cpp_regex_traits object to use the specified std::locale, or the global std::locale if none is specified.

cpp_regex_traits public member functions

  1.  (cpp_regex_traits<  that) ;

    Checks two cpp_regex_traits objects for equality

    Returns:

    this->getloc() == that.getloc().

  2.  (cpp_regex_traits<  that) ;

    Checks two cpp_regex_traits objects for inequality

    Returns:

    this->getloc() != that.getloc().

  3.  ( ch) ;

    Convert a char to a Char

    Parameters:

    ch

    The source character.

    Returns:

    std::use_facet<std::ctype<char_type> >(this->getloc()).widen(ch).

  4.  ( ch) ;

    Converts a character to lower-case using the internally-stored std::locale.

    Parameters:

    ch

    The source character.

    Returns:

    std::tolower(ch, this->getloc()).

  5.  ( ch) ;

    Converts a character to lower-case using the internally-stored std::locale.

    Parameters:

    ch

    The source character.

    Returns:

    std::tolower(ch, this->getloc()).

  6.  ( ch) ;

    Converts a character to upper-case using the internally-stored std::locale.

    Parameters:

    ch

    The source character.

    Returns:

    std::toupper(ch, this->getloc()).

  7.  ( ch) ;

    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<cpp_regex_traits<Char> >value is true.

    Parameters:

    ch

    The source character.

    Returns:

    string_type containing all chars which are equal to ch when disregarding case

  8.  ( first,  last,  ch) ;

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

    [Note] Note

    The default implementation doesn't do proper Unicode case folding, but this is the best we can do with the standard ctype facet.

    Parameters:

    ch

    The source character.

    first

    The bottom of the range, inclusive.

    last

    The top of the range, inclusive.

    Returns:

    in_range(first, last, ch) || in_range(first, last, tolower(ch, this->getloc())) || in_range(first, last, toupper(ch, this->getloc()))

  9. template<typename FwdIter> 
       (, ) ;

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

    [Note] Note

    Not currently used

  10. template<typename FwdIter> 
       (, ) ;

    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.

    [Note] Note

    Not currently used

  11. template<typename FwdIter> 
       
      ( begin,  end,  icase) ;

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

    Parameters:

    begin

    A forward iterator to the start of the character sequence representing the name of the character class.

    end

    The end of the character sequence.

    icase

    Specifies whether the returned bitmask should represent the case-insensitive version of the character class.

    Returns:

    A bitmask representing the character class.

  12.  ( ch,  mask) ;

    Tests a character against a character class bitmask.

    Parameters:

    ch

    The character to test.

    mask

    The character class bitmask against which to test.

    Requires:

    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.

  13.  ( ch,  radix) ;

    Convert a digit character into the integer it represents.

    Parameters:

    ch

    The digit character.

    radix

    The radix to use for the conversion.

    Requires:

    radix is one of 8, 10, or 16.

    Returns:

    -1 if ch is not a digit character, the integer value of the character otherwise. The conversion is performed by imbueing a std::stringstream with this->getloc(); setting the radix to one of oct, hex or dec; inserting ch into the stream; and extracting an int.

  14.  ( loc);

    Imbues *this with loc

    Parameters:

    loc

    A std::locale.

    Returns:

    the previous std::locale used by *this.

  15.  () ;

    Returns the current std::locale used by *this.

  16.  ( ch);
  17.  ( ch);
  18.  ( ch);
  19.  ( ch);

cpp_regex_traits public static functions

  1.  ( ch);

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

    Parameters:

    ch

    The source character.

    Returns:

    a value between 0 and UCHAR_MAX, inclusive.

  2.  ( ch);

    No-op

    Parameters:

    ch

    The source character.

    Returns:

    ch

  3.  ( first,  last,  ch);

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

    Parameters:

    ch

    The source character.

    first

    The bottom of the range, inclusive.

    last

    The top of the range, inclusive.

    Returns:

    first <= ch && ch <= last.


PrevUpHomeNext