diff options
Diffstat (limited to 'boost/log')
-rw-r--r-- | boost/log/keywords/enable_final_rotation.hpp | 40 | ||||
-rw-r--r-- | boost/log/sinks/text_file_backend.hpp | 30 | ||||
-rw-r--r-- | boost/log/sources/record_ostream.hpp | 203 | ||||
-rw-r--r-- | boost/log/utility/formatting_ostream.hpp | 47 | ||||
-rw-r--r-- | boost/log/utility/setup/filter_parser.hpp | 4 | ||||
-rw-r--r-- | boost/log/utility/type_info_wrapper.hpp | 194 |
6 files changed, 300 insertions, 218 deletions
diff --git a/boost/log/keywords/enable_final_rotation.hpp b/boost/log/keywords/enable_final_rotation.hpp new file mode 100644 index 0000000000..f258a08108 --- /dev/null +++ b/boost/log/keywords/enable_final_rotation.hpp @@ -0,0 +1,40 @@ +/* + * Copyright Andrey Semashev 2016. + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ +/*! + * \file keywords/enable_final_rotation.hpp + * \author Andrey Semashev + * \date 27.11.2016 + * + * The header contains the \c enable_final_rotation keyword declaration. + */ + +#ifndef BOOST_LOG_KEYWORDS_ENABLE_FINAL_ROTATION_HPP_INCLUDED_ +#define BOOST_LOG_KEYWORDS_ENABLE_FINAL_ROTATION_HPP_INCLUDED_ + +#include <boost/parameter/keyword.hpp> +#include <boost/log/detail/config.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { + +BOOST_LOG_OPEN_NAMESPACE + +namespace keywords { + +//! The keyword for enabling/disabling final log file rotation on sink backend destruction +BOOST_PARAMETER_KEYWORD(tag, enable_final_rotation) + +} // namespace keywords + +BOOST_LOG_CLOSE_NAMESPACE // namespace log + +} // namespace boost + +#endif // BOOST_LOG_KEYWORDS_ENABLE_FINAL_ROTATION_HPP_INCLUDED_ diff --git a/boost/log/sinks/text_file_backend.hpp b/boost/log/sinks/text_file_backend.hpp index 68f698848f..899b5c49bc 100644 --- a/boost/log/sinks/text_file_backend.hpp +++ b/boost/log/sinks/text_file_backend.hpp @@ -35,6 +35,7 @@ #include <boost/log/keywords/auto_flush.hpp> #include <boost/log/keywords/rotation_size.hpp> #include <boost/log/keywords/time_based_rotation.hpp> +#include <boost/log/keywords/enable_final_rotation.hpp> #include <boost/log/detail/config.hpp> #include <boost/log/detail/light_function.hpp> #include <boost/log/detail/parameter_tools.hpp> @@ -387,6 +388,8 @@ public: * any size. * \li \c time_based_rotation - Specifies the predicate for time-based file rotation. * No time-based file rotations will be performed, if not specified. + * \li \c enable_final_rotation - Specifies a flag, whether or not perform log file rotation on + * sink backend destruction. By default, is \c true. * \li \c auto_flush - Specifies a flag, whether or not to automatically flush the file after each * written log record. By default, is \c false. * @@ -472,9 +475,26 @@ public: BOOST_LOG_API void set_time_based_rotation(time_based_rotation_predicate const& predicate); /*! - * Sets the flag to automatically flush buffers of all attached streams after each log record + * The method allows to enable or disable log file rotation on sink destruction. + * + * By default the sink backend will rotate the log file, if it's been written to, on + * destruction. + * + * \param enable The flag indicates whether the final rotation should be performed. + */ + BOOST_LOG_API void enable_final_rotation(bool enable); + + /*! + * Sets the flag to automatically flush write buffers of the file being written after each log record. + * + * \param enable The flag indicates whether the automatic buffer flush should be performed. + */ + BOOST_LOG_API void auto_flush(bool enable = true); + + /*! + * \return The name of the currently open log file. If no file is open, returns an empty path. */ - BOOST_LOG_API void auto_flush(bool f = true); + BOOST_LOG_API filesystem::path get_current_file_name() const; /*! * Performs scanning of the target directory for log files that may have been left from @@ -524,7 +544,8 @@ private: args[keywords::open_mode | (std::ios_base::trunc | std::ios_base::out)], args[keywords::rotation_size | (std::numeric_limits< uintmax_t >::max)()], args[keywords::time_based_rotation | time_based_rotation_predicate()], - args[keywords::auto_flush | false]); + args[keywords::auto_flush | false], + args[keywords::enable_final_rotation | true]); } //! Constructor implementation BOOST_LOG_API void construct( @@ -532,7 +553,8 @@ private: std::ios_base::openmode mode, uintmax_t rotation_size, time_based_rotation_predicate const& time_based_rotation, - bool auto_flush); + bool auto_flush, + bool enable_final_rotation); //! The method sets file name mask BOOST_LOG_API void set_file_name_pattern_internal(filesystem::path const& pattern); diff --git a/boost/log/sources/record_ostream.hpp b/boost/log/sources/record_ostream.hpp index 5fac8742b7..ff21eb3d11 100644 --- a/boost/log/sources/record_ostream.hpp +++ b/boost/log/sources/record_ostream.hpp @@ -17,11 +17,16 @@ #define BOOST_LOG_SOURCES_RECORD_OSTREAM_HPP_INCLUDED_ #include <string> +#include <iosfwd> #include <ostream> #include <boost/assert.hpp> #include <boost/move/core.hpp> #include <boost/move/utility_core.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_scalar.hpp> +#include <boost/type_traits/remove_cv.hpp> #include <boost/core/addressof.hpp> +#include <boost/core/enable_if.hpp> #include <boost/log/detail/config.hpp> #include <boost/log/detail/native_typeof.hpp> #include <boost/log/detail/unhandled_exception_count.hpp> @@ -44,10 +49,18 @@ class basic_record_ostream; namespace aux { -template< typename StreamT, typename R > -struct enable_if_record_ostream {}; -template< typename CharT, typename R > -struct enable_if_record_ostream< basic_record_ostream< CharT >, R > { typedef R type; }; +template< typename StreamT, typename T, bool ByValueV, typename R > +struct enable_record_ostream_generic_operator {}; +template< typename CharT, typename T, typename R > +struct enable_record_ostream_generic_operator< basic_record_ostream< CharT >, T, false, R > : + public boost::disable_if_c< boost::is_scalar< typename boost::remove_cv< T >::type >::value, R > +{ +}; +template< typename CharT, typename T, typename R > +struct enable_record_ostream_generic_operator< basic_record_ostream< CharT >, T, true, R > : + public boost::enable_if_c< boost::is_enum< typename boost::remove_cv< T >::type >::value, R > +{ +}; } // namespace aux @@ -73,6 +86,8 @@ public: typedef std::basic_string< char_type > string_type; //! Stream type typedef std::basic_ostream< char_type > stream_type; + //! Character traits + typedef typename base_type::traits_type traits_type; private: //! Log record @@ -169,6 +184,160 @@ public: //! The function resets the stream into a detached (default initialized) state BOOST_LOG_API void detach_from_record() BOOST_NOEXCEPT; + basic_record_ostream& operator<< (typename base_type::ios_base_manip manip) + { + static_cast< base_type& >(*this) << manip; + return *this; + } + basic_record_ostream& operator<< (typename base_type::basic_ios_manip manip) + { + static_cast< base_type& >(*this) << manip; + return *this; + } + basic_record_ostream& operator<< (typename base_type::stream_manip manip) + { + static_cast< base_type& >(*this) << manip; + return *this; + } + + basic_record_ostream& operator<< (char c) + { + static_cast< base_type& >(*this) << c; + return *this; + } + basic_record_ostream& operator<< (const char* p) + { + static_cast< base_type& >(*this) << p; + return *this; + } + + // When no native character type is supported, the following overloads are disabled as they have ambiguous meaning. + // Use basic_string_view or basic_string to explicitly indicate that the data is a string. +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + basic_record_ostream& operator<< (wchar_t c) + { + static_cast< base_type& >(*this) << c; + return *this; + } + basic_record_ostream& operator<< (const wchar_t* p) + { + static_cast< base_type& >(*this) << p; + return *this; + } +#endif +#if !defined(BOOST_LOG_NO_CXX11_CODECVT_FACETS) +#if !defined(BOOST_NO_CXX11_CHAR16_T) + basic_record_ostream& operator<< (char16_t c) + { + static_cast< base_type& >(*this) << c; + return *this; + } + basic_record_ostream& operator<< (const char16_t* p) + { + static_cast< base_type& >(*this) << p; + return *this; + } +#endif +#if !defined(BOOST_NO_CXX11_CHAR32_T) + basic_record_ostream& operator<< (char32_t c) + { + static_cast< base_type& >(*this) << c; + return *this; + } + basic_record_ostream& operator<< (const char32_t* p) + { + static_cast< base_type& >(*this) << p; + return *this; + } +#endif +#endif + + basic_record_ostream& operator<< (bool value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + basic_record_ostream& operator<< (signed char value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + basic_record_ostream& operator<< (unsigned char value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + basic_record_ostream& operator<< (short value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + basic_record_ostream& operator<< (unsigned short value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + basic_record_ostream& operator<< (int value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + basic_record_ostream& operator<< (unsigned int value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + basic_record_ostream& operator<< (long value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + basic_record_ostream& operator<< (unsigned long value) + { + static_cast< base_type& >(*this) << value; + return *this; + } +#if !defined(BOOST_NO_LONG_LONG) + basic_record_ostream& operator<< (long long value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + basic_record_ostream& operator<< (unsigned long long value) + { + static_cast< base_type& >(*this) << value; + return *this; + } +#endif + + basic_record_ostream& operator<< (float value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + basic_record_ostream& operator<< (double value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + basic_record_ostream& operator<< (long double value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + + basic_record_ostream& operator<< (const void* value) + { + static_cast< base_type& >(*this) << value; + return *this; + } + + basic_record_ostream& operator<< (std::basic_streambuf< char_type, traits_type >* buf) + { + static_cast< base_type& >(*this) << buf; + return *this; + } + private: //! The function initializes the stream and the stream buffer BOOST_LOG_API void init_stream(); @@ -196,7 +365,16 @@ typedef basic_record_ostream< wchar_t > wrecord_ostream; //!< Convenience typ // This is because my_type rvalues require adding const to the type, which counts as a conversion that is not required // if there is a perfect forwarding overload. template< typename StreamT, typename T > -inline typename boost::log::aux::enable_if_record_ostream< StreamT, StreamT& >::type +inline typename boost::log::aux::enable_record_ostream_generic_operator< StreamT, T, true, StreamT& >::type +operator<< (StreamT& strm, T value) +{ + typedef basic_formatting_ostream< typename StreamT::char_type > formatting_ostream_type; + static_cast< formatting_ostream_type& >(strm) << value; + return strm; +} + +template< typename StreamT, typename T > +inline typename boost::log::aux::enable_record_ostream_generic_operator< StreamT, T, false, StreamT& >::type operator<< (StreamT& strm, T const& value) { typedef basic_formatting_ostream< typename StreamT::char_type > formatting_ostream_type; @@ -205,7 +383,7 @@ operator<< (StreamT& strm, T const& value) } template< typename StreamT, typename T > -inline typename boost::log::aux::enable_if_record_ostream< StreamT, StreamT& >::type +inline typename boost::log::aux::enable_record_ostream_generic_operator< StreamT, T, false, StreamT& >::type operator<< (StreamT& strm, T& value) { typedef basic_formatting_ostream< typename StreamT::char_type > formatting_ostream_type; @@ -216,7 +394,16 @@ operator<< (StreamT& strm, T& value) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template< typename StreamT, typename T > -inline typename boost::log::aux::enable_if_record_ostream< StreamT, StreamT& >::type +inline typename boost::log::aux::enable_record_ostream_generic_operator< StreamT, T, true, StreamT& >::type +operator<< (StreamT&& strm, T value) +{ + typedef basic_formatting_ostream< typename StreamT::char_type > formatting_ostream_type; + static_cast< formatting_ostream_type& >(strm) << value; + return strm; +} + +template< typename StreamT, typename T > +inline typename boost::log::aux::enable_record_ostream_generic_operator< StreamT, T, false, StreamT& >::type operator<< (StreamT&& strm, T const& value) { typedef basic_formatting_ostream< typename StreamT::char_type > formatting_ostream_type; @@ -225,7 +412,7 @@ operator<< (StreamT&& strm, T const& value) } template< typename StreamT, typename T > -inline typename boost::log::aux::enable_if_record_ostream< StreamT, StreamT& >::type +inline typename boost::log::aux::enable_record_ostream_generic_operator< StreamT, T, false, StreamT& >::type operator<< (StreamT&& strm, T& value) { typedef basic_formatting_ostream< typename StreamT::char_type > formatting_ostream_type; diff --git a/boost/log/utility/formatting_ostream.hpp b/boost/log/utility/formatting_ostream.hpp index 4a79998b1c..d51413693f 100644 --- a/boost/log/utility/formatting_ostream.hpp +++ b/boost/log/utility/formatting_ostream.hpp @@ -19,9 +19,12 @@ #include <string> #include <memory> #include <locale> +#include <boost/core/enable_if.hpp> #include <boost/core/explicit_operator_bool.hpp> #include <boost/utility/string_ref_fwd.hpp> #include <boost/utility/string_view_fwd.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_scalar.hpp> #include <boost/type_traits/remove_cv.hpp> #include <boost/log/detail/config.hpp> #include <boost/log/detail/attachable_sstream_buf.hpp> @@ -57,10 +60,18 @@ struct enable_if_streamable_char_type< char32_t, R > { typedef R type; }; #endif #endif -template< typename StreamT, typename R > -struct enable_if_formatting_ostream {}; -template< typename CharT, typename TraitsT, typename AllocatorT, typename R > -struct enable_if_formatting_ostream< basic_formatting_ostream< CharT, TraitsT, AllocatorT >, R > { typedef R type; }; +template< typename StreamT, typename T, bool ByValueV, typename R > +struct enable_formatting_ostream_generic_operator {}; +template< typename CharT, typename TraitsT, typename AllocatorT, typename T, typename R > +struct enable_formatting_ostream_generic_operator< basic_formatting_ostream< CharT, TraitsT, AllocatorT >, T, false, R > : + public boost::disable_if_c< boost::is_scalar< typename boost::remove_cv< T >::type >::value, R > +{ +}; +template< typename CharT, typename TraitsT, typename AllocatorT, typename T, typename R > +struct enable_formatting_ostream_generic_operator< basic_formatting_ostream< CharT, TraitsT, AllocatorT >, T, true, R > : + public boost::enable_if_c< boost::is_enum< typename boost::remove_cv< T >::type >::value, R > +{ +}; } // namespace aux @@ -137,7 +148,7 @@ public: BOOST_DELETED_FUNCTION(sentry& operator= (sentry const&)) }; -private: +protected: // Function types typedef std::ios_base& (*ios_base_manip)(std::ios_base&); typedef std::basic_ios< char_type, traits_type >& (*basic_ios_manip)(std::basic_ios< char_type, traits_type >&); @@ -837,7 +848,7 @@ void basic_formatting_ostream< CharT, TraitsT, AllocatorT >::aligned_write(const // Implementation note: these operators below should be the least attractive for the compiler // so that user's overloads are chosen, when present. We use function template partial ordering for this purpose. -// We also don't use perfect forwarding for the right hand argument because in ths case the generic overload +// We also don't use perfect forwarding for the right hand argument because in this case the generic overload // would be more preferred than the typical one written by users: // // formatting_ostream& operator<< (formatting_ostream& strm, my_type const& arg); @@ -845,7 +856,15 @@ void basic_formatting_ostream< CharT, TraitsT, AllocatorT >::aligned_write(const // This is because my_type rvalues require adding const to the type, which counts as a conversion that is not required // if there is a perfect forwarding overload. template< typename StreamT, typename T > -inline typename boost::log::aux::enable_if_formatting_ostream< StreamT, StreamT& >::type +inline typename boost::log::aux::enable_formatting_ostream_generic_operator< StreamT, T, true, StreamT& >::type +operator<< (StreamT& strm, T value) +{ + strm.stream() << value; + return strm; +} + +template< typename StreamT, typename T > +inline typename boost::log::aux::enable_formatting_ostream_generic_operator< StreamT, T, false, StreamT& >::type operator<< (StreamT& strm, T const& value) { strm.stream() << value; @@ -853,7 +872,7 @@ operator<< (StreamT& strm, T const& value) } template< typename StreamT, typename T > -inline typename boost::log::aux::enable_if_formatting_ostream< StreamT, StreamT& >::type +inline typename boost::log::aux::enable_formatting_ostream_generic_operator< StreamT, T, false, StreamT& >::type operator<< (StreamT& strm, T& value) { strm.stream() << value; @@ -863,7 +882,15 @@ operator<< (StreamT& strm, T& value) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template< typename StreamT, typename T > -inline typename boost::log::aux::enable_if_formatting_ostream< StreamT, StreamT& >::type +inline typename boost::log::aux::enable_formatting_ostream_generic_operator< StreamT, T, true, StreamT& >::type +operator<< (StreamT&& strm, T value) +{ + strm.stream() << value; + return strm; +} + +template< typename StreamT, typename T > +inline typename boost::log::aux::enable_formatting_ostream_generic_operator< StreamT, T, false, StreamT& >::type operator<< (StreamT&& strm, T const& value) { strm.stream() << value; @@ -871,7 +898,7 @@ operator<< (StreamT&& strm, T const& value) } template< typename StreamT, typename T > -inline typename boost::log::aux::enable_if_formatting_ostream< StreamT, StreamT& >::type +inline typename boost::log::aux::enable_formatting_ostream_generic_operator< StreamT, T, false, StreamT& >::type operator<< (StreamT&& strm, T& value) { strm.stream() << value; diff --git a/boost/log/utility/setup/filter_parser.hpp b/boost/log/utility/setup/filter_parser.hpp index f9aa831caf..9a6c9f6d25 100644 --- a/boost/log/utility/setup/filter_parser.hpp +++ b/boost/log/utility/setup/filter_parser.hpp @@ -125,7 +125,7 @@ struct filter_factory */ virtual filter on_custom_relation(attribute_name const& name, string_type const& rel, string_type const& arg) { - BOOST_LOG_THROW_DESCR_PARAMS(parse_error, "The custom attribute value relation \"" + boost::log::aux::to_narrow(arg) + "\" is not supported", (name)); + BOOST_LOG_THROW_DESCR_PARAMS(parse_error, "The custom attribute value relation \"" + boost::log::aux::to_narrow(rel) + "\" is not supported", (name)); BOOST_LOG_UNREACHABLE_RETURN(filter()); } @@ -208,7 +208,7 @@ public: */ virtual filter on_custom_relation(attribute_name const& name, string_type const& rel, string_type const& arg) { - BOOST_LOG_THROW_DESCR_PARAMS(parse_error, "The custom attribute value relation \"" + boost::log::aux::to_narrow(arg) + "\" is not supported", (name)); + BOOST_LOG_THROW_DESCR_PARAMS(parse_error, "The custom attribute value relation \"" + boost::log::aux::to_narrow(rel) + "\" is not supported", (name)); BOOST_LOG_UNREACHABLE_RETURN(filter()); } diff --git a/boost/log/utility/type_info_wrapper.hpp b/boost/log/utility/type_info_wrapper.hpp deleted file mode 100644 index 81cd3aed69..0000000000 --- a/boost/log/utility/type_info_wrapper.hpp +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright Andrey Semashev 2007 - 2015. - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ -/*! - * \file type_info_wrapper.hpp - * \author Andrey Semashev - * \date 15.04.2007 - * - * The header contains implementation of a type information wrapper. - */ - -#ifndef BOOST_LOG_UTILITY_TYPE_INFO_WRAPPER_HPP_INCLUDED_ -#define BOOST_LOG_UTILITY_TYPE_INFO_WRAPPER_HPP_INCLUDED_ - -#include <typeinfo> -#include <string> -#include <boost/core/demangle.hpp> -#include <boost/core/explicit_operator_bool.hpp> -#include <boost/log/detail/config.hpp> -#include <boost/log/detail/header.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#if defined(__GNUC__) -#pragma message "Boost.Log: This header is deprecated, use Boost.TypeIndex instead." -#elif defined(_MSC_VER) -#pragma message("Boost.Log: This header is deprecated, use Boost.TypeIndex instead.") -#endif - -namespace boost { - -BOOST_LOG_OPEN_NAMESPACE - -/*! - * \brief A simple <tt>std::type_info</tt> wrapper that implements value semantic for type information objects - * - * The type info wrapper is very useful for storing type information objects in containers, - * as a key or value. It also provides a number of useful features, such as default construction - * and assignment support, an empty state and extended support for human-friendly type names. - */ -class type_info_wrapper -{ -private: -#ifndef BOOST_LOG_DOXYGEN_PASS - //! An inaccessible type to indicate an uninitialized state of the wrapper - struct BOOST_SYMBOL_VISIBLE uninitialized {}; -#endif // BOOST_LOG_DOXYGEN_PASS - -private: - //! A pointer to the actual type info - std::type_info const* info; - -public: - /*! - * Default constructor - * - * \post <tt>!*this == true</tt> - */ - type_info_wrapper() BOOST_NOEXCEPT : info(&typeid(uninitialized)) {} - /*! - * Copy constructor - * - * \post <tt>*this == that</tt> - * \param that Source type info wrapper to copy from - */ - type_info_wrapper(type_info_wrapper const& that) BOOST_NOEXCEPT : info(that.info) {} - /*! - * Conversion constructor - * - * \post <tt>*this == that && !!*this</tt> - * \param that Type info object to be wrapped - */ - type_info_wrapper(std::type_info const& that) BOOST_NOEXCEPT : info(&that) {} - - /*! - * \return \c true if the type info wrapper was initialized with a particular type, - * \c false if the wrapper was default-constructed and not yet initialized - */ - BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() - - /*! - * Stored type info getter - * - * \pre <tt>!!*this</tt> - * \return Constant reference to the wrapped type info object - */ - std::type_info const& get() const BOOST_NOEXCEPT { return *info; } - - /*! - * Swaps two instances of the wrapper - */ - void swap(type_info_wrapper& that) BOOST_NOEXCEPT - { - std::type_info const* temp = info; - info = that.info; - that.info = temp; - } - - /*! - * The method returns the contained type name string in a possibly more readable format than <tt>get().name()</tt> - * - * \pre <tt>!!*this</tt> - * \return Type name string - */ - std::string pretty_name() const - { - if (!this->operator!()) - return boost::core::demangle(info->name()); - else - return "[uninitialized]"; - } - - /*! - * \return \c false if the type info wrapper was initialized with a particular type, - * \c true if the wrapper was default-constructed and not yet initialized - */ - bool operator! () const BOOST_NOEXCEPT { return (info == &typeid(uninitialized) || *info == typeid(uninitialized)); } - - /*! - * Equality comparison - * - * \param that Comparand - * \return If either this object or comparand is in empty state and the other is not, the result is \c false. - * If both arguments are empty, the result is \c true. If both arguments are not empty, the result - * is \c true if this object wraps the same type as the comparand and \c false otherwise. - */ - bool operator== (type_info_wrapper const& that) const BOOST_NOEXCEPT - { - return (info == that.info || *info == *that.info); - } - /*! - * Ordering operator - * - * \pre <tt>!!*this && !!that</tt> - * \param that Comparand - * \return \c true if this object wraps type info object that is ordered before - * the type info object in the comparand, \c false otherwise - * \note The results of this operator are only consistent within a single run of application. - * The result may change for the same types after rebuilding or even restarting the application. - */ - bool operator< (type_info_wrapper const& that) const BOOST_NOEXCEPT - { - return static_cast< bool >(info->before(*that.info)); - } -}; - -//! Inequality operator -inline bool operator!= (type_info_wrapper const& left, type_info_wrapper const& right) BOOST_NOEXCEPT -{ - return !left.operator==(right); -} - -//! Ordering operator -inline bool operator<= (type_info_wrapper const& left, type_info_wrapper const& right) BOOST_NOEXCEPT -{ - return (left.operator==(right) || left.operator<(right)); -} - -//! Ordering operator -inline bool operator> (type_info_wrapper const& left, type_info_wrapper const& right) BOOST_NOEXCEPT -{ - return !(left.operator==(right) || left.operator<(right)); -} - -//! Ordering operator -inline bool operator>= (type_info_wrapper const& left, type_info_wrapper const& right) BOOST_NOEXCEPT -{ - return !left.operator<(right); -} - -//! Free swap for type info wrapper -inline void swap(type_info_wrapper& left, type_info_wrapper& right) BOOST_NOEXCEPT -{ - left.swap(right); -} - -//! The function for exception serialization to string -inline std::string to_string(type_info_wrapper const& ti) -{ - return ti.pretty_name(); -} - -BOOST_LOG_CLOSE_NAMESPACE // namespace log - -} // namespace boost - -#include <boost/log/detail/footer.hpp> - -#endif // BOOST_LOG_UTILITY_TYPE_INFO_WRAPPER_HPP_INCLUDED_ |