simplify some exception classes

Signed-off-by: Double Sine <xiao_ai_yu@live.cn>
This commit is contained in:
Double Sine
2022-05-07 23:08:50 +08:00
parent 73ff67d4a5
commit b3046b43f0
9 changed files with 99 additions and 105 deletions

View File

@@ -11,11 +11,7 @@ namespace nkg {
static constexpr const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
static constexpr const char padding_character = '=';
class decoding_error : public ::nkg::exception {
public:
decoding_error(std::string_view file, int line, std::string_view message) noexcept :
::nkg::exception(file, line, message) {}
};
class decoding_error;
static char symbol(alphabet_index_t idx);
@@ -28,4 +24,8 @@ namespace nkg {
static std::vector<uint8_t> decode(std::string_view b32_string);
};
class base32_rfc4648::decoding_error : public ::nkg::exception {
using ::nkg::exception::exception;
};
}

View File

@@ -6,15 +6,15 @@
namespace nkg {
struct base64_rfc4648 {
class backend_error : public ::nkg::exception {
public:
backend_error(std::string_view file, int line, std::string_view message) noexcept :
::nkg::exception(file, line, message) {}
};
class backend_error;
static std::string encode(const std::vector<std::uint8_t>& data);
static std::vector<uint8_t> decode(std::string_view str_b64);
};
class base64_rfc4648::backend_error : public ::nkg::exception {
using ::nkg::exception::exception;
};
}

View File

@@ -35,11 +35,7 @@ namespace nkg {
class navicat_serial_generator {
public:
class version_error : public ::nkg::exception {
public:
version_error(std::string_view file, int line, std::string_view message) noexcept :
::nkg::exception(file, line, message) {}
};
class version_error;
private:
static inline const DES_cblock s_des_key0 = { 0x64, 0xAD, 0xF3, 0x2F, 0xAE, 0xF2, 0x1A, 0x27 };
@@ -72,4 +68,8 @@ namespace nkg {
const std::string& serial_number_formatted() const noexcept;
};
class navicat_serial_generator::version_error : public ::nkg::exception {
using ::nkg::exception::exception;
};
}