$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r60185 - in trunk/boost/spirit/home: karma/char karma/numeric karma/stream karma/string qi qi/auto qi/char qi/directive qi/string support support/char_encoding support/detail
From: joel_at_[hidden]
Date: 2010-03-05 08:31:17
Author: djowel
Date: 2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
New Revision: 60185
URL: http://svn.boost.org/trac/boost/changeset/60185
Log:
encoding directive
Added:
   trunk/boost/spirit/home/qi/directive/encoding.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/char_encoding/default_encoding.hpp
      - copied, changed from r60164, /trunk/boost/spirit/home/support/char_encoding/default.hpp
   trunk/boost/spirit/home/support/char_encoding/default_wide_encoding.hpp
      - copied, changed from r60178, /trunk/boost/spirit/home/support/char_encoding/default_wide.hpp
Removed:
   trunk/boost/spirit/home/support/char_encoding/default.hpp
   trunk/boost/spirit/home/support/char_encoding/default_wide.hpp
Text files modified: 
   trunk/boost/spirit/home/karma/char/char.hpp                             |    10 +++---                                  
   trunk/boost/spirit/home/karma/char/char_class.hpp                       |     2                                         
   trunk/boost/spirit/home/karma/numeric/bool.hpp                          |     8 ++--                                    
   trunk/boost/spirit/home/karma/numeric/int.hpp                           |     6 ++--                                    
   trunk/boost/spirit/home/karma/numeric/real.hpp                          |     6 ++--                                    
   trunk/boost/spirit/home/karma/numeric/uint.hpp                          |     6 ++--                                    
   trunk/boost/spirit/home/karma/stream/stream.hpp                         |     4 +-                                      
   trunk/boost/spirit/home/karma/string/lit.hpp                            |     6 ++--                                    
   trunk/boost/spirit/home/karma/string/symbols.hpp                        |     2                                         
   trunk/boost/spirit/home/qi/auto/meta_create.hpp                         |     8 ++--                                    
   trunk/boost/spirit/home/qi/char/char.hpp                                |    51 +++++++++++++++++++--------------       
   trunk/boost/spirit/home/qi/char/char_class.hpp                          |    17 +++++++++--                             
   trunk/boost/spirit/home/qi/directive.hpp                                |     1                                         
   trunk/boost/spirit/home/qi/string/lit.hpp                               |     4 ++                                      
   trunk/boost/spirit/home/qi/string/symbols.hpp                           |     4 +-                                      
   trunk/boost/spirit/home/support/char_class.hpp                          |    11 +++++--                                 
   trunk/boost/spirit/home/support/char_encoding/default_encoding.hpp      |     8 ++--                                    
   trunk/boost/spirit/home/support/char_encoding/default_wide_encoding.hpp |     8 ++--                                    
   trunk/boost/spirit/home/support/common_terminals.hpp                    |    21 +++++++++++--                           
   trunk/boost/spirit/home/support/detail/get_encoding.hpp                 |    60 ++++++++++++++++++++++++++++++++++++----
   20 files changed, 165 insertions(+), 78 deletions(-)
Modified: trunk/boost/spirit/home/karma/char/char.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/char/char.hpp	(original)
+++ trunk/boost/spirit/home/karma/char/char.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -331,7 +331,7 @@
                 has_modifier<Modifiers, tag::char_code_base<tag::upper> >::value;
 
             typedef literal_char<
-                typename spirit::detail::get_encoding<
+                typename spirit::detail::get_encoding_with_case<
                     Modifiers, Encoding, lower || upper>::type
               , typename get_casetag<Modifiers, lower || upper>::type
               , true>
@@ -379,7 +379,7 @@
             has_modifier<Modifiers, tag::char_code<tag::upper, CharEncoding> >::value;
 
         typedef any_char<
-            typename spirit::detail::get_encoding<
+            typename spirit::detail::get_encoding_with_case<
                 Modifiers, CharEncoding, lower || upper>::type
           , typename detail::get_casetag<Modifiers, lower || upper>::type
         > result_type;
@@ -404,7 +404,7 @@
         static bool const upper =
             has_modifier<Modifiers, tag::char_code<tag::upper, CharEncoding> >::value;
 
