Update .gitignore, CMakeLists.txt, CMakePresets.json, and 10 more files
This commit is contained in:
1 parent
88ff181bfd
commit
1f58c33bb7
13 files changed
+3380
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
namespace spdlogconfig {
|
||||
// declaration section
|
||||
|
||||
/**
|
||||
* Setup error with a textual description.
|
||||
*
|
||||
* This exception type is used to report configuration and initialization
|
||||
* failures within the spdlog configuration module.
|
||||
*/
|
||||
class spdlogconfig_error : public std::exception {
|
||||
public:
|
||||
/**
|
||||
* Construct an error from a C-string message.
|
||||
*
|
||||
* @param msg Error message to store.
|
||||
* @throw std::bad_alloc If memory allocation for the message fails.
|
||||
*/
|
||||
spdlogconfig_error(const char *const msg);
|
||||
|
||||
/**
|
||||
* Construct an error from a std::string message.
|
||||
*
|
||||
* @param msg Error message to store (moved into this object).
|
||||
* @throw std::bad_alloc If memory allocation for the message fails.
|
||||
*/
|
||||
spdlogconfig_error(std::string msg);
|
||||
|
||||
/**
|
||||
* Retrieve the stored error message.
|
||||
*
|
||||
* @return Null-terminated error message string.
|
||||
*/
|
||||
auto what() const noexcept -> const char * override;
|
||||
|
||||
private:
|
||||
/** Stored error message text. */
|
||||
std::string msg;
|
||||
};
|
||||
|
||||
// implementation section
|
||||
|
||||
inline spdlogconfig_error::spdlogconfig_error(const char *const msg)
|
||||
: msg(msg) {}
|
||||
|
||||
inline spdlogconfig_error::spdlogconfig_error(std::string msg)
|
||||
: msg(std::move(msg)) {}
|
||||
|
||||
inline auto spdlogconfig_error::what() const noexcept -> const char * {
|
||||
return msg.c_str();
|
||||
}
|
||||
} // namespace spdlogconfig
|
||||
Reference in new issue
Block a user