This commit is contained in:
2024-12-05 15:46:08 +08:00
parent 08f6f4b0f4
commit 4ae4cf8554
26 changed files with 1385 additions and 1381 deletions
@@ -1,26 +1,26 @@
// 这是一个异常,当用户尝试插入已存在的连接时抛出
#ifndef INSERTEXISTEDCONNECTEXCEPTION_H
#define INSERTEXISTEDCONNECTEXCEPTION_H
#include <exception>
#include <string>
class InsertExistedConnectException : public std::exception{
private:
std::string message;
public:
InsertExistedConnectException():message("You input id is out of range"){}
InsertExistedConnectException(const std::string& msg) : message(msg) {}
InsertExistedConnectException(const std::string& msg,int errCode):message(msg+" Err code: "+std::to_string(errCode)){}
virtual ~InsertExistedConnectException() noexcept {}
virtual const char* what() const noexcept override {
return message.c_str();
}
};
#endif //INSERTEXISTEDCONNECTEXCEPTION_H
// 这是一个异常,当用户尝试插入已存在的连接时抛出
#ifndef INSERTEXISTEDCONNECTEXCEPTION_H
#define INSERTEXISTEDCONNECTEXCEPTION_H
#include <exception>
#include <string>
class InsertExistedConnectException : public std::exception{
private:
std::string message;
public:
InsertExistedConnectException():message("You input id is out of range"){}
InsertExistedConnectException(const std::string& msg) : message(msg) {}
InsertExistedConnectException(const std::string& msg,int errCode):message(msg+" Err code: "+std::to_string(errCode)){}
virtual ~InsertExistedConnectException() noexcept {}
virtual const char* what() const noexcept override {
return message.c_str();
}
};
#endif //INSERTEXISTEDCONNECTEXCEPTION_H
@@ -1,25 +1,25 @@
// 这是一个异常,当用户给的节点id超出最大值时抛出
#ifndef NODEIDOUTOFRANGEEXCEPTION_H
#define NODEIDOUTOFRANGEEXCEPTION_H
#include <exception>
#include<string>
class NodeIdOutOfRangeException : public std::exception{
private:
std::string message;
public:
NodeIdOutOfRangeException():message("You input id is out of range"){}
NodeIdOutOfRangeException(const std::string& msg) : message(msg) {}
NodeIdOutOfRangeException(const std::string& msg,int errCode):message(msg+" Err code: "+std::to_string(errCode)){}
virtual ~NodeIdOutOfRangeException() noexcept {}
virtual const char* what() const noexcept override {
return message.c_str();
}
};
#endif //NODEIDOUTOFRANGEEXCEPTION_H
// 这是一个异常,当用户给的节点id超出最大值时抛出
#ifndef NODEIDOUTOFRANGEEXCEPTION_H
#define NODEIDOUTOFRANGEEXCEPTION_H
#include <exception>
#include<string>
class NodeIdOutOfRangeException : public std::exception{
private:
std::string message;
public:
NodeIdOutOfRangeException():message("You input id is out of range"){}
NodeIdOutOfRangeException(const std::string& msg) : message(msg) {}
NodeIdOutOfRangeException(const std::string& msg,int errCode):message(msg+" Err code: "+std::to_string(errCode)){}
virtual ~NodeIdOutOfRangeException() noexcept {}
virtual const char* what() const noexcept override {
return message.c_str();
}
};
#endif //NODEIDOUTOFRANGEEXCEPTION_H
@@ -1,22 +1,22 @@
// 这是一个异常,当用户试图连接图中的两个相同节点时抛出
#ifndef SAMENODECONNECTEXCEPTION_H
#define SAMENODECONNECTEXCEPTION_H
#include <exception>
#include <string>
class SameNodeConnectException : public std::exception{
private:
std::string message;
public:
SameNodeConnectException():message("Don't connect same node"){}
SameNodeConnectException(const std::string& msg) : message(msg) {}
SameNodeConnectException(const std::string& msg,int errCode):message(msg+" Err code: "+std::to_string(errCode)){}
virtual ~SameNodeConnectException() noexcept {}
virtual const char* what() const noexcept override {
return message.c_str();
}
};
#endif //SAMENODECONNECTEXCEPTION_H
// 这是一个异常,当用户试图连接图中的两个相同节点时抛出
#ifndef SAMENODECONNECTEXCEPTION_H
#define SAMENODECONNECTEXCEPTION_H
#include <exception>
#include <string>
class SameNodeConnectException : public std::exception{
private:
std::string message;
public:
SameNodeConnectException():message("Don't connect same node"){}
SameNodeConnectException(const std::string& msg) : message(msg) {}
SameNodeConnectException(const std::string& msg,int errCode):message(msg+" Err code: "+std::to_string(errCode)){}
virtual ~SameNodeConnectException() noexcept {}
virtual const char* what() const noexcept override {
return message.c_str();
}
};
#endif //SAMENODECONNECTEXCEPTION_H