60 lines
2.1 KiB
C++
60 lines
2.1 KiB
C++
#pragma once
|
||
#include <string>
|
||
#include <vector>
|
||
using std::string;
|
||
using std::vector;
|
||
enum class ErrorType {
|
||
Success = 0,
|
||
Empty = 1, ///<为空
|
||
EnCodeError = 2, ///<表达式中文或其它字符
|
||
EqualError = 3, ///<相等应使用"=="而非其他
|
||
NotEqualError = 4, ///<不等应使用"!="而非其他
|
||
CalError = 5, ///<计算错误,比如除数是0
|
||
};
|
||
enum class ErrorLocation {
|
||
Success = 0,
|
||
Tags = 1, ///< tag点异常
|
||
ExeCyc = 2, ///<执行周期
|
||
DataSource = 3, ///<数据源
|
||
DataValue = 4, ///<数据项
|
||
ActExp = 5, ///<动作表达式
|
||
HoldOn = 6, ///<动作保持
|
||
FBExp = 7, ///<反馈表达式
|
||
ResultExp = 8, ///<监控表达式
|
||
};
|
||
|
||
// struct ErrorCode {
|
||
// static const vector<string> ErrorTypeDescription;
|
||
// static const vector<string> ErrorLocationDescription;
|
||
// };
|
||
|
||
// const vector<string> ErrorCode::ErrorTypeDescription = {
|
||
// "正确",
|
||
// "为空",
|
||
// "表达式存在中文等其它字符",
|
||
// "相等应使用\"==\"而非其他",
|
||
// "相等应使用\"!=\"而非其他",
|
||
// "计算错误,比如除数是0"};
|
||
|
||
// const vector<string> ErrorCode::ErrorLocationDescription = {
|
||
// "正确", "tag点异常", "执行周期", "数据源", "数据项",
|
||
// "动作表达式", "动作保持", "反馈表达式", "监控表达式"};
|
||
|
||
namespace ErrorCode {
|
||
const vector<string> ErrorTypeDescription = {"正确",
|
||
"为空",
|
||
"表达式存在中文等其它字符",
|
||
"相等应使用\"==\"而非其他",
|
||
"相等应使用\"!=\"而非其他",
|
||
"计算错误,比如除数是0"};
|
||
|
||
const vector<string> ErrorLocationDescription = {
|
||
"正确", "tag点异常", "执行周期", "数据源", "数据项",
|
||
"动作表达式", "动作保持", "反馈表达式", "监控表达式"};
|
||
} // namespace ErrorCode
|
||
|
||
struct ErrorCodeType {
|
||
ErrorType error_type;
|
||
ErrorLocation error_location;
|
||
};
|