2 * Copyright Andrey Semashev 2007 - 2014.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 * \file spirit_encoding.hpp
9 * \author Andrey Semashev
12 * \brief This header is the Boost.Log library implementation, see the library documentation
13 * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
16 #ifndef BOOST_LOG_SPIRIT_ENCODING_HPP_INCLUDED_
17 #define BOOST_LOG_SPIRIT_ENCODING_HPP_INCLUDED_
19 #include <boost/preprocessor/tuple/elem.hpp>
20 #include <boost/preprocessor/seq/for_each.hpp>
21 #include <boost/spirit/include/support_standard.hpp>
22 #include <boost/spirit/include/support_standard_wide.hpp>
23 #include <boost/spirit/home/support/common_terminals.hpp>
24 #include <boost/log/detail/config.hpp>
25 #include <boost/log/detail/header.hpp>
27 #ifdef BOOST_HAS_PRAGMA_ONCE
33 BOOST_LOG_OPEN_NAMESPACE
41 struct encoding< char >
43 typedef spirit::char_encoding::standard type;
46 struct encoding< wchar_t >
48 typedef spirit::char_encoding::standard_wide type;
51 //! A simple trait that allows to use charset-specific Qi parsers in a generic way
52 template< typename EncodingT >
53 struct encoding_specific;
55 #define BOOST_LOG_CHARSET_PARSERS\
57 ((string_type, string))\
58 ((alnum_type, alnum))\
59 ((alpha_type, alpha))\
60 ((blank_type, blank))\
61 ((cntrl_type, cntrl))\
62 ((digit_type, digit))\
63 ((graph_type, graph))\
64 ((print_type, print))\
65 ((punct_type, punct))\
66 ((space_type, space))\
67 ((xdigit_type, xdigit))\
68 ((no_case_type, no_case))\
69 ((lower_type, lower))\
70 ((upper_type, upper))\
71 ((lowernum_type, lowernum))\
72 ((uppernum_type, uppernum))
74 #define BOOST_LOG_DECLARE_CHARSET_PARSER(r, charset, parser)\
75 typedef spirit::charset::BOOST_PP_TUPLE_ELEM(2, 0, parser) BOOST_PP_TUPLE_ELEM(2, 0, parser);\
76 BOOST_LOG_API static BOOST_PP_TUPLE_ELEM(2, 0, parser) const& BOOST_PP_TUPLE_ELEM(2, 1, parser);
78 #define BOOST_LOG_DECLARE_CHARSET_PARSERS(charset)\
79 BOOST_PP_SEQ_FOR_EACH(BOOST_LOG_DECLARE_CHARSET_PARSER, charset, BOOST_LOG_CHARSET_PARSERS)
82 struct encoding_specific< spirit::char_encoding::standard >
84 BOOST_LOG_DECLARE_CHARSET_PARSERS(standard)
88 struct encoding_specific< spirit::char_encoding::standard_wide >
90 BOOST_LOG_DECLARE_CHARSET_PARSERS(standard_wide)
93 #undef BOOST_LOG_DECLARE_CHARSET_PARSERS
94 #undef BOOST_LOG_DECLARE_CHARSET_PARSER
98 BOOST_LOG_CLOSE_NAMESPACE // namespace log
102 #include <boost/log/detail/footer.hpp>
104 #endif // BOOST_LOG_SPIRIT_ENCODING_HPP_INCLUDED_