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

config.hpp
Go to the documentation of this file.
1 #ifndef OALPLUS_ALC_API_CONFIG_HPP
9 #define OALPLUS_ALC_API_CONFIG_HPP
10 
11 #include "../config/basic.hpp"
12 #include <eagine/maybe_unused.hpp>
13 
14 #ifndef OALPLUS_HAS_ALC
15 #if defined(ALC_NO_ERROR)
16 #define OALPLUS_HAS_ALC 1
17 #else
18 #define OALPLUS_HAS_ALC 0
19 #endif
20 #endif // OALPLUS_HAS_ALC
21 
22 #if !OALPLUS_HAS_ALC
23 #include <eagine/nothing.hpp>
24 #include <cstdint>
25 #endif
26 
27 namespace eagine::oalp {
28 //------------------------------------------------------------------------------
31 struct alc_types {
33  using void_ptr_type = void*;
34 #if OALPLUS_HAS_ALC
35  static constexpr bool has_api = true;
36 
38  using device_type = ALCdevice;
39 
41  using context_type = ALCcontext;
42 
44  using enum_type = ALCenum;
45 
47  using char_type = ALCchar;
48 
50  using bool_type = ALCboolean;
51 
53  using int_type = ALCint;
54 
56  using uint_type = ALCuint;
57 
59  using size_type = ALCsizei;
60 #else
61  static constexpr bool has_api = false;
62  using device_type = nothing_t;
63  using context_type = nothing_t;
64  using enum_type = int;
65  using char_type = char;
66  using bool_type = bool;
67  using int_type = int;
68  using uint_type = unsigned;
69  using size_type = std::intptr_t;
70 #endif
71 
72  static constexpr auto bool_true(bool_type b) noexcept -> bool {
73 #if OALPLUS_HAS_ALC
74  return b == ALC_TRUE;
75 #else
76  return b;
77 #endif
78  }
79 
80  static constexpr auto error_code_no_error(enum_type ec) noexcept -> bool {
81 #if OALPLUS_HAS_ALC
82  return ec == ALC_NO_ERROR;
83 #else
84  EAGINE_MAYBE_UNUSED(ec);
85  return false;
86 #endif
87  }
88 };
89 //------------------------------------------------------------------------------
90 } // namespace eagine::oalp
91 
92 #endif // OALPLUS_ALC_API_CONFIG_HPP
Collection of aliases for ALC types.
Definition: config.hpp:31
void * void_ptr_type
Untyped pointer type.
Definition: config.hpp:33
Class representing "none" / "nothing" values.
Definition: nothing.hpp:17
AL-related code is placed in this namespace.
Definition: oalplus.hpp:11

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