#ifndef ARBUTILS_ERRORHELPERS_HPP #define ARBUTILS_ERRORHELPERS_HPP #if defined(__clang__) #include #else #include #endif #include #include "Defines.hpp" #include "Exception.hpp" #if defined(__clang__) namespace std { using source_location = std::experimental::source_location; } #endif namespace ArbUt { class Exception; /// @brief Helper class for multiple error handling class __ErrorHelpers { static constexpr const char* non_null file_name(const char* non_null path) { const char* non_null file = path; while (*path != 0) { if (*path++ == '/') { file = path; } } return file; } public: /// @brief Create an error for the Ensure macro static ArbUt::Exception CreateEnsureError(const char* non_null exp, const std::source_location& location); /// @brief Create an error for the Throw macro static ArbUt::Exception CreateThrowError(const char* non_null exp, const std::source_location& location); }; }; #endif // ARBUTILS_ERRORHELPERS_HPP