Update of /cvsroot/boost/boost/boost/xpressive/detail/static
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18713/detail/static
Modified Files:
transmogrify.hpp width_of.hpp
Log Message:
more work in support of non-char data
Index: transmogrify.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/static/transmogrify.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- transmogrify.hpp 30 Apr 2007 00:28:21 -0000 1.2
+++ transmogrify.hpp 30 May 2007 07:58:22 -0000 1.3
@@ -15,10 +15,10 @@
#include <cstring> // for std::strlen
#include <boost/mpl/if.hpp>
+#include <boost/mpl/or.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/assert.hpp>
-#include <boost/type_traits/is_array.hpp>
-#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/is_same.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/core/matchers.hpp>
#include <boost/xpressive/detail/static/placeholders.hpp>
@@ -27,14 +27,9 @@
namespace boost { namespace xpressive { namespace detail
{
- template<typename T>
- struct is_string_literal
- : is_array<typename remove_reference<T>::type>
- {};
-
- template<typename T>
- struct is_string_literal<T *>
- : mpl::true_
+ template<typename T, typename Char>
+ struct is_char_literal
+ : mpl::or_<is_same<T, Char>, is_same<T, char> >
{};
///////////////////////////////////////////////////////////////////////////////
@@ -43,33 +38,34 @@
template<typename BidiIter, typename ICase, typename Traits, typename
Matcher, typename EnableIf = void>
struct default_transmogrify
{
- typedef typename iterator_value<BidiIter>::type char_type;
- typedef std::basic_string<char_type> string_type;
+ typedef typename Traits::char_type char_type;
+ typedef typename Traits::string_type string_type;
typedef typename mpl::if_
<
- is_string_literal<Matcher>
- , string_matcher<Traits, ICase::value>
+ is_char_literal<Matcher, char_type>
, literal_matcher<Traits, ICase::value, false>
+ , string_matcher<Traits, ICase::value>
>::type type;
template<typename Matcher2, typename Visitor>
static type call(Matcher2 const &m, Visitor &visitor)
{
- return default_transmogrify::call_(m, visitor,
is_string_literal<Matcher2>());
+ return default_transmogrify::call_(m, visitor,
is_char_literal<Matcher2, char_type>());
}
template<typename Matcher2, typename Visitor>
- static type call_(Matcher2 const &m, Visitor &visitor, mpl::false_)
+ static type call_(Matcher2 const &m, Visitor &visitor, mpl::true_)
{
char_type ch = char_cast<char_type>(m, visitor.traits());
return type(ch, visitor.traits());
}
template<typename Matcher2, typename Visitor>
- static type call_(Matcher2 const &m, Visitor &visitor, mpl::true_)
+ static type call_(Matcher2 const &m, Visitor &visitor, mpl::false_)
{
- return type(string_cast<char_type>(string_type(m),
visitor.traits()), visitor.traits());
+ string_type str = string_cast<string_type>(m, visitor.traits());
+ return type(str, visitor.traits());
}
};
Index: width_of.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/static/width_of.hpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- width_of.hpp 21 May 2007 03:21:33 -0000 1.20
+++ width_of.hpp 30 May 2007 07:58:22 -0000 1.21
@@ -63,6 +63,7 @@
: mpl::size_t<Expr::width> // char literals
{};
+ // BUGBUG this is wrong!!!
template<typename Expr>
struct width_of_terminal<Expr, false>
: mpl::size_t<1> // char literals
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs