1 // Copyright (c) 2001-2011 Hartmut Kaiser 2 // Copyright (c) 2001-2011 Joel de Guzman 3 // 4 // Distributed under the Boost Software License, Version 1.0. (See accompanying 5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 7 #ifndef BOOST_SPIRIT_KARMA_DIRECTIVE_UPPER_LOWER_CASE_HPP 8 #define BOOST_SPIRIT_KARMA_DIRECTIVE_UPPER_LOWER_CASE_HPP 9 10 #if defined(_MSC_VER) 11 #pragma once 12 #endif 13 14 #include <boost/spirit/home/support/common_terminals.hpp> 15 #include <boost/spirit/home/support/modify.hpp> 16 #include <boost/spirit/home/karma/domain.hpp> 17 #include <boost/spirit/home/karma/meta_compiler.hpp> 18 19 namespace boost { namespace spirit 20 { 21 /////////////////////////////////////////////////////////////////////////// 22 // Enablers 23 /////////////////////////////////////////////////////////////////////////// 24 template <typename CharEncoding> 25 struct use_directive< 26 karma::domain, tag::char_code<tag::upper, CharEncoding> > // enables upper 27 : mpl::true_ {}; 28 29 template <typename CharEncoding> 30 struct use_directive< 31 karma::domain, tag::char_code<tag::lower, CharEncoding> > // enables lower 32 : mpl::true_ {}; 33 34 /////////////////////////////////////////////////////////////////////////// 35 template <typename CharEncoding> 36 struct is_modifier_directive<karma::domain 37 , tag::char_code<tag::upper, CharEncoding> > 38 : mpl::true_ {}; 39 40 template <typename CharEncoding> 41 struct is_modifier_directive<karma::domain 42 , tag::char_code<tag::lower, CharEncoding> > 43 : mpl::true_ {}; 44 45 /////////////////////////////////////////////////////////////////////////// 46 // Don't add tag::upper or tag::lower if there is already one of those in 47 // the modifier list 48 template <typename Current, typename CharEncoding> 49 struct compound_modifier< 50 Current 51 , tag::char_code<tag::upper, CharEncoding> 52 , typename enable_if< 53 has_modifier<Current, tag::char_code<tag::lower, CharEncoding> > 54 >::type 55 > 56 : Current 57 { compound_modifierboost::spirit::compound_modifier58 compound_modifier() 59 : Current() {} 60 compound_modifierboost::spirit::compound_modifier61 compound_modifier(Current const& current, 62 tag::char_code<tag::upper, CharEncoding> const&) 63 : Current(current) {} 64 }; 65 66 template <typename Current, typename CharEncoding> 67 struct compound_modifier< 68 Current 69 , tag::char_code<tag::lower, CharEncoding> 70 , typename enable_if< 71 has_modifier<Current, tag::char_code<tag::upper, CharEncoding> > 72 >::type 73 > 74 : Current 75 { compound_modifierboost::spirit::compound_modifier76 compound_modifier() 77 : Current() {} 78 compound_modifierboost::spirit::compound_modifier79 compound_modifier(Current const& current, 80 tag::char_code<tag::lower, CharEncoding> const&) 81 : Current(current) {} 82 }; 83 }} 84 85 #endif 86