OGLplus  (0.59.0) a C++ wrapper for rendering APIs

enum_log.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_ENUM_LOG_HPP
10 #define EAGINE_ENUM_LOG_HPP
11 
12 #include "enum_class.hpp"
13 #include "logging/backend.hpp"
14 #include <type_traits>
15 
16 namespace eagine {
17 //------------------------------------------------------------------------------
18 template <typename Self, typename T, identifier_t LibId, identifier_t Id>
19 static constexpr auto adapt_log_entry_arg(
20  identifier name,
21  enum_class<Self, T, LibId, Id> ec,
22  std::enable_if_t<std::is_signed_v<T>, T> = {}) {
23  return [=](logger_backend& backend) {
24  backend.add_integer(name, identifier{Id}, ec._value);
25  };
26 }
27 //------------------------------------------------------------------------------
28 template <typename Self, typename T, identifier_t LibId, identifier_t Id>
29 static constexpr auto adapt_log_entry_arg(
30  identifier name,
31  enum_class<Self, T, LibId, Id> ec,
32  std::enable_if_t<std::is_unsigned_v<T>, T> = {}) {
33  return [=](logger_backend& backend) {
34  backend.add_unsigned(name, identifier{Id}, ec._value);
35  };
36 }
37 //------------------------------------------------------------------------------
38 } // namespace eagine
39 
40 #endif // EAGINE_ENUM_LOG_HPP
Common code is placed in this namespace.
Definition: eagine.hpp:21
basic_identifier< 10, 6, default_identifier_char_set, identifier_t > identifier
Default identifier type used throughout the project.
Definition: identifier.hpp:346

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).