#ifndef SIRIUS_GDAL_ERROR_CODE_H_
#define SIRIUS_GDAL_ERROR_CODE_H_
#include <system_error>
#include <cpl_error.h>
// This implementation is inspired by
// https://akrzemi1.wordpress.com/2017/07/12/your-own-error-code/
namespace sirius {
namespace gdal {
enum class ErrorCode {
kNone = CPLE_None,
kAppDefined = CPLE_AppDefined,
kOutOfMemory = CPLE_OutOfMemory,
kFileIO = CPLE_FileIO,
kOpenFailed = CPLE_OpenFailed,
kIllegalArg = CPLE_IllegalArg,
kNotSupported = CPLE_NotSupported,
kAssertionFailed = CPLE_AssertionFailed,
kNoWriteAccess = CPLE_NoWriteAccess,
kUserInterrupt = CPLE_UserInterrupt,
kObjectNull = CPLE_ObjectNull,
kHttpResponse = CPLE_HttpResponse,
kAWSBucketNotFound = CPLE_AWSBucketNotFound,
kAWSObjectNotFound = CPLE_AWSObjectNotFound,
kAWSAccessDenied = CPLE_AWSAccessDenied,
kAWSInvalidCredentials = CPLE_AWSInvalidCredentials,
kAWSSignatureDoesNotMatch = CPLE_AWSSignatureDoesNotMatch,
};
std::error_code make_error_code(::CPLErrorNum errc);
} // namespace gdal
} // namespace sirius
namespace std {
template <>
struct is_error_code_enum<sirius::gdal::ErrorCode> : std::true_type {};
} // namespace std
#endif // SIRIUS_GDAL_ERROR_CODE_H_