diff options
author | Arnur Nigmetov <nigmetov@tugraz.at> | 2019-12-03 21:14:03 +0100 |
---|---|---|
committer | Arnur Nigmetov <nigmetov@tugraz.at> | 2020-02-18 15:02:39 +0100 |
commit | 6942d80c4d49239bca9cace9833aa74aee11ddcb (patch) | |
tree | 59797321de3b11800de28db8a4dc212828d11844 /matching/include/spdlog/details/console_globals.h | |
parent | 919f04a0ad3406b9c02fbce3a9a92c03c9e85c94 (diff) |
Add matching distance code.
Diffstat (limited to 'matching/include/spdlog/details/console_globals.h')
-rw-r--r-- | matching/include/spdlog/details/console_globals.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/matching/include/spdlog/details/console_globals.h b/matching/include/spdlog/details/console_globals.h new file mode 100644 index 0000000..e2afb6b --- /dev/null +++ b/matching/include/spdlog/details/console_globals.h @@ -0,0 +1,74 @@ +#pragma once +// +// Copyright(c) 2018 Gabi Melman. +// Distributed under the MIT License (http://opensource.org/licenses/MIT) +// + +#include "spdlog/details/null_mutex.h" +#include <cstdio> +#include <mutex> + +#ifdef _WIN32 + +#ifndef NOMINMAX +#define NOMINMAX // prevent windows redefining min/max +#endif + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#include <windows.h> +#endif + +namespace spdlog { +namespace details { +struct console_stdout +{ + static std::FILE *stream() + { + return stdout; + } +#ifdef _WIN32 + static HANDLE handle() + { + return ::GetStdHandle(STD_OUTPUT_HANDLE); + } +#endif +}; + +struct console_stderr +{ + static std::FILE *stream() + { + return stderr; + } +#ifdef _WIN32 + static HANDLE handle() + { + return ::GetStdHandle(STD_ERROR_HANDLE); + } +#endif +}; + +struct console_mutex +{ + using mutex_t = std::mutex; + static mutex_t &mutex() + { + static mutex_t s_mutex; + return s_mutex; + } +}; + +struct console_nullmutex +{ + using mutex_t = null_mutex; + static mutex_t &mutex() + { + static mutex_t s_mutex; + return s_mutex; + } +}; +} // namespace details +} // namespace spdlog |