Skip to content

Commit

Permalink
Updates in AL errors
Browse files Browse the repository at this point in the history
- Added AL, ALC and ALUT error code enumerations.
- Added the ErrorAL exception class.
- Minor updates in OAL's error reporting.
  • Loading branch information
matus-chochlik committed May 4, 2015
1 parent 4f4f4fc commit 698d355
Show file tree
Hide file tree
Showing 40 changed files with 1,728 additions and 70 deletions.
31 changes: 31 additions & 0 deletions doc/quickbook/oalplus/quickref/enums/al_error_code.hpp
@@ -0,0 +1,31 @@
// File doc/quickbook/oalplus/quickref/enums/al_error_code.hpp
//
// Automatically generated file, DO NOT modify manually.
// Edit the source 'source/enums/oalplus/al_error_code.txt'
// or the 'source/enums/make_enum.py' script instead.
//
// Copyright 2010-2015 Matus Chochlik.
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
//[oalplus_enums_al_error_code
namespace oalplus {

enum class ALErrorCode : ALenum
{
NoError = AL_NO_ERROR,
InvalidName = AL_INVALID_NAME,
InvalidEnum = AL_INVALID_ENUM,
InvalidValue = AL_INVALID_VALUE,
InvalidOperation = AL_INVALID_OPERATION,
OutOfMemory = AL_OUT_OF_MEMORY
};

template <>
__Range<ALErrorCode> __EnumValueRange<ALErrorCode>(void);

__StrCRef __EnumValueName(ALErrorCode);

} // namespace oalplus
//]
31 changes: 31 additions & 0 deletions doc/quickbook/oalplus/quickref/enums/alc_error_code.hpp
@@ -0,0 +1,31 @@
// File doc/quickbook/oalplus/quickref/enums/alc_error_code.hpp
//
// Automatically generated file, DO NOT modify manually.
// Edit the source 'source/enums/oalplus/alc_error_code.txt'
// or the 'source/enums/make_enum.py' script instead.
//
// Copyright 2010-2015 Matus Chochlik.
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
//[oalplus_enums_alc_error_code
namespace oalplus {

enum class ALCErrorCode : ALenum
{
NoError = AL_NO_ERROR,
InvalidDevice = AL_INVALID_DEVICE,
InvalidContext = AL_INVALID_CONTEXT,
InvalidEnum = AL_INVALID_ENUM,
InvalidValue = AL_INVALID_VALUE,
OutOfMemory = AL_OUT_OF_MEMORY
};

template <>
__Range<ALCErrorCode> __EnumValueRange<ALCErrorCode>(void);

__StrCRef __EnumValueName(ALCErrorCode);

} // namespace oalplus
//]
33 changes: 33 additions & 0 deletions doc/quickbook/oalplus/quickref/enums/alut_error_code.hpp
@@ -0,0 +1,33 @@
// File doc/quickbook/oalplus/quickref/enums/alut_error_code.hpp
//
// Automatically generated file, DO NOT modify manually.
// Edit the source 'source/enums/oalplus/alut_error_code.txt'
// or the 'source/enums/make_enum.py' script instead.
//
// Copyright 2010-2015 Matus Chochlik.
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
//[oalplus_enums_alut_error_code
namespace oalplus {

enum class ALUTErrorCode : ALenum
{
OutOfMemory = AL_OUT_OF_MEMORY,
InvalidOperation = AL_INVALID_OPERATION,
NoCurrentContext = AL_NO_CURRENT_CONTEXT,
AlErrorOnEntry = AL_AL_ERROR_ON_ENTRY,
AlcErrorOnEntry = AL_ALC_ERROR_ON_ENTRY,
UnsupportedFileType = AL_UNSUPPORTED_FILE_TYPE,
UnsupportedFileSubtype = AL_UNSUPPORTED_FILE_SUBTYPE,
CorruptOrTruncatedData = AL_CORRUPT_OR_TRUNCATED_DATA
};

template <>
__Range<ALUTErrorCode> __EnumValueRange<ALUTErrorCode>(void);

__StrCRef __EnumValueName(ALUTErrorCode);

} // namespace oalplus
//]
70 changes: 70 additions & 0 deletions implement/oalplus/detail/smart_enums.ipp
Expand Up @@ -9,6 +9,21 @@
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
struct AlErrorOnEntry {
template <typename Enum, Enum = Enum::AlErrorOnEntry> operator Enum (void) const{ return Enum::AlErrorOnEntry; }
template <typename Enum> friend bool operator==(Enum value, AlErrorOnEntry){ return value == Enum::AlErrorOnEntry; }
template <typename Enum> friend bool operator!=(Enum value, AlErrorOnEntry){ return value != Enum::AlErrorOnEntry; }
};
struct AlcErrorOnEntry {
template <typename Enum, Enum = Enum::AlcErrorOnEntry> operator Enum (void) const{ return Enum::AlcErrorOnEntry; }
template <typename Enum> friend bool operator==(Enum value, AlcErrorOnEntry){ return value == Enum::AlcErrorOnEntry; }
template <typename Enum> friend bool operator!=(Enum value, AlcErrorOnEntry){ return value != Enum::AlcErrorOnEntry; }
};
struct CorruptOrTruncatedData {
template <typename Enum, Enum = Enum::CorruptOrTruncatedData> operator Enum (void) const{ return Enum::CorruptOrTruncatedData; }
template <typename Enum> friend bool operator==(Enum value, CorruptOrTruncatedData){ return value == Enum::CorruptOrTruncatedData; }
template <typename Enum> friend bool operator!=(Enum value, CorruptOrTruncatedData){ return value != Enum::CorruptOrTruncatedData; }
};
struct ExponentDistance {
template <typename Enum, Enum = Enum::ExponentDistance> operator Enum (void) const{ return Enum::ExponentDistance; }
template <typename Enum> friend bool operator==(Enum value, ExponentDistance){ return value == Enum::ExponentDistance; }
Expand All @@ -34,6 +49,36 @@ template <typename Enum, Enum = Enum::Initial> operator Enum (void) const{ retur
template <typename Enum> friend bool operator==(Enum value, Initial){ return value == Enum::Initial; }
template <typename Enum> friend bool operator!=(Enum value, Initial){ return value != Enum::Initial; }
};
struct InvalidContext {
template <typename Enum, Enum = Enum::InvalidContext> operator Enum (void) const{ return Enum::InvalidContext; }
template <typename Enum> friend bool operator==(Enum value, InvalidContext){ return value == Enum::InvalidContext; }
template <typename Enum> friend bool operator!=(Enum value, InvalidContext){ return value != Enum::InvalidContext; }
};
struct InvalidDevice {
template <typename Enum, Enum = Enum::InvalidDevice> operator Enum (void) const{ return Enum::InvalidDevice; }
template <typename Enum> friend bool operator==(Enum value, InvalidDevice){ return value == Enum::InvalidDevice; }
template <typename Enum> friend bool operator!=(Enum value, InvalidDevice){ return value != Enum::InvalidDevice; }
};
struct InvalidEnum {
template <typename Enum, Enum = Enum::InvalidEnum> operator Enum (void) const{ return Enum::InvalidEnum; }
template <typename Enum> friend bool operator==(Enum value, InvalidEnum){ return value == Enum::InvalidEnum; }
template <typename Enum> friend bool operator!=(Enum value, InvalidEnum){ return value != Enum::InvalidEnum; }
};
struct InvalidName {
template <typename Enum, Enum = Enum::InvalidName> operator Enum (void) const{ return Enum::InvalidName; }
template <typename Enum> friend bool operator==(Enum value, InvalidName){ return value == Enum::InvalidName; }
template <typename Enum> friend bool operator!=(Enum value, InvalidName){ return value != Enum::InvalidName; }
};
struct InvalidOperation {
template <typename Enum, Enum = Enum::InvalidOperation> operator Enum (void) const{ return Enum::InvalidOperation; }
template <typename Enum> friend bool operator==(Enum value, InvalidOperation){ return value == Enum::InvalidOperation; }
template <typename Enum> friend bool operator!=(Enum value, InvalidOperation){ return value != Enum::InvalidOperation; }
};
struct InvalidValue {
template <typename Enum, Enum = Enum::InvalidValue> operator Enum (void) const{ return Enum::InvalidValue; }
template <typename Enum> friend bool operator==(Enum value, InvalidValue){ return value == Enum::InvalidValue; }
template <typename Enum> friend bool operator!=(Enum value, InvalidValue){ return value != Enum::InvalidValue; }
};
struct InverseDistance {
template <typename Enum, Enum = Enum::InverseDistance> operator Enum (void) const{ return Enum::InverseDistance; }
template <typename Enum> friend bool operator==(Enum value, InverseDistance){ return value == Enum::InverseDistance; }
Expand Down Expand Up @@ -69,11 +114,26 @@ template <typename Enum, Enum = Enum::MonoSources> operator Enum (void) const{ r
template <typename Enum> friend bool operator==(Enum value, MonoSources){ return value == Enum::MonoSources; }
template <typename Enum> friend bool operator!=(Enum value, MonoSources){ return value != Enum::MonoSources; }
};
struct NoCurrentContext {
template <typename Enum, Enum = Enum::NoCurrentContext> operator Enum (void) const{ return Enum::NoCurrentContext; }
template <typename Enum> friend bool operator==(Enum value, NoCurrentContext){ return value == Enum::NoCurrentContext; }
template <typename Enum> friend bool operator!=(Enum value, NoCurrentContext){ return value != Enum::NoCurrentContext; }
};
struct NoError {
template <typename Enum, Enum = Enum::NoError> operator Enum (void) const{ return Enum::NoError; }
template <typename Enum> friend bool operator==(Enum value, NoError){ return value == Enum::NoError; }
template <typename Enum> friend bool operator!=(Enum value, NoError){ return value != Enum::NoError; }
};
struct None {
template <typename Enum, Enum = Enum::None> operator Enum (void) const{ return Enum::None; }
template <typename Enum> friend bool operator==(Enum value, None){ return value == Enum::None; }
template <typename Enum> friend bool operator!=(Enum value, None){ return value != Enum::None; }
};
struct OutOfMemory {
template <typename Enum, Enum = Enum::OutOfMemory> operator Enum (void) const{ return Enum::OutOfMemory; }
template <typename Enum> friend bool operator==(Enum value, OutOfMemory){ return value == Enum::OutOfMemory; }
template <typename Enum> friend bool operator!=(Enum value, OutOfMemory){ return value != Enum::OutOfMemory; }
};
struct Paused {
template <typename Enum, Enum = Enum::Paused> operator Enum (void) const{ return Enum::Paused; }
template <typename Enum> friend bool operator==(Enum value, Paused){ return value == Enum::Paused; }
Expand Down Expand Up @@ -134,6 +194,16 @@ template <typename Enum, Enum = Enum::Undetermined> operator Enum (void) const{
template <typename Enum> friend bool operator==(Enum value, Undetermined){ return value == Enum::Undetermined; }
template <typename Enum> friend bool operator!=(Enum value, Undetermined){ return value != Enum::Undetermined; }
};
struct UnsupportedFileSubtype {
template <typename Enum, Enum = Enum::UnsupportedFileSubtype> operator Enum (void) const{ return Enum::UnsupportedFileSubtype; }
template <typename Enum> friend bool operator==(Enum value, UnsupportedFileSubtype){ return value == Enum::UnsupportedFileSubtype; }
template <typename Enum> friend bool operator!=(Enum value, UnsupportedFileSubtype){ return value != Enum::UnsupportedFileSubtype; }
};
struct UnsupportedFileType {
template <typename Enum, Enum = Enum::UnsupportedFileType> operator Enum (void) const{ return Enum::UnsupportedFileType; }
template <typename Enum> friend bool operator==(Enum value, UnsupportedFileType){ return value == Enum::UnsupportedFileType; }
template <typename Enum> friend bool operator!=(Enum value, UnsupportedFileType){ return value != Enum::UnsupportedFileType; }
};
struct Vendor {
template <typename Enum, Enum = Enum::Vendor> operator Enum (void) const{ return Enum::Vendor; }
template <typename Enum> friend bool operator==(Enum value, Vendor){ return value == Enum::Vendor; }
Expand Down
14 changes: 14 additions & 0 deletions implement/oalplus/detail/smart_values.ipp
Expand Up @@ -9,19 +9,31 @@
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
OGLPLUS_CONSTEXPR oalplus::smart_enums::AlErrorOnEntry AlErrorOnEntry = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::AlcErrorOnEntry AlcErrorOnEntry = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::CorruptOrTruncatedData CorruptOrTruncatedData = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::ExponentDistance ExponentDistance = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::ExponentDistanceClamped ExponentDistanceClamped = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Extensions Extensions = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Frequency Frequency = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Initial Initial = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::InvalidContext InvalidContext = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::InvalidDevice InvalidDevice = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::InvalidEnum InvalidEnum = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::InvalidName InvalidName = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::InvalidOperation InvalidOperation = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::InvalidValue InvalidValue = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::InverseDistance InverseDistance = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::InverseDistanceClamped InverseDistanceClamped = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::LinearDistance LinearDistance = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::LinearDistanceClamped LinearDistanceClamped = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Mono16 Mono16 = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Mono8 Mono8 = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::MonoSources MonoSources = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::NoCurrentContext NoCurrentContext = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::NoError NoError = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::None None = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::OutOfMemory OutOfMemory = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Paused Paused = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Playing Playing = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Refresh Refresh = {};
Expand All @@ -34,5 +46,7 @@ OGLPLUS_CONSTEXPR oalplus::smart_enums::Stopped Stopped = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Streaming Streaming = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Sync Sync = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Undetermined Undetermined = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::UnsupportedFileSubtype UnsupportedFileSubtype = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::UnsupportedFileType UnsupportedFileType = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Vendor Vendor = {};
OGLPLUS_CONSTEXPR oalplus::smart_enums::Version Version = {};
149 changes: 149 additions & 0 deletions implement/oalplus/enums/al_error_code_class.ipp
@@ -0,0 +1,149 @@
// File implement/oalplus/enums/al_error_code_class.ipp
//
// Automatically generated file, DO NOT modify manually.
// Edit the source 'source/enums/oalplus/al_error_code.txt'
// or the 'source/enums/make_enum.py' script instead.
//
// Copyright 2010-2015 Matus Chochlik.
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
namespace enums {
template <typename Base, template<ALErrorCode> class Transform>
class EnumToClass<Base, ALErrorCode, Transform>
: public Base
{
private:
Base& _base(void) { return *this; }
public:

#if defined AL_NO_ERROR
# if defined NoError
# pragma push_macro("NoError")
# undef NoError
Transform<ALErrorCode::NoError> NoError;
# pragma pop_macro("NoError")
# else
Transform<ALErrorCode::NoError> NoError;
# endif
#endif
#if defined AL_INVALID_NAME
# if defined InvalidName
# pragma push_macro("InvalidName")
# undef InvalidName
Transform<ALErrorCode::InvalidName> InvalidName;
# pragma pop_macro("InvalidName")
# else
Transform<ALErrorCode::InvalidName> InvalidName;
# endif
#endif
#if defined AL_INVALID_ENUM
# if defined InvalidEnum
# pragma push_macro("InvalidEnum")
# undef InvalidEnum
Transform<ALErrorCode::InvalidEnum> InvalidEnum;
# pragma pop_macro("InvalidEnum")
# else
Transform<ALErrorCode::InvalidEnum> InvalidEnum;
# endif
#endif
#if defined AL_INVALID_VALUE
# if defined InvalidValue
# pragma push_macro("InvalidValue")
# undef InvalidValue
Transform<ALErrorCode::InvalidValue> InvalidValue;
# pragma pop_macro("InvalidValue")
# else
Transform<ALErrorCode::InvalidValue> InvalidValue;
# endif
#endif
#if defined AL_INVALID_OPERATION
# if defined InvalidOperation
# pragma push_macro("InvalidOperation")
# undef InvalidOperation
Transform<ALErrorCode::InvalidOperation> InvalidOperation;
# pragma pop_macro("InvalidOperation")
# else
Transform<ALErrorCode::InvalidOperation> InvalidOperation;
# endif
#endif
#if defined AL_OUT_OF_MEMORY
# if defined OutOfMemory
# pragma push_macro("OutOfMemory")
# undef OutOfMemory
Transform<ALErrorCode::OutOfMemory> OutOfMemory;
# pragma pop_macro("OutOfMemory")
# else
Transform<ALErrorCode::OutOfMemory> OutOfMemory;
# endif
#endif

EnumToClass(void) { }
EnumToClass(Base&& base)
: Base(std::move(base))
#if defined AL_NO_ERROR
# if defined NoError
# pragma push_macro("NoError")
# undef NoError
, NoError(_base())
# pragma pop_macro("NoError")
# else
, NoError(_base())
# endif
#endif
#if defined AL_INVALID_NAME
# if defined InvalidName
# pragma push_macro("InvalidName")
# undef InvalidName
, InvalidName(_base())
# pragma pop_macro("InvalidName")
# else
, InvalidName(_base())
# endif
#endif
#if defined AL_INVALID_ENUM
# if defined InvalidEnum
# pragma push_macro("InvalidEnum")
# undef InvalidEnum
, InvalidEnum(_base())
# pragma pop_macro("InvalidEnum")
# else
, InvalidEnum(_base())
# endif
#endif
#if defined AL_INVALID_VALUE
# if defined InvalidValue
# pragma push_macro("InvalidValue")
# undef InvalidValue
, InvalidValue(_base())
# pragma pop_macro("InvalidValue")
# else
, InvalidValue(_base())
# endif
#endif
#if defined AL_INVALID_OPERATION
# if defined InvalidOperation
# pragma push_macro("InvalidOperation")
# undef InvalidOperation
, InvalidOperation(_base())
# pragma pop_macro("InvalidOperation")
# else
, InvalidOperation(_base())
# endif
#endif
#if defined AL_OUT_OF_MEMORY
# if defined OutOfMemory
# pragma push_macro("OutOfMemory")
# undef OutOfMemory
, OutOfMemory(_base())
# pragma pop_macro("OutOfMemory")
# else
, OutOfMemory(_base())
# endif
#endif
{ }
};

} // namespace enums

0 comments on commit 698d355

Please sign in to comment.