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