File indexing completed on 2025-12-16 09:54:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_LOG_EXPRESSIONS_FORMATTERS_XML_DECORATOR_HPP_INCLUDED_
0016 #define BOOST_LOG_EXPRESSIONS_FORMATTERS_XML_DECORATOR_HPP_INCLUDED_
0017
0018 #include <boost/range/iterator_range_core.hpp>
0019 #include <boost/log/detail/config.hpp>
0020 #include <boost/log/expressions/formatters/char_decorator.hpp>
0021 #include <boost/log/detail/header.hpp>
0022
0023 #ifdef BOOST_HAS_PRAGMA_ONCE
0024 #pragma once
0025 #endif
0026
0027 namespace boost {
0028
0029 BOOST_LOG_OPEN_NAMESPACE
0030
0031 namespace expressions {
0032
0033 namespace aux {
0034
0035 template< typename >
0036 struct xml_decorator_traits;
0037
0038 #ifdef BOOST_LOG_USE_CHAR
0039 template< >
0040 struct xml_decorator_traits< char >
0041 {
0042 static boost::iterator_range< const char* const* > get_patterns()
0043 {
0044 static const char* const patterns[] =
0045 {
0046 "&", "<", ">", "\"", "'"
0047 };
0048 return boost::make_iterator_range(patterns);
0049 }
0050 static boost::iterator_range< const char* const* > get_replacements()
0051 {
0052 static const char* const replacements[] =
0053 {
0054 "&", "<", ">", """, "'"
0055 };
0056 return boost::make_iterator_range(replacements);
0057 }
0058 };
0059 #endif
0060
0061 #ifdef BOOST_LOG_USE_WCHAR_T
0062 template< >
0063 struct xml_decorator_traits< wchar_t >
0064 {
0065 static boost::iterator_range< const wchar_t* const* > get_patterns()
0066 {
0067 static const wchar_t* const patterns[] =
0068 {
0069 L"&", L"<", L">", L"\"", L"'"
0070 };
0071 return boost::make_iterator_range(patterns);
0072 }
0073 static boost::iterator_range< const wchar_t* const* > get_replacements()
0074 {
0075 static const wchar_t* const replacements[] =
0076 {
0077 L"&", L"<", L">", L""", L"'"
0078 };
0079 return boost::make_iterator_range(replacements);
0080 }
0081 };
0082 #endif
0083
0084 template< typename CharT >
0085 struct xml_decorator_gen
0086 {
0087 typedef CharT char_type;
0088
0089 template< typename SubactorT >
0090 BOOST_FORCEINLINE char_decorator_actor< SubactorT, pattern_replacer< char_type > > operator[] (SubactorT const& subactor) const
0091 {
0092 typedef xml_decorator_traits< char_type > traits_type;
0093 typedef pattern_replacer< char_type > replacer_type;
0094 typedef char_decorator_actor< SubactorT, replacer_type > result_type;
0095 typedef typename result_type::terminal_type terminal_type;
0096 typename result_type::base_type act = {{ terminal_type(subactor, replacer_type(traits_type::get_patterns(), traits_type::get_replacements())) }};
0097 return result_type(act);
0098 }
0099 };
0100
0101 }
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114 #ifdef BOOST_LOG_USE_CHAR
0115 BOOST_INLINE_VARIABLE const aux::xml_decorator_gen< char > xml_decor = {};
0116 #endif
0117 #ifdef BOOST_LOG_USE_WCHAR_T
0118 BOOST_INLINE_VARIABLE const aux::xml_decorator_gen< wchar_t > wxml_decor = {};
0119 #endif
0120
0121
0122
0123
0124 template< typename CharT >
0125 BOOST_FORCEINLINE aux::xml_decorator_gen< CharT > make_xml_decor()
0126 {
0127 return aux::xml_decorator_gen< CharT >();
0128 }
0129
0130 }
0131
0132 BOOST_LOG_CLOSE_NAMESPACE
0133
0134 }
0135
0136 #include <boost/log/detail/footer.hpp>
0137
0138 #endif