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_TAGGED_INTEGER_HPP_INCLUDED_
0017 #define BOOST_LOG_TAGGED_INTEGER_HPP_INCLUDED_
0018
0019 #include <boost/log/detail/config.hpp>
0020 #include <boost/log/detail/header.hpp>
0021
0022 #ifdef BOOST_HAS_PRAGMA_ONCE
0023 #pragma once
0024 #endif
0025
0026 namespace boost {
0027
0028 BOOST_LOG_OPEN_NAMESPACE
0029
0030 namespace aux {
0031
0032
0033 template< typename IntT, typename TagT >
0034 struct tagged_integer
0035 {
0036
0037 typedef IntT integer_type;
0038
0039 typedef TagT tag;
0040
0041
0042 integer_type value;
0043
0044
0045 BOOST_CONSTEXPR operator integer_type() const BOOST_NOEXCEPT { return value; }
0046
0047
0048 tagged_integer& operator++ () BOOST_NOEXCEPT { ++value; return *this; }
0049 tagged_integer operator++ (int) BOOST_NOEXCEPT { tagged_integer temp = *this; ++value; return temp; }
0050
0051 tagged_integer& operator-- () BOOST_NOEXCEPT { --value; return *this; }
0052 tagged_integer operator-- (int) BOOST_NOEXCEPT { tagged_integer temp = *this; --value; return temp; }
0053
0054 #define BOOST_LOG_TAGGED_INTEGER_OP(op)\
0055 tagged_integer& operator op (tagged_integer const& that) BOOST_NOEXCEPT { value op that.value; return *this; }
0056
0057 BOOST_LOG_TAGGED_INTEGER_OP(|=)
0058 BOOST_LOG_TAGGED_INTEGER_OP(&=)
0059 BOOST_LOG_TAGGED_INTEGER_OP(^=)
0060 BOOST_LOG_TAGGED_INTEGER_OP(+=)
0061 BOOST_LOG_TAGGED_INTEGER_OP(-=)
0062 BOOST_LOG_TAGGED_INTEGER_OP(*=)
0063 BOOST_LOG_TAGGED_INTEGER_OP(/=)
0064 BOOST_LOG_TAGGED_INTEGER_OP(%=)
0065
0066 #undef BOOST_LOG_TAGGED_INTEGER_OP
0067
0068
0069 tagged_integer& operator~ () BOOST_NOEXCEPT { ~value; return *this; }
0070
0071
0072 template< typename T >
0073 tagged_integer& operator<<= (T const& that) BOOST_NOEXCEPT { value <<= that; return *this; }
0074 template< typename T >
0075 tagged_integer& operator>>= (T const& that) BOOST_NOEXCEPT { value >>= that; return *this; }
0076
0077 private:
0078
0079 template< typename T1, typename T2 >
0080 tagged_integer& operator<<= (tagged_integer< T1, T2 > const&);
0081 template< typename T1, typename T2 >
0082 tagged_integer& operator>>= (tagged_integer< T1, T2 > const&);
0083 };
0084
0085
0086 #define BOOST_LOG_TAGGED_INTEGER_OP(op)\
0087 template< typename IntT, typename TagT >\
0088 inline bool operator op (\
0089 tagged_integer< IntT, TagT > const& left, tagged_integer< IntT, TagT > const& right) BOOST_NOEXCEPT\
0090 {\
0091 return (left.value op right.value);\
0092 }
0093
0094 BOOST_LOG_TAGGED_INTEGER_OP(==)
0095 BOOST_LOG_TAGGED_INTEGER_OP(!=)
0096 BOOST_LOG_TAGGED_INTEGER_OP(<)
0097 BOOST_LOG_TAGGED_INTEGER_OP(>)
0098 BOOST_LOG_TAGGED_INTEGER_OP(<=)
0099 BOOST_LOG_TAGGED_INTEGER_OP(>=)
0100
0101 #undef BOOST_LOG_TAGGED_INTEGER_OP
0102
0103 #define BOOST_LOG_TAGGED_INTEGER_OP(op)\
0104 template< typename IntT, typename TagT >\
0105 inline tagged_integer< IntT, TagT > operator op (\
0106 tagged_integer< IntT, TagT > const& left, tagged_integer< IntT, TagT > const& right) BOOST_NOEXCEPT\
0107 {\
0108 tagged_integer< IntT, TagT > temp = left;\
0109 temp op##= right;\
0110 return temp;\
0111 }
0112
0113 BOOST_LOG_TAGGED_INTEGER_OP(|)
0114 BOOST_LOG_TAGGED_INTEGER_OP(&)
0115 BOOST_LOG_TAGGED_INTEGER_OP(^)
0116 BOOST_LOG_TAGGED_INTEGER_OP(+)
0117 BOOST_LOG_TAGGED_INTEGER_OP(-)
0118 BOOST_LOG_TAGGED_INTEGER_OP(*)
0119 BOOST_LOG_TAGGED_INTEGER_OP(/)
0120 BOOST_LOG_TAGGED_INTEGER_OP(%)
0121
0122 #undef BOOST_LOG_TAGGED_INTEGER_OP
0123
0124 #define BOOST_LOG_TAGGED_INTEGER_OP(op)\
0125 template< typename IntT, typename TagT, typename T >\
0126 inline tagged_integer< IntT, TagT > operator op (\
0127 tagged_integer< IntT, TagT > const& left, T const& right) BOOST_NOEXCEPT\
0128 {\
0129 tagged_integer< IntT, TagT > temp = left;\
0130 temp op##= right;\
0131 return temp;\
0132 }
0133
0134 BOOST_LOG_TAGGED_INTEGER_OP(<<)
0135 BOOST_LOG_TAGGED_INTEGER_OP(>>)
0136
0137 #undef BOOST_LOG_TAGGED_INTEGER_OP
0138
0139 }
0140
0141 BOOST_LOG_CLOSE_NAMESPACE
0142
0143 }
0144
0145 #include <boost/log/detail/footer.hpp>
0146
0147 #endif