|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60178 - in trunk/boost/spirit/home: qi/auto qi/char qi/string support support/char_encoding
From: joel_at_[hidden]
Date: 2010-03-05 01:59:04
Author: djowel
Date: 2010-03-05 01:59:03 EST (Fri, 05 Mar 2010)
New Revision: 60178
URL: http://svn.boost.org/trac/boost/changeset/60178
Log:
adding default_wide char_encoding
Added:
trunk/boost/spirit/home/support/char_encoding/default_wide.hpp (contents, props changed)
Text files modified:
trunk/boost/spirit/home/qi/auto/meta_create.hpp | 146 ++++++++++++++++++++--------------------
trunk/boost/spirit/home/qi/char/char.hpp | 14 +-
trunk/boost/spirit/home/qi/string/symbols.hpp | 4
trunk/boost/spirit/home/support/common_terminals.hpp | 2
4 files changed, 84 insertions(+), 82 deletions(-)
Modified: trunk/boost/spirit/home/qi/auto/meta_create.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auto/meta_create.hpp (original)
+++ trunk/boost/spirit/home/qi/auto/meta_create.hpp 2010-03-05 01:59:03 EST (Fri, 05 Mar 2010)
@@ -30,8 +30,8 @@
{
///////////////////////////////////////////////////////////////////////////
// compatible STL containers
- template <typename Container>
- struct meta_create_container
+ template <typename Container>
+ struct meta_create_container
{
typedef make_unary_proto_expr<
typename Container::value_type
@@ -48,13 +48,13 @@
///////////////////////////////////////////////////////////////////////////
// Fusion sequences
- template <typename Sequence>
- struct meta_create_sequence
+ template <typename Sequence>
+ struct meta_create_sequence
{
// create a mpl sequence from the given fusion sequence
typedef typename mpl::fold<
typename fusion::result_of::as_vector<Sequence>::type
- , mpl::vector<>, mpl::push_back<mpl::_, mpl::_>
+ , mpl::vector<>, mpl::push_back<mpl::_, mpl::_>
>::type sequence_type;
typedef make_nary_proto_expr<
@@ -70,10 +70,10 @@
};
///////////////////////////////////////////////////////////////////////////
- // the default is to use the standard streaming operator unless it's a
+ // the default is to use the standard streaming operator unless it's a
// STL container or a fusion sequence
- // The default implementation will be chosen if no predefined mapping of
+ // The default implementation will be chosen if no predefined mapping of
// the data type T to a Qi component is defined.
struct no_auto_mapping_exists {};
@@ -95,8 +95,8 @@
///////////////////////////////////////////////////////////////////////////
// optional
- template <typename T>
- struct meta_create<boost::optional<T> >
+ template <typename T>
+ struct meta_create<boost::optional<T> >
{
typedef make_unary_proto_expr<
T, proto::tag::negate, qi::domain
@@ -112,8 +112,8 @@
///////////////////////////////////////////////////////////////////////////
// alternatives
- template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
- struct meta_create<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+ template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
+ struct meta_create<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
{
typedef make_nary_proto_expr<
typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types
@@ -132,99 +132,99 @@
// predefined specializations for primitive components
// character generator
- template <>
- struct meta_create<char>
- {
- typedef spirit::standard::char_type type;
- static type const& call() { return spirit::standard::char_; }
- };
- template <>
- struct meta_create<wchar_t>
- {
- typedef spirit::standard_wide::char_type type;
- static type const& call() { return spirit::standard_wide::char_; }
+ template <>
+ struct meta_create<char>
+ {
+ typedef spirit::default_::char_type type;
+ static type const& call() { return spirit::default_::char_; }
+ };
+ template <>
+ struct meta_create<wchar_t>
+ {
+ typedef spirit::default_wide::char_type type;
+ static type const& call() { return spirit::default_wide::char_; }
};
// boolean generator
- template <>
- struct meta_create<bool>
- {
- typedef spirit::bool__type type;
+ template <>
+ struct meta_create<bool>
+ {
+ typedef spirit::bool__type type;
static type const& call() { return spirit::bool_; }
};
// integral generators
- template <>
- struct meta_create<int>
- {
- typedef spirit::int__type type;
+ template <>
+ struct meta_create<int>
+ {
+ typedef spirit::int__type type;
static type const& call() { return spirit::int_; }
};
- template <>
- struct meta_create<short>
- {
- typedef spirit::short__type type;
+ template <>
+ struct meta_create<short>
+ {
+ typedef spirit::short__type type;
static type const& call() { return spirit::short_; }
};
- template <>
- struct meta_create<long>
+ template <>
+ struct meta_create<long>
{
- typedef spirit::long__type type;
+ typedef spirit::long__type type;
static type const& call() { return spirit::long_; }
};
- template <>
- struct meta_create<unsigned int>
- {
- typedef spirit::uint__type type;
+ template <>
+ struct meta_create<unsigned int>
+ {
+ typedef spirit::uint__type type;
static type const& call() { return spirit::uint_; }
};
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
- template <>
- struct meta_create<unsigned short>
- {
- typedef spirit::ushort__type type;
+ template <>
+ struct meta_create<unsigned short>
+ {
+ typedef spirit::ushort__type type;
static type const& call() { return spirit::ushort_; }
};
#endif
- template <>
- struct meta_create<unsigned long>
- {
- typedef spirit::ulong__type type;
+ template <>
+ struct meta_create<unsigned long>
+ {
+ typedef spirit::ulong__type type;
static type const& call() { return spirit::ulong_; }
};
#ifdef BOOST_HAS_LONG_LONG
- template <>
- struct meta_create<boost::long_long_type>
- {
- typedef spirit::long_long_type type;
+ template <>
+ struct meta_create<boost::long_long_type>
+ {
+ typedef spirit::long_long_type type;
static type const& call() { return spirit::long_long; }
};
- template <>
- struct meta_create<boost::ulong_long_type>
- {
- typedef spirit::ulong_long_type type;
+ template <>
+ struct meta_create<boost::ulong_long_type>
+ {
+ typedef spirit::ulong_long_type type;
static type const& call() { return spirit::ulong_long; }
};
#endif
// floating point generators
- template <>
- struct meta_create<float>
- {
- typedef spirit::float__type type;
+ template <>
+ struct meta_create<float>
+ {
+ typedef spirit::float__type type;
static type const& call() { return spirit::float_; }
};
- template <>
- struct meta_create<double>
- {
- typedef spirit::double__type type;
+ template <>
+ struct meta_create<double>
+ {
+ typedef spirit::double__type type;
static type const& call() { return spirit::double_; }
};
- template <>
- struct meta_create<long double>
- {
- typedef spirit::long_double_type type;
+ template <>
+ struct meta_create<long double>
+ {
+ typedef spirit::long_double_type type;
static type const& call() { return spirit::long_double; }
};
}}}
@@ -240,14 +240,14 @@
///////////////////////////////////////////////////////////////////////////
// dispatch this to the qi related specializations
template <typename T>
- struct meta_create<qi::domain, T>
+ struct meta_create<qi::domain, T>
: create_parser<typename spirit::detail::remove_const_ref<T>::type> {};
///////////////////////////////////////////////////////////////////////////
- // Check whether a valid mapping exits for the given data type to a Karma
- // component
+ // Check whether a valid mapping exits for the given data type to a Karma
+ // component
template <typename T>
- struct meta_create_exists<qi::domain, T>
+ struct meta_create_exists<qi::domain, T>
: mpl::not_<is_same<
qi::no_auto_mapping_exists
, typename meta_create<qi::domain, T>::type
Modified: trunk/boost/spirit/home/qi/char/char.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/char.hpp (original)
+++ trunk/boost/spirit/home/qi/char/char.hpp 2010-03-05 01:59:03 EST (Fri, 05 Mar 2010)
@@ -122,7 +122,7 @@
template <typename CharParam, typename Context>
bool test(CharParam ch_, Context&) const
{
- return traits::ischar<CharParam, char_encoding>::call(ch_) &&
+ return traits::ischar<CharParam, char_encoding>::call(ch_) &&
ch == char_type(ch_);
}
@@ -296,7 +296,7 @@
template <typename CharParam, typename Context>
bool test(CharParam ch, Context&) const
{
- return traits::ischar<CharParam, char_encoding>::call(ch) &&
+ return traits::ischar<CharParam, char_encoding>::call(ch) &&
chset.test(char_type(ch));
}
@@ -358,7 +358,7 @@
template <typename CharParam, typename Context>
bool test(CharParam ch, Context&) const
{
- return traits::ischar<CharParam, char_encoding>::call(ch) &&
+ return traits::ischar<CharParam, char_encoding>::call(ch) &&
chset.test(char_type(ch));
}
@@ -414,19 +414,19 @@
template <typename Modifiers>
struct make_primitive<char, Modifiers>
- : detail::basic_literal<Modifiers, char_encoding::standard> {};
+ : detail::basic_literal<Modifiers, char_encoding::default_> {};
template <typename Modifiers>
struct make_primitive<char const(&)[2], Modifiers>
- : detail::basic_literal<Modifiers, char_encoding::standard> {};
+ : detail::basic_literal<Modifiers, char_encoding::default_> {};
template <typename Modifiers>
struct make_primitive<wchar_t, Modifiers>
- : detail::basic_literal<Modifiers, char_encoding::standard_wide> {};
+ : detail::basic_literal<Modifiers, char_encoding::default_wide> {};
template <typename Modifiers>
struct make_primitive<wchar_t const(&)[2], Modifiers>
- : detail::basic_literal<Modifiers, char_encoding::standard_wide> {};
+ : detail::basic_literal<Modifiers, char_encoding::default_wide> {};
template <typename CharEncoding, typename Modifiers>
struct make_primitive<
Modified: trunk/boost/spirit/home/qi/string/symbols.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/string/symbols.hpp (original)
+++ trunk/boost/spirit/home/qi/string/symbols.hpp 2010-03-05 01:59:03 EST (Fri, 05 Mar 2010)
@@ -179,7 +179,7 @@
{
lookup->for_each(f);
}
-
+
template <typename Str>
value_type& at(Str const& str)
{
@@ -363,7 +363,7 @@
typedef no_case_filter<
typename spirit::detail::get_encoding<
Modifiers
- , char_encoding::standard
+ , char_encoding::default_
, no_case::value>::type>
nc_filter;
Added: trunk/boost/spirit/home/support/char_encoding/default_wide.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/char_encoding/default_wide.hpp 2010-03-05 01:59:03 EST (Fri, 05 Mar 2010)
@@ -0,0 +1,28 @@
+/*=============================================================================
+ Copyright (c) 2001-2010 Hartmut Kaiser
+ Copyright (c) 2001-2010 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_DEFAULT_WIDE_MARCH_05_2010_1041AM)
+#define BOOST_SPIRIT_DEFAULT_WIDE_MARCH_05_2010_1041AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/char_encoding/standard_wide.hpp>
+
+namespace boost { namespace spirit { namespace char_encoding
+{
+ ///////////////////////////////////////////////////////////////////////////
+ // default_ uses char_encoding::standard
+ ///////////////////////////////////////////////////////////////////////////
+ struct default_wide : char_encoding::standard_wide
+ {
+ };
+}}}
+
+#endif
+
Modified: trunk/boost/spirit/home/support/common_terminals.hpp
==============================================================================
--- trunk/boost/spirit/home/support/common_terminals.hpp (original)
+++ trunk/boost/spirit/home/support/common_terminals.hpp 2010-03-05 01:59:03 EST (Fri, 05 Mar 2010)
@@ -14,6 +14,7 @@
#include <boost/spirit/home/support/terminal.hpp>
#include <boost/spirit/home/support/char_encoding/default.hpp>
+#include <boost/spirit/home/support/char_encoding/default_wide.hpp>
#include <boost/spirit/home/support/char_encoding/standard.hpp>
#include <boost/spirit/home/support/char_encoding/standard_wide.hpp>
#include <boost/spirit/home/support/char_encoding/ascii.hpp>
@@ -161,6 +162,7 @@
/***/
BOOST_SPIRIT_DEFINE_CHAR_CODES(default_)
+BOOST_SPIRIT_DEFINE_CHAR_CODES(default_wide)
BOOST_SPIRIT_DEFINE_CHAR_CODES(ascii)
BOOST_SPIRIT_DEFINE_CHAR_CODES(iso8859_1)
BOOST_SPIRIT_DEFINE_CHAR_CODES(standard)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk