Go to the documentation of this file. 1 #ifndef OALPLUS_ALC_API_RESULT_HPP
9 #define OALPLUS_ALC_API_RESULT_HPP
30 return {
"ALC function not available"};
42 using enum_type = alc_types::enum_type;
45 explicit constexpr
operator bool() const noexcept {
46 return alc_types::error_code_no_error(_error_code);
49 constexpr
auto error_code(enum_type ec) noexcept ->
auto& {
54 constexpr
auto error_code() const noexcept -> enum_type {
60 #ifdef ALC_INVALID_ENUM
61 if(_error_code == ALC_INVALID_ENUM) {
62 return {
"invalid enumeration parameter value"};
65 #ifdef ALC_INVALID_VALUE
66 if(_error_code == ALC_INVALID_VALUE) {
67 return {
"invalid parameter value"};
70 #ifdef ALC_INVALID_CONTEXT
71 if(_error_code == ALC_INVALID_CONTEXT) {
72 return {
"invalid context"};
75 #ifdef ALC_INVALID_DEVICE
76 if(_error_code == ALC_INVALID_DEVICE) {
77 return {
"invalid device"};
81 if(_error_code == ALC_NO_ERROR) {
85 #ifdef ALC_OUT_OF_MEMORY
86 if(_error_code == ALC_OUT_OF_MEMORY) {
87 return {
"out of memory"};
90 return {
"unknown error"};
94 enum_type _error_code{
105 template <
typename Result>
112 template <
typename Result>
119 template <
typename Result>
124 #endif // OALPLUS_ALC_API_RESULT_HPP
Class wrapping the result of a C-API function call.
Definition: c_api_wrap.hpp:210
Typed enumeration for GL error code constants.
Definition: enum_types.hpp:32
api_opt_result< Result, alc_result_info > alc_opt_result
Class wrapping the result of a ALC API function call.
Definition: result.hpp:120
Class storing information about an ALC function call result.
Definition: result.hpp:40
auto message() const noexcept -> string_view
Returns a message associated with the result.
Definition: result.hpp:59
constexpr auto message() const noexcept -> string_view
Returns a message associated with the result.
Definition: result.hpp:29
Class storing information about call result for unavailable ALC functions.
Definition: result.hpp:22
api_no_result< Result, alc_no_result_info > alc_no_result
Alias for always-invalid result of a missing ALC API function call.
Definition: result.hpp:106
api_result< Result, Info, api_result_validity::maybe > api_opt_result
Alias for conditionally-valid result of a C-API function call.
Definition: c_api_wrap.hpp:218
api_result< Result, Info, api_result_validity::never > api_no_result
Alias for always-invalid result of a C-API function call.
Definition: c_api_wrap.hpp:226
AL-related code is placed in this namespace.
Definition: oalplus.hpp:11
Type that can by constructed from single argument of any other type.
Definition: anything.hpp:16