Chris@16
|
1 /*
|
Chris@101
|
2 * Copyright Andrey Semashev 2007 - 2015.
|
Chris@16
|
3 * Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
4 * (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
5 * http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 */
|
Chris@16
|
7 /*!
|
Chris@16
|
8 * \file message.hpp
|
Chris@16
|
9 * \author Andrey Semashev
|
Chris@16
|
10 * \date 13.07.2012
|
Chris@16
|
11 *
|
Chris@16
|
12 * The header contains log message keyword declaration.
|
Chris@16
|
13 */
|
Chris@16
|
14
|
Chris@16
|
15 #ifndef BOOST_LOG_EXPRESSIONS_MESSAGE_HPP_INCLUDED_
|
Chris@16
|
16 #define BOOST_LOG_EXPRESSIONS_MESSAGE_HPP_INCLUDED_
|
Chris@16
|
17
|
Chris@16
|
18 #include <string>
|
Chris@16
|
19 #include <boost/mpl/vector.hpp>
|
Chris@16
|
20 #include <boost/log/detail/config.hpp>
|
Chris@16
|
21 #include <boost/log/detail/default_attribute_names.hpp>
|
Chris@16
|
22 #include <boost/log/expressions/keyword.hpp>
|
Chris@16
|
23 #include <boost/log/expressions/is_keyword_descriptor.hpp>
|
Chris@16
|
24 #include <boost/log/attributes/attribute_name.hpp>
|
Chris@16
|
25 #include <boost/log/detail/header.hpp>
|
Chris@16
|
26
|
Chris@16
|
27 #ifdef BOOST_HAS_PRAGMA_ONCE
|
Chris@16
|
28 #pragma once
|
Chris@16
|
29 #endif
|
Chris@16
|
30
|
Chris@16
|
31 namespace boost {
|
Chris@16
|
32
|
Chris@16
|
33 BOOST_LOG_OPEN_NAMESPACE
|
Chris@16
|
34
|
Chris@16
|
35 namespace expressions {
|
Chris@16
|
36
|
Chris@16
|
37 namespace tag {
|
Chris@16
|
38
|
Chris@16
|
39 /*!
|
Chris@16
|
40 * Generic log message attribute descriptor.
|
Chris@16
|
41 */
|
Chris@16
|
42 struct message :
|
Chris@16
|
43 public keyword_descriptor
|
Chris@16
|
44 {
|
Chris@16
|
45 // The attribute value type here is not essential since message attributes are not intended to be created via the keyword
|
Chris@16
|
46 typedef void attribute_type;
|
Chris@16
|
47
|
Chris@16
|
48 #if defined(BOOST_LOG_USE_CHAR) && defined(BOOST_LOG_USE_WCHAR_T)
|
Chris@16
|
49 typedef mpl::vector2< std::string, std::wstring > value_type;
|
Chris@16
|
50 #elif defined(BOOST_LOG_USE_CHAR)
|
Chris@16
|
51 typedef std::string value_type;
|
Chris@16
|
52 #elif defined(BOOST_LOG_USE_WCHAR_T)
|
Chris@16
|
53 typedef std::wstring value_type;
|
Chris@16
|
54 #endif
|
Chris@16
|
55
|
Chris@16
|
56 static attribute_name get_name() { return boost::log::aux::default_attribute_names::message(); }
|
Chris@16
|
57 };
|
Chris@16
|
58
|
Chris@16
|
59 #if defined(BOOST_LOG_USE_CHAR)
|
Chris@16
|
60 /*!
|
Chris@16
|
61 * Narrow character log message attribute descriptor.
|
Chris@16
|
62 */
|
Chris@16
|
63 struct smessage :
|
Chris@16
|
64 public keyword_descriptor
|
Chris@16
|
65 {
|
Chris@16
|
66 // The attribute value type here is not essential since message attributes are not intended to be created via the keyword
|
Chris@16
|
67 typedef void attribute_type;
|
Chris@16
|
68 typedef std::string value_type;
|
Chris@16
|
69
|
Chris@16
|
70 static attribute_name get_name() { return boost::log::aux::default_attribute_names::message(); }
|
Chris@16
|
71 };
|
Chris@16
|
72 #endif
|
Chris@16
|
73
|
Chris@16
|
74 #if defined(BOOST_LOG_USE_WCHAR_T)
|
Chris@16
|
75 /*!
|
Chris@16
|
76 * Wide character log message attribute descriptor.
|
Chris@16
|
77 */
|
Chris@16
|
78 struct wmessage :
|
Chris@16
|
79 public keyword_descriptor
|
Chris@16
|
80 {
|
Chris@16
|
81 // The attribute value type here is not essential since message attributes are not intended to be created via the keyword
|
Chris@16
|
82 typedef void attribute_type;
|
Chris@16
|
83 typedef std::wstring value_type;
|
Chris@16
|
84
|
Chris@16
|
85 static attribute_name get_name() { return boost::log::aux::default_attribute_names::message(); }
|
Chris@16
|
86 };
|
Chris@16
|
87 #endif
|
Chris@16
|
88
|
Chris@16
|
89 } // namespace tag
|
Chris@16
|
90
|
Chris@16
|
91 /*!
|
Chris@16
|
92 * Generic message keyword type.
|
Chris@16
|
93 */
|
Chris@16
|
94 typedef attribute_keyword< tag::message > message_type;
|
Chris@16
|
95 /*!
|
Chris@16
|
96 * Generic message keyword.
|
Chris@16
|
97 */
|
Chris@16
|
98 const message_type message = {};
|
Chris@16
|
99
|
Chris@16
|
100 #if defined(BOOST_LOG_USE_CHAR)
|
Chris@16
|
101 /*!
|
Chris@16
|
102 * Narrow message keyword type.
|
Chris@16
|
103 */
|
Chris@16
|
104 typedef attribute_keyword< tag::smessage > smessage_type;
|
Chris@16
|
105 /*!
|
Chris@16
|
106 * Narrow message keyword.
|
Chris@16
|
107 */
|
Chris@16
|
108 const smessage_type smessage = {};
|
Chris@16
|
109 #endif
|
Chris@16
|
110
|
Chris@16
|
111 #if defined(BOOST_LOG_USE_WCHAR_T)
|
Chris@16
|
112 /*!
|
Chris@16
|
113 * Wide message keyword type.
|
Chris@16
|
114 */
|
Chris@16
|
115 typedef attribute_keyword< tag::wmessage > wmessage_type;
|
Chris@16
|
116 /*!
|
Chris@16
|
117 * Wide message keyword.
|
Chris@16
|
118 */
|
Chris@16
|
119 const wmessage_type wmessage = {};
|
Chris@16
|
120 #endif
|
Chris@16
|
121
|
Chris@16
|
122 } // namespace expressions
|
Chris@16
|
123
|
Chris@16
|
124 BOOST_LOG_CLOSE_NAMESPACE // namespace log
|
Chris@16
|
125
|
Chris@16
|
126 } // namespace boost
|
Chris@16
|
127
|
Chris@16
|
128 #include <boost/log/detail/footer.hpp>
|
Chris@16
|
129
|
Chris@16
|
130 #endif // BOOST_LOG_EXPRESSIONS_MESSAGE_HPP_INCLUDED_
|