📄 data_type.h
字号:
/*
数据类型定义及其转换函数实行文件
编写时间:2007-10-27
修改时间:------------
*/
#ifndef DATATYPE_H
#define DATATYPE_H
#include <string>
#include <boost\lexical_cast.hpp>
using namespace std;
using namespace boost;
/*数据类型枚举定义*/
typedef enum{
CHAR_T,UCHAR_T,BIT_T,BITS_T,STR_T,INT16_T,UINT16_T,INT_T,UINT_T,BOOL_T,FLOOT_T,DOUBLE_T,NULL_T} MY_TYPE;
/*数据所占用的字节数定义*/
#define CHAR_SZ 1;
#define UCHAR_SZ 1;
#define BIT_SZ 1;
#define BITS_SZ 1;
#define STR_SZ 0;
#define INT16_SZ 2;
#define UINT16_SZ 2;
#define INT_SZ 4;
#define UINT_SZ 4;
#define BOOL_SZ 1;
#define FLOOT_SZ 4;
#define DOUBLE_SZ 8;
/*位串数据类型定义*/
typedef struct{
int numbers; //位数
unsigned int value; //值
} bits_t;
int get_size(MY_TYPE type);
void strtobits(string str,int& value);
class CompilerException {//错误处理类
public:
explicit CompilerException(int lineNo, std::string s):
line(lineNo),//记录错误发生的行
text(s) {}//错误信息
std::string what() const {//返回错误信息。
return line > 0 ? " (" +lexical_cast<std::string>(line) + "): " + text : ": " + text;
}
private:
int line;
string text;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -