2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 * \file is_debugger_present.hpp
9 * \author Andrey Semashev
12 * The header contains implementation of the \c is_debugger_present predicate in template expressions.
15 #ifndef BOOST_LOG_EXPRESSIONS_PREDICATES_IS_DEBUGGER_PRESENT_HPP_INCLUDED_
16 #define BOOST_LOG_EXPRESSIONS_PREDICATES_IS_DEBUGGER_PRESENT_HPP_INCLUDED_
18 #include <boost/log/detail/config.hpp>
20 #ifdef BOOST_HAS_PRAGMA_ONCE
24 #if defined(BOOST_WINDOWS)
26 #include <boost/phoenix/core/terminal.hpp> // this is needed to be able to include this header alone, Boost.Phoenix blows up without it
27 #include <boost/phoenix/function/adapt_callable.hpp>
28 #include <boost/log/detail/header.hpp>
30 #if defined(BOOST_USE_WINDOWS_H)
33 #define _WIN32_WINNT 0x0500
38 #else // defined(BOOST_USE_WINDOWS_H)
42 BOOST_LOG_OPEN_NAMESPACE
44 namespace expressions {
50 __declspec(dllimport) int __stdcall IsDebuggerPresent();
56 } // namespace expressions
58 BOOST_LOG_CLOSE_NAMESPACE // namespace log
62 #endif // BOOST_USE_WINDOWS_H
66 BOOST_LOG_OPEN_NAMESPACE
68 namespace expressions {
72 struct is_debugger_present
74 typedef bool result_type;
76 result_type operator() () const
78 return IsDebuggerPresent() != 0;
84 #ifndef BOOST_LOG_DOXYGEN_PASS
86 BOOST_PHOENIX_ADAPT_CALLABLE_NULLARY(is_debugger_present, aux::is_debugger_present)
91 * The function generates a filter that will check whether the logger is attached to the process
93 unspecified is_debugger_present();
97 } // namespace expressions
99 BOOST_LOG_CLOSE_NAMESPACE // namespace log
103 #include <boost/log/detail/footer.hpp>
105 #endif // BOOST_WINDOWS
107 #endif // BOOST_LOG_EXPRESSIONS_PREDICATES_IS_DEBUGGER_PRESENT_HPP_INCLUDED_