Go to the documentation of this file. 1 #ifndef OALPLUS_ALUT_API_RESULT_HPP
9 #define OALPLUS_ALUT_API_RESULT_HPP
30 return {
"ALUT function not available"};
45 explicit constexpr
operator bool() const noexcept {
46 return alut_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 ALUT_ERROR_INVALID_ENUM
61 if(_error_code == ALUT_ERROR_INVALID_ENUM) {
62 return {
"invalid enumeration parameter value"};
65 #ifdef ALUT_ERROR_INVALID_VALUE
66 if(_error_code == ALUT_ERROR_INVALID_VALUE) {
67 return {
"invalid parameter value"};
70 #ifdef ALUT_ERROR_INVALID_OPERATION
71 if(_error_code == ALUT_ERROR_INVALID_OPERATION) {
72 return {
"invalid operation"};
75 #ifdef ALUT_ERROR_NO_CURRENT_CONTEXT
76 if(_error_code == ALUT_ERROR_NO_CURRENT_CONTEXT) {
77 return {
"no current context"};
80 #ifdef ALUT_ERROR_AL_ERROR_ON_ENTRY
81 if(_error_code == ALUT_ERROR_AL_ERROR_ON_ENTRY) {
82 return {
"AL error on entry to function"};
85 #ifdef ALUT_ERROR_ALC_ERROR_ON_ENTRY
86 if(_error_code == ALUT_ERROR_ALC_ERROR_ON_ENTRY) {
87 return {
"ALC error on entry to function"};
90 #ifdef ALUT_ERROR_OPEN_DEVICE
91 if(_error_code == ALUT_ERROR_OPEN_DEVICE) {
92 return {
"failed to open device"};
95 #ifdef ALUT_ERROR_CLOSE_DEVICE
96 if(_error_code == ALUT_ERROR_CLOSE_DEVICE) {
97 return {
"failed to close device"};
100 #ifdef ALUT_ERROR_CREATE_CONTEXT
101 if(_error_code == ALUT_ERROR_CREATE_CONTEXT) {
102 return {
"failed to create context"};
105 #ifdef ALUT_ERROR_DESTROY_CONTEXT
106 if(_error_code == ALUT_ERROR_DESTROY_CONTEXT) {
107 return {
"failed to destroy context"};
110 #ifdef ALUT_ERROR_GEN_BUFFERS
111 if(_error_code == ALUT_ERROR_GEN_BUFFERS) {
112 return {
"failed to generate audio buffers"};
115 #ifdef ALUT_ERROR_BUFFER_DATA
116 if(_error_code == ALUT_ERROR_BUFFER_DATA) {
117 return {
"failed to store data in buffer"};
120 #ifdef ALUT_ERROR_IO_ERROR
121 if(_error_code == ALUT_ERROR_IO_ERROR) {
122 return {
"input/output error"};
125 #ifdef ALUT_ERROR_UNSUPPORTED_FILE_TYPE
126 if(_error_code == ALUT_ERROR_UNSUPPORTED_FILE_TYPE) {
127 return {
"unsupported file type"};
130 #ifdef ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE
131 if(_error_code == ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE) {
132 return {
"unsupported file sub-type"};
135 #ifdef ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE
136 if(_error_code == ALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA) {
137 return {
"corrupt or truncated data"};
140 #ifdef ALUT_ERROR_NO_ERROR
141 if(_error_code == ALUT_ERROR_NO_ERROR) {
145 #ifdef ALUT_ERROR_OUT_OF_MEMORY
146 if(_error_code == ALUT_ERROR_OUT_OF_MEMORY) {
147 return {
"out of memory"};
150 return {
"unknown error"};
154 enum_type _error_code{
155 #ifdef ALUT_ERROR_NO_ERROR
165 template <
typename Result>
172 template <
typename Result>
179 template <
typename Result>
184 #endif // OALPLUS_ALUT_API_RESULT_HPP
Class storing information about call result for unavailable ALUT functions.
Definition: result.hpp:22
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, alut_result_info > alut_opt_result
Class wrapping the result of a ALUT API function call.
Definition: result.hpp:180
Class storing information about an ALUT function call result.
Definition: result.hpp:40
auto message() const noexcept -> string_view
Returns a message associated with the result.
Definition: result.hpp:59
al_types::enum_type enum_type
Enum type.
Definition: config.hpp:40
constexpr auto message() const noexcept -> string_view
Returns a message associated with the result.
Definition: result.hpp:29
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
api_no_result< Result, alut_no_result_info > alut_no_result
Alias for always-invalid result of a missing ALUT API function call.
Definition: result.hpp:166
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