-        typedef typename spirit::detail::get_encoding<
+        typedef typename spirit::detail::get_encoding_with_case<
             Modifiers, CharEncoding, lower || upper>::type encoding;
         typedef typename detail::get_casetag<
             Modifiers, lower || upper>::type tag;
@@ -437,7 +437,7 @@
             has_modifier<Modifiers, tag::char_code<tag::upper, CharEncoding> >::value;
 
         typedef literal_char<
-            typename spirit::detail::get_encoding<
+            typename spirit::detail::get_encoding_with_case<
                 Modifiers, CharEncoding, lower || upper>::type
           , typename detail::get_casetag<Modifiers, lower || upper>::type
           , false
@@ -465,7 +465,7 @@
             has_modifier<Modifiers, tag::char_code<tag::upper, CharEncoding> >::value;
 
         typedef char_range<
-            typename spirit::detail::get_encoding<
+            typename spirit::detail::get_encoding_with_case<
                 Modifiers, CharEncoding, lower || upper>::type
           , typename detail::get_casetag<Modifiers, lower || upper>::type
         > result_type;
Modified: trunk/boost/spirit/home/karma/char/char_class.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/char/char_class.hpp	(original)
+++ trunk/boost/spirit/home/karma/char/char_class.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -192,7 +192,7 @@
 
         typedef char_class<
             tag_type
-          , typename spirit::detail::get_encoding<
+          , typename spirit::detail::get_encoding_with_case<
                 Modifiers, CharEncoding, lower || upper>::type
           , typename detail::get_casetag<Modifiers, lower || upper>::type
         > result_type;
Modified: trunk/boost/spirit/home/karma/numeric/bool.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/bool.hpp	(original)
+++ trunk/boost/spirit/home/karma/numeric/bool.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -246,7 +246,7 @@
 
             typedef any_bool_generator<
                 T
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
               , Policies
@@ -271,7 +271,7 @@
 
             typedef literal_bool_generator<
                 bool
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
               , bool_policies<>, false
@@ -316,7 +316,7 @@
 
             typedef literal_bool_generator<
                 T
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
               , Policies, false
@@ -359,7 +359,7 @@
 
             typedef literal_bool_generator<
                 bool
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
               , bool_policies<>, true
Modified: trunk/boost/spirit/home/karma/numeric/int.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/int.hpp	(original)
+++ trunk/boost/spirit/home/karma/numeric/int.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -329,7 +329,7 @@
 
             typedef any_int_generator<
                 T
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
               , Radix
@@ -380,7 +380,7 @@
 
             typedef literal_int_generator<
                 T
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
               , Radix, force_sign, false
@@ -437,7 +437,7 @@
 
             typedef literal_int_generator<
                 T
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
               , 10, false, true
Modified: trunk/boost/spirit/home/karma/numeric/real.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/real.hpp	(original)
+++ trunk/boost/spirit/home/karma/numeric/real.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -279,7 +279,7 @@
 
             typedef any_real_generator<
                 T, Policies
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
             > result_type;
@@ -326,7 +326,7 @@
 
             typedef literal_real_generator<
                 T, Policies
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
               , false
@@ -379,7 +379,7 @@
 
             typedef literal_real_generator<
                 T, real_policies<T>
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
               , true
Modified: trunk/boost/spirit/home/karma/numeric/uint.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/uint.hpp	(original)
+++ trunk/boost/spirit/home/karma/numeric/uint.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -353,7 +353,7 @@
 
             typedef any_uint_generator<
                 T
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
               , Radix
@@ -414,7 +414,7 @@
 
             typedef literal_uint_generator<
                 T
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
               , Radix, false
@@ -483,7 +483,7 @@
 
             typedef literal_uint_generator<
                 T
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type
               , 10, true
Modified: trunk/boost/spirit/home/karma/stream/stream.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream/stream.hpp	(original)
+++ trunk/boost/spirit/home/karma/stream/stream.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -283,7 +283,7 @@
 
         typedef any_stream_generator<
             Char
-          , typename spirit::detail::get_encoding<
+          , typename spirit::detail::get_encoding_with_case<
                 Modifiers, unused_type, lower || upper>::type
           , typename detail::get_casetag<Modifiers, lower || upper>::type
         > result_type;
@@ -322,7 +322,7 @@
         typedef typename add_const<A0>::type const_attribute;
         typedef lit_stream_generator<
             const_attribute, Char
