forked from blue/lmdbal
some tuning, specializations, basic testing
This commit is contained in:
parent
5f90a21fe6
commit
047f96b54a
17 changed files with 370 additions and 508 deletions
26
exceptions.h
26
exceptions.h
|
@ -17,10 +17,22 @@
|
|||
#ifndef CORE_DATABASE_EXCEPTIONS_H
|
||||
#define CORE_DATABASE_EXCEPTIONS_H
|
||||
|
||||
#include "exception.h"
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include "database.h"
|
||||
|
||||
class DataBase::Directory: public Utils::Exception {
|
||||
class DataBase::Exception : public std::exception
|
||||
{
|
||||
public:
|
||||
Exception();
|
||||
virtual ~Exception();
|
||||
|
||||
virtual std::string getMessage() const = 0;
|
||||
|
||||
const char* what() const noexcept( true );
|
||||
};
|
||||
|
||||
class DataBase::Directory: public DataBase::Exception {
|
||||
public:
|
||||
Directory(const std::string& path);
|
||||
|
||||
|
@ -29,7 +41,7 @@ private:
|
|||
std::string path;
|
||||
};
|
||||
|
||||
class DataBase::Closed : public Utils::Exception {
|
||||
class DataBase::Closed : public DataBase::Exception {
|
||||
public:
|
||||
Closed(const std::string& p_operation, const std::string& dbName, const std::string& tableName);
|
||||
|
||||
|
@ -40,7 +52,7 @@ private:
|
|||
std::string tableName;
|
||||
};
|
||||
|
||||
class DataBase::Opened : public Utils::Exception {
|
||||
class DataBase::Opened : public DataBase::Exception {
|
||||
public:
|
||||
Opened(const std::string& dbName, const std::string& tableName);
|
||||
|
||||
|
@ -50,7 +62,7 @@ private:
|
|||
std::string tableName;
|
||||
};
|
||||
|
||||
class DataBase::NotFound : public Utils::Exception {
|
||||
class DataBase::NotFound : public DataBase::Exception {
|
||||
public:
|
||||
NotFound(const std::string& key, const std::string& dbName, const std::string& tableName);
|
||||
|
||||
|
@ -61,7 +73,7 @@ private:
|
|||
std::string tableName;
|
||||
};
|
||||
|
||||
class DataBase::Exist : public Utils::Exception {
|
||||
class DataBase::Exist : public DataBase::Exception {
|
||||
public:
|
||||
Exist(const std::string& key, const std::string& dbName, const std::string& tableName);
|
||||
|
||||
|
@ -72,7 +84,7 @@ private:
|
|||
std::string tableName;
|
||||
};
|
||||
|
||||
class DataBase::Unknown : public Utils::Exception {
|
||||
class DataBase::Unknown : public DataBase::Exception {
|
||||
public:
|
||||
Unknown(const std::string& dbName, const std::string& message, const std::optional<std::string>& tableName = std::nullopt);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue