Chris@16: /* Chris@101: * Copyright Andrey Semashev 2007 - 2015. Chris@16: * Distributed under the Boost Software License, Version 1.0. Chris@16: * (See accompanying file LICENSE_1_0.txt or copy at Chris@16: * http://www.boost.org/LICENSE_1_0.txt) Chris@16: */ Chris@16: /*! Chris@16: * \file is_debugger_present.hpp Chris@16: * \author Andrey Semashev Chris@16: * \date 05.12.2012 Chris@16: * Chris@16: * The header contains implementation of the \c is_debugger_present predicate in template expressions. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_LOG_EXPRESSIONS_PREDICATES_IS_DEBUGGER_PRESENT_HPP_INCLUDED_ Chris@16: #define BOOST_LOG_EXPRESSIONS_PREDICATES_IS_DEBUGGER_PRESENT_HPP_INCLUDED_ Chris@16: Chris@16: #include Chris@16: Chris@16: #ifdef BOOST_HAS_PRAGMA_ONCE Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #if defined(BOOST_WINDOWS) Chris@16: Chris@16: #include // this is needed to be able to include this header alone, Boost.Phoenix blows up without it Chris@16: #include Chris@16: #include Chris@16: Chris@16: #if defined(BOOST_USE_WINDOWS_H) Chris@16: Chris@16: #ifndef _WIN32_WINNT Chris@16: #define _WIN32_WINNT 0x0500 Chris@16: #endif Chris@16: Chris@16: #include Chris@16: Chris@16: #else // defined(BOOST_USE_WINDOWS_H) Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: BOOST_LOG_OPEN_NAMESPACE Chris@16: Chris@16: namespace expressions { Chris@16: Chris@16: namespace aux { Chris@16: Chris@16: extern "C" { Chris@16: Chris@16: __declspec(dllimport) int __stdcall IsDebuggerPresent(); Chris@16: Chris@16: } // extern "C" Chris@16: Chris@16: } // namespace aux Chris@16: Chris@16: } // namespace expressions Chris@16: Chris@16: BOOST_LOG_CLOSE_NAMESPACE // namespace log Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #endif // BOOST_USE_WINDOWS_H Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: BOOST_LOG_OPEN_NAMESPACE Chris@16: Chris@16: namespace expressions { Chris@16: Chris@16: namespace aux { Chris@16: Chris@16: struct is_debugger_present Chris@16: { Chris@16: typedef bool result_type; Chris@16: Chris@16: result_type operator() () const Chris@16: { Chris@16: return IsDebuggerPresent() != 0; Chris@16: } Chris@16: }; Chris@16: Chris@16: } // namespace aux Chris@16: Chris@16: #ifndef BOOST_LOG_DOXYGEN_PASS Chris@16: Chris@16: BOOST_PHOENIX_ADAPT_CALLABLE_NULLARY(is_debugger_present, aux::is_debugger_present) Chris@16: Chris@16: #else Chris@16: Chris@16: /*! Chris@16: * The function generates a filter that will check whether the logger is attached to the process Chris@16: */ Chris@16: unspecified is_debugger_present(); Chris@16: Chris@16: #endif Chris@16: Chris@16: } // namespace expressions Chris@16: Chris@16: BOOST_LOG_CLOSE_NAMESPACE // namespace log Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // BOOST_WINDOWS Chris@16: Chris@16: #endif // BOOST_LOG_EXPRESSIONS_PREDICATES_IS_DEBUGGER_PRESENT_HPP_INCLUDED_