-          , typename spirit::detail::get_encoding<
+          , typename spirit::detail::get_encoding_with_case<
                 Modifiers, unused_type, lower || upper>::type
           , typename detail::get_casetag<Modifiers, lower || upper>::type
         > result_type;
Modified: trunk/boost/spirit/home/karma/string/lit.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/string/lit.hpp	(original)
+++ trunk/boost/spirit/home/karma/string/lit.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -202,7 +202,7 @@
             has_modifier<Modifiers, tag::char_code<tag::upper, CharEncoding> >::value;
 
         typedef any_string<
-            typename spirit::detail::get_encoding<
+            typename spirit::detail::get_encoding_with_case<
                 Modifiers, CharEncoding, lower || upper>::type
           , typename detail::get_casetag<Modifiers, lower || upper>::type
         > result_type;
@@ -227,7 +227,7 @@
         typedef typename add_const<T>::type const_string;
         typedef literal_string<
             const_string
-          , typename spirit::detail::get_encoding<
+          , typename spirit::detail::get_encoding_with_case<
                 Modifiers, unused_type, lower || upper>::type
           , typename detail::get_casetag<Modifiers, lower || upper>::type
           , true
@@ -255,7 +255,7 @@
         typedef typename add_const<A0>::type const_string;
         typedef literal_string<
             const_string
-          , typename spirit::detail::get_encoding<
+          , typename spirit::detail::get_encoding_with_case<
                 Modifiers, unused_type, lower || upper>::type
           , typename detail::get_casetag<Modifiers, lower || upper>::type
           , false
Modified: trunk/boost/spirit/home/karma/string/symbols.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/string/symbols.hpp	(original)
+++ trunk/boost/spirit/home/karma/string/symbols.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -534,7 +534,7 @@
             lower || upper
           , symbols<
                 Attribute, T, Lookup
-              , typename spirit::detail::get_encoding<
+              , typename spirit::detail::get_encoding_with_case<
                     Modifiers, unused_type, lower || upper>::type
               , typename detail::get_casetag<Modifiers, lower || upper>::type>
           , reference_>::type
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 08:31:13 EST (Fri, 05 Mar 2010)
@@ -135,14 +135,14 @@
     template <>
     struct meta_create<char>
     {
-        typedef spirit::default_::char_type type;
-        static type const& call() { return spirit::default_::char_; }
+        typedef spirit::default_encoding::char_type type;
+        static type const& call() { return spirit::default_encoding::char_; }
     };
     template <>
     struct meta_create<wchar_t>
     {
-        typedef spirit::default_wide::char_type type;
-        static type const& call() { return spirit::default_wide::char_; }
+        typedef spirit::default_wide_encoding::char_type type;
+        static type const& call() { return spirit::default_wide_encoding::char_; }
     };
 
     // boolean generator
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 08:31:13 EST (Fri, 05 Mar 2010)
@@ -392,7 +392,7 @@
                 >::value;
 
             typedef literal_char<
-                typename spirit::detail::get_encoding<
+                typename spirit::detail::get_encoding_with_case<
                     Modifiers, Encoding, no_case>::type
               , no_attr
               , no_case>
@@ -414,25 +414,29 @@
 
     template <typename Modifiers>
     struct make_primitive<char, Modifiers>
-      : detail::basic_literal<Modifiers, char_encoding::default_> {};
+      : detail::basic_literal<Modifiers, char_encoding::default_encoding> {};
 
     template <typename Modifiers>
     struct make_primitive<char const(&)[2], Modifiers>
-      : detail::basic_literal<Modifiers, char_encoding::default_> {};
+      : detail::basic_literal<Modifiers, char_encoding::default_encoding> {};
 
     template <typename Modifiers>
     struct make_primitive<wchar_t, Modifiers>
-      : detail::basic_literal<Modifiers, char_encoding::default_wide> {};
+      : detail::basic_literal<Modifiers, char_encoding::default_wide_encoding> {};
 
     template <typename Modifiers>
     struct make_primitive<wchar_t const(&)[2], Modifiers>
