Update of /cvsroot/boost/boost/boost/xpressive/traits
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16356/traits

Modified Files:
        c_regex_traits.hpp cpp_regex_traits.hpp 
Log Message:
support for format_perl

Index: c_regex_traits.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/traits/c_regex_traits.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- c_regex_traits.hpp  21 Dec 2006 03:51:42 -0000      1.6
+++ c_regex_traits.hpp  18 Mar 2007 00:29:11 -0000      1.7
@@ -121,7 +121,7 @@
     typedef std::basic_string<char_type> string_type;
     typedef detail::empty_locale locale_type;
     typedef typename detail::char_class_impl<Char>::char_class_type 
char_class_type;
-    typedef regex_traits_version_1_tag version_tag;
+    typedef regex_traits_version_2_tag version_tag;
     typedef detail::c_regex_traits_base<Char> base_type;
 
     /// Initialize a c_regex_traits object to use the global C locale.
@@ -181,6 +181,45 @@
         return detail::c_tolower(ch);
     }
 
+    /// Converts a character to lower-case using the current global C locale.
+    ///
+    /// \param ch The source character.
+    /// \return std::tolower(ch) if Char is char, std::towlower(ch) if Char is 
wchar_t.
+    static char_type tolower(char_type ch)
+    {
+        return detail::c_tolower(ch);
+    }
+
+    /// Converts a character to upper-case using the current global C locale.
+    ///
+    /// \param ch The source character.
+    /// \return std::toupper(ch) if Char is char, std::towupper(ch) if Char is 
wchar_t.
+    static char_type toupper(char_type ch)
+    {
+        return detail::c_toupper(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<cc_regex_traits<Char> >::value is true.
+    ///
+    /// \param ch The source character.
+    /// \return string_type containing all chars which are equal to ch when 
disregarding
+    ///     case
+    //typedef array<char_type, 2> fold_case_type;
+    string_type fold_case(char_type ch) const
+    {
+        BOOST_MPL_ASSERT((is_same<char_type, char>));
+        char_type ntcs[] = {
+            detail::c_tolower(ch)
+          , detail::c_toupper(ch)
+          , 0
+        };
+        if(ntcs[1] == ntcs[0])
+            ntcs[1] = 0;
+        return string_type(ntcs);
+    }
+
     /// Checks to see if a character is within a character range.
     ///
     /// \param first The bottom of the range, inclusive.
@@ -361,6 +400,13 @@
 }
 #endif
 
+// Narrow C traits has fold_case() member function.
+template<>
+struct has_fold_case<c_regex_traits<char> >
+  : mpl::true_
+{
+};
+
 }}
 
 #endif

Index: cpp_regex_traits.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/traits/cpp_regex_traits.hpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- cpp_regex_traits.hpp        21 Dec 2006 03:51:42 -0000      1.17
+++ cpp_regex_traits.hpp        18 Mar 2007 00:29:11 -0000      1.18
@@ -286,20 +286,9 @@
 
     #endif
 
-    template<typename Char>
-    struct version_tag
-    {
-        typedef regex_traits_version_1_tag type;
-    };
-
-    template<>
-    struct version_tag<char>
-    {
-        typedef regex_traits_version_1_case_fold_tag type;
-    };
-
 } // namespace detail
 
+
 ///////////////////////////////////////////////////////////////////////////////
 // cpp_regex_traits
 //
@@ -313,7 +302,7 @@
     typedef std::basic_string<char_type> string_type;
     typedef std::locale locale_type;
     typedef detail::umaskex_t char_class_type;
-    typedef typename detail::version_tag<Char>::type version_tag;
+    typedef regex_traits_version_2_tag version_tag;
     typedef detail::cpp_regex_traits_base<Char> base_type;
 
     /// Initialize a cpp_regex_traits object to use the specified std::locale,
@@ -378,10 +367,27 @@
         return this->ctype_->tolower(ch);
     }
 
+    /// Converts a character to lower-case using the internally-stored 
std::locale.
+    ///
+    /// \param ch The source character.
+    /// \return std::tolower(ch, this->getloc()).
+    char_type tolower(char_type ch) const
+    {
+        return this->ctype_->tolower(ch);
+    }
+
+    /// Converts a character to upper-case using the internally-stored 
std::locale.
+    ///
+    /// \param ch The source character.
+    /// \return std::toupper(ch, this->getloc()).
+    char_type toupper(char_type ch) const
+    {
+        return this->ctype_->toupper(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 is_convertible<version_tag*, 
regex_traits_version_1_case_fold_tag*>::value
-    /// is true.
+    /// if has_fold_case<cpp_regex_traits<Char> >::value is true.
     ///
     /// \param ch The source character.
     /// \return string_type containing all chars which are equal to ch when 
disregarding
@@ -671,6 +677,14 @@
 }
 #endif
 
+// Narrow C++ traits has fold_case() member function.
+template<>
+struct has_fold_case<cpp_regex_traits<char> >
+  : mpl::true_
+{
+};
+
+
 }}
 
 #endif


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to