Go to the documentation of this file. 1 #ifndef OALPLUS_AL_API_RESULT_HPP
9 #define OALPLUS_AL_API_RESULT_HPP
30 return {
"AL function not available"};
42 using enum_type = al_types::enum_type;
45 explicit constexpr
operator bool() const noexcept {
46 return al_types::error_code_no_error(_error_code);
49 constexpr
auto error_code(enum_type ec) noexcept ->
auto& {
56 #ifdef AL_INVALID_NAME
57 if(_error_code == AL_INVALID_NAME) {
58 return {
"invalid object name"};
61 #ifdef AL_INVALID_ENUM
62 if(_error_code == AL_INVALID_ENUM) {
63 return {
"invalid enumeration value"};
66 #ifdef AL_INVALID_VALUE
67 if(_error_code == AL_INVALID_VALUE) {
68 return {
"invalid parameter value"};
71 #ifdef AL_INVALID_OPERATION
72 if(_error_code == AL_INVALID_OPERATION) {
73 return {
"invalid operation"};
77 if(_error_code == AL_NO_ERROR) {
81 #ifdef AL_OUT_OF_MEMORY
82 if(_error_code == AL_OUT_OF_MEMORY) {
83 return {
"out of memory"};
86 return {
"unknown error"};
90 enum_type _error_code{
101 template <
typename Result>
108 template <
typename Result>
115 template <
typename Result>
120 #endif // OALPLUS_AL_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
auto message() const noexcept -> string_view
Returns a message associated with the result.
Definition: result.hpp:55
Class storing information about call result for unavailable AL functions.
Definition: result.hpp:22
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
api_no_result< Result, al_no_result_info > al_no_result
Alias for always-invalid result of a missing AL API function call.
Definition: result.hpp:102
Class storing information about an AL function call result.
Definition: result.hpp:40
api_opt_result< Result, al_result_info > al_opt_result
Alias for conditionally-valid result of an AL API function call.
Definition: result.hpp:116
Type that can by constructed from single argument of any other type.
Definition: anything.hpp:16
constexpr auto message() const noexcept -> string_view
Returns a message associated with the result.
Definition: result.hpp:29