-      : detail::basic_literal<Modifiers, char_encoding::default_wide> {};
+      : detail::basic_literal<Modifiers, char_encoding::default_wide_encoding> {};
 
     template <typename CharEncoding, typename Modifiers>
     struct make_primitive<
         terminal<tag::char_code<tag::char_, CharEncoding> >, Modifiers>
     {
-        typedef tag::char_code<tag::char_, CharEncoding> tag;
+        typedef typename
+            spirit::detail::get_encoding<Modifiers, CharEncoding>::type
+        char_encoding;
+
+        typedef tag::char_code<tag::char_, char_encoding> tag;
         typedef char_class<tag> result_type;
         result_type operator()(unused_type, unused_type) const
         {
@@ -449,16 +453,17 @@
       , Modifiers>
     {
         static bool const no_case =
-            has_modifier<
-                Modifiers
-              , tag::char_code<tag::no_case, CharEncoding>
-            >::value;
+            has_modifier<Modifiers, tag::char_code_base<tag::no_case> >::value;
+
+        typedef typename
+            spirit::detail::get_encoding<Modifiers, CharEncoding>::type
+        char_encoding;
 
         typedef typename
             mpl::if_<
                 traits::is_string<A0>
-              , char_set<CharEncoding, no_case>
-              , literal_char<CharEncoding, false, no_case>
+              , char_set<char_encoding, no_case>
+              , literal_char<char_encoding, false, no_case>
             >::type
         result_type;
 
@@ -478,12 +483,13 @@
       , Modifiers>
     {
         static bool const no_case =
-            has_modifier<
-                Modifiers
-              , tag::char_code<tag::no_case, CharEncoding>
-            >::value;
+            has_modifier<Modifiers, tag::char_code_base<tag::no_case> >::value;
 
-        typedef literal_char<CharEncoding, false, no_case> result_type;
+        typedef typename
+            spirit::detail::get_encoding<Modifiers, CharEncoding>::type
+        char_encoding;
+
+        typedef literal_char<char_encoding, false, no_case> result_type;
 
         template <typename Terminal>
         result_type operator()(Terminal const& term, unused_type) const
@@ -501,12 +507,13 @@
       , Modifiers>
     {
         static bool const no_case =
-            has_modifier<
-                Modifiers
-              , tag::char_code<tag::no_case, CharEncoding>
-            >::value;
+            has_modifier<Modifiers, tag::char_code_base<tag::no_case> >::value;
+
+        typedef typename
+            spirit::detail::get_encoding<Modifiers, CharEncoding>::type
+        char_encoding;
 
-        typedef char_range<CharEncoding, no_case> result_type;
+        typedef char_range<char_encoding, no_case> result_type;
 
         template <typename Terminal>
         result_type operator()(Terminal const& term, unused_type) const
Modified: trunk/boost/spirit/home/qi/char/char_class.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/char_class.hpp	(original)
+++ trunk/boost/spirit/home/qi/char/char_class.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -17,6 +17,8 @@
 #include <boost/spirit/home/support/common_terminals.hpp>
 #include <boost/spirit/home/support/info.hpp>
 #include <boost/spirit/home/support/modify.hpp>
+#include <boost/spirit/home/support/detail/get_encoding.hpp>
+#include <boost/mpl/eval_if.hpp>
 
 namespace boost { namespace spirit
 {
@@ -33,15 +35,20 @@
 {
     // hoist the char classification namespaces into qi sub-namespaces of the
     // same name
+    namespace default_encoding { using namespace boost::spirit::default_encoding; }
+    namespace default_wide_encoding { using namespace boost::spirit::default_wide_encoding; }
     namespace ascii { using namespace boost::spirit::ascii; }
     namespace iso8859_1 { using namespace boost::spirit::iso8859_1; }
     namespace standard { using namespace boost::spirit::standard; }
     namespace standard_wide { using namespace boost::spirit::standard_wide; }
+#if defined(BOOST_SPIRIT_UNICODE)
+    namespace unicode { using namespace boost::spirit::unicode; }
+#endif
 
-    // Import the default_ namespace into the qi namespace. This allows
+    // Import the default_encoding namespace into the qi namespace. This allows
     // for default handling of all character/string related operations if not
     // prefixed with a character set namespace.
-    using namespace boost::spirit::default_;
+    using namespace boost::spirit::default_encoding;
 
     ///////////////////////////////////////////////////////////////////////////
     // Generic char classification parser (for alnum, alpha, graph, etc.)
@@ -90,9 +97,13 @@
         static bool const no_case =
             has_modifier<Modifiers, tag::char_code_base<tag::no_case> >::value;
 
+        typedef typename
+            spirit::detail::get_encoding<Modifiers, CharEncoding>::type
+        char_encoding;
+
         typedef tag::char_code<
             typename detail::make_char_class<CharClass, no_case>::type
-          , CharEncoding>
+          , char_encoding>
         tag;
 
         typedef char_class<tag> result_type;
Modified: trunk/boost/spirit/home/qi/directive.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/directive.hpp	(original)
+++ trunk/boost/spirit/home/qi/directive.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -11,6 +11,7 @@
 #pragma once
 #endif
 
+#include <boost/spirit/home/qi/directive/encoding.hpp>
 #include <boost/spirit/home/qi/directive/hold.hpp>
 #include <boost/spirit/home/qi/directive/lexeme.hpp>
 #include <boost/spirit/home/qi/directive/no_skip.hpp>
Added: trunk/boost/spirit/home/qi/directive/encoding.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/directive/encoding.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -0,0 +1,32 @@
+/*=============================================================================
+    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(SPIRIT_ENCODING_MARCH_05_2010_0528PM)
+#define SPIRIT_ENCODING_MARCH_05_2010_0528PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename CharEncoding>
+    struct use_directive<
+        qi::domain, tag::char_code<tag::encoding, CharEncoding> > // enables encoding
+      : mpl::true_ {};
+
+    template <typename CharEncoding>
+    struct is_modifier_directive<qi::domain, tag::char_code<tag::encoding, CharEncoding> >
+      : mpl::true_ {};
+}}
+
+#endif
Modified: trunk/boost/spirit/home/qi/string/lit.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/string/lit.hpp	(original)
+++ trunk/boost/spirit/home/qi/string/lit.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -23,6 +23,7 @@
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/support/common_terminals.hpp>
 #include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/support/detail/get_encoding.hpp>
 #include <boost/fusion/include/at.hpp>
 #include <boost/fusion/include/value_at.hpp>
 #include <boost/type_traits/add_reference.hpp>
@@ -194,7 +195,8 @@
         template <typename String>
         result_type op(String const& str, mpl::true_) const
         {
-            typename Modifiers::char_encoding encoding;
+            typename spirit::detail::get_encoding<Modifiers,
+                spirit::char_encoding::default_encoding>::type encoding;
             return result_type(traits::get_c_string(str), encoding);
         }
     };
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 08:31:13 EST (Fri, 05 Mar 2010)
@@ -361,9 +361,9 @@
         typedef has_modifier<Modifiers, tag::char_code_base<tag::no_case> > no_case;
         typedef reference<symbols<Char, T, Lookup, Filter> > reference_;
         typedef no_case_filter<
-            typename spirit::detail::get_encoding<
+            typename spirit::detail::get_encoding_with_case<
                 Modifiers
-              , char_encoding::default_
+              , char_encoding::default_encoding
               , no_case::value>::type>
         nc_filter;
 
Modified: trunk/boost/spirit/home/support/char_class.hpp
==============================================================================
--- trunk/boost/spirit/home/support/char_class.hpp	(original)
+++ trunk/boost/spirit/home/support/char_class.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -50,6 +50,7 @@
     struct lowernum {};
     struct uppernum {};
     struct ucs4 {};
+    struct encoding {};
 
 #if defined(BOOST_SPIRIT_UNICODE)
 ///////////////////////////////////////////////////////////////////////////
@@ -216,13 +217,17 @@
     ///////////////////////////////////////////////////////////////////////////
     // This composite tag type encodes both the character
     // set and the specific char tag (used for classification
-    // or conversion). char_code_base can be used to test for
-    // modifier membership (see modifier.hpp)
+    // or conversion). char_code_base and char_encoding_base
+    // can be used to test for modifier membership (see modifier.hpp)
     template <typename CharClass>
     struct char_code_base {};
 
+    template <typename CharEncoding>
+    struct char_encoding_base {};
+
     template <typename CharClass, typename CharEncoding>
-    struct char_code : char_code_base<CharClass>
+    struct char_code
+        : char_code_base<CharClass>, char_encoding_base<CharEncoding>
     {
         typedef CharEncoding char_encoding; // e.g. ascii
         typedef CharClass char_class;       // e.g. tag::alnum
Deleted: trunk/boost/spirit/home/support/char_encoding/default.hpp
==============================================================================
--- trunk/boost/spirit/home/support/char_encoding/default.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
+++ (empty file)
@@ -1,28 +0,0 @@
-/*=============================================================================
-    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_MARCH_05_2010_1041AM)
-#define BOOST_SPIRIT_DEFAULT_MARCH_05_2010_1041AM
-
-#if defined(_MSC_VER)
-#pragma once
-#endif
-
-#include <boost/spirit/home/support/char_encoding/standard.hpp>
-
-namespace boost { namespace spirit { namespace char_encoding
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  default_ uses char_encoding::standard
-    ///////////////////////////////////////////////////////////////////////////
-    struct default_ : char_encoding::standard
-    {
-    };
-}}}
-
-#endif
-
Copied: trunk/boost/spirit/home/support/char_encoding/default_encoding.hpp (from r60164, /trunk/boost/spirit/home/support/char_encoding/default.hpp)
==============================================================================
--- /trunk/boost/spirit/home/support/char_encoding/default.hpp	(original)
+++ trunk/boost/spirit/home/support/char_encoding/default_encoding.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -5,8 +5,8 @@
     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_MARCH_05_2010_1041AM)
-#define BOOST_SPIRIT_DEFAULT_MARCH_05_2010_1041AM
+#if !defined(BOOST_SPIRIT_DEFAULT_ENCODING_MARCH_05_2010_1041AM)
+#define BOOST_SPIRIT_DEFAULT_ENCODING_MARCH_05_2010_1041AM
 
 #if defined(_MSC_VER)
 #pragma once
@@ -17,9 +17,9 @@
 namespace boost { namespace spirit { namespace char_encoding
 {
     ///////////////////////////////////////////////////////////////////////////
-    //  default_ uses char_encoding::standard
+    //  default_encoding uses char_encoding::standard
     ///////////////////////////////////////////////////////////////////////////
-    struct default_ : char_encoding::standard
+    struct default_encoding : char_encoding::standard
     {
     };
 }}}
Deleted: trunk/boost/spirit/home/support/char_encoding/default_wide.hpp
==============================================================================
--- trunk/boost/spirit/home/support/char_encoding/default_wide.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
+++ (empty file)
@@ -1,28 +0,0 @@
-/*=============================================================================
-    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
-
Copied: trunk/boost/spirit/home/support/char_encoding/default_wide_encoding.hpp (from r60178, /trunk/boost/spirit/home/support/char_encoding/default_wide.hpp)
==============================================================================
--- /trunk/boost/spirit/home/support/char_encoding/default_wide.hpp	(original)
+++ trunk/boost/spirit/home/support/char_encoding/default_wide_encoding.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -5,8 +5,8 @@
     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(BOOST_SPIRIT_DEFAULT_WIDE_ENCODING_MARCH_05_2010_1041AM)
+#define BOOST_SPIRIT_DEFAULT_WIDE_ENCODING_MARCH_05_2010_1041AM
 
 #if defined(_MSC_VER)
 #pragma once
@@ -17,9 +17,9 @@
 namespace boost { namespace spirit { namespace char_encoding
 {
     ///////////////////////////////////////////////////////////////////////////
-    //  default_ uses char_encoding::standard
+    //  default_wide_encoding uses char_encoding::standard
     ///////////////////////////////////////////////////////////////////////////
-    struct default_wide : char_encoding::standard_wide
+    struct default_wide_encoding : char_encoding::standard_wide
     {
     };
 }}}
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 08:31:13 EST (Fri, 05 Mar 2010)
@@ -13,13 +13,14 @@
 #endif
 
 #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/default_encoding.hpp>
+#include <boost/spirit/home/support/char_encoding/default_wide_encoding.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>
 #include <boost/spirit/home/support/char_encoding/iso8859_1.hpp>
 #include <boost/spirit/home/support/char_class.hpp>
+#include <boost/mpl/vector.hpp>
 
 #if defined(BOOST_SPIRIT_UNICODE)
 # include <boost/spirit/home/support/char_encoding/unicode.hpp>
@@ -27,6 +28,17 @@
 
 namespace boost { namespace spirit
 {
+    typedef mpl::vector<
+            spirit::char_encoding::ascii
+          , spirit::char_encoding::iso8859_1
+          , spirit::char_encoding::standard
+          , spirit::char_encoding::standard_wide
+#if defined(BOOST_SPIRIT_UNICODE)
+          , spirit::char_encoding::unicode
+#endif
+        >
+    char_encodings;
+
     // Our basic terminals
     BOOST_SPIRIT_DEFINE_TERMINALS(
         ( verbatim )
@@ -158,11 +170,12 @@
         BOOST_SPIRIT_CHAR_CODE(upper, spirit::char_encoding::charset)           \
         BOOST_SPIRIT_CHAR_CODE(lowernum, spirit::char_encoding::charset)        \
         BOOST_SPIRIT_CHAR_CODE(uppernum, spirit::char_encoding::charset)        \
+        BOOST_SPIRIT_CHAR_CODE(encoding, spirit::char_encoding::charset)        \
     }}}                                                                         \
     /***/
 
-BOOST_SPIRIT_DEFINE_CHAR_CODES(default_)
-BOOST_SPIRIT_DEFINE_CHAR_CODES(default_wide)
+BOOST_SPIRIT_DEFINE_CHAR_CODES(default_encoding)
+BOOST_SPIRIT_DEFINE_CHAR_CODES(default_wide_encoding)
 BOOST_SPIRIT_DEFINE_CHAR_CODES(ascii)
 BOOST_SPIRIT_DEFINE_CHAR_CODES(iso8859_1)
 BOOST_SPIRIT_DEFINE_CHAR_CODES(standard)
Modified: trunk/boost/spirit/home/support/detail/get_encoding.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/get_encoding.hpp	(original)
+++ trunk/boost/spirit/home/support/detail/get_encoding.hpp	2010-03-05 08:31:13 EST (Fri, 05 Mar 2010)
@@ -1,7 +1,7 @@
 //  Copyright (c) 2001-2010 Hartmut Kaiser
 //  Copyright (c) 2001-2010 Joel de Guzman
-// 
-//  Distributed under the Boost Software License, Version 1.0. (See accompanying 
+//
+//  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_GET_ENCODING_JANUARY_13_2009_1255PM)
@@ -12,16 +12,64 @@
 #endif
 
 #include <boost/mpl/identity.hpp>
+#include <boost/type_traits/is_same.hpp>
 
 namespace boost { namespace spirit { namespace detail
 {
-    template <typename Modifiers, typename Encoding, bool case_modifier = false>
-    struct get_encoding : mpl::identity<Encoding> {};
+    template <typename Modifiers, typename Encoding>
+    struct get_implicit_encoding
+    {
+        // Extract the implicit encoding from the Modifiers
+        // If one is not found, Encoding is used. The explicit
+        // encoding is the fifst viable encoding that can be
+        // extracted from the Modifiers (there can be more than one).
+
+        typedef typename
+            mpl::find_if<
+                char_encodings,
+                has_modifier<Modifiers, tag::char_encoding_base<mpl::_1> >
+            >::type
+        iter;
+
+        typedef typename
+            mpl::eval_if<
+                is_same<iter, typename mpl::end<char_encodings>::type>,
+                mpl::identity<Encoding>,
+                mpl::deref<iter>
+            >::type
+        type;
+    };
 
     template <typename Modifiers, typename Encoding>
-    struct get_encoding<Modifiers, Encoding, true>
-      : mpl::identity<typename Modifiers::char_encoding> {};
+    struct get_encoding
+    {
+        // Extract the explicit encoding from the Modifiers
+        // If one is not found, get implicit encoding (see above).
+        // Explicit encoding is the encoding explicitly declared
+        // using the encoding[c] directive.
+
+        typedef typename
+            mpl::find_if<
+                char_encodings,
+                has_modifier<Modifiers, tag::char_code<tag::encoding, mpl::_1> >
+            >::type
+        iter;
+
+        typedef typename
+            mpl::eval_if<
+                is_same<iter, typename mpl::end<char_encodings>::type>,
+                get_implicit_encoding<Modifiers, Encoding>,
+                mpl::deref<iter>
+            >::type
+        type;
+    };
 
+    template <typename Modifiers, typename Encoding, bool case_modifier = false>
+    struct get_encoding_with_case : mpl::identity<Encoding> {};
+
+    template <typename Modifiers, typename Encoding>
+    struct get_encoding_with_case<Modifiers, Encoding, true>
+        : get_encoding<Modifiers, Encoding> {};
 }}}
 
 #endif