2019-07-27 22:44:32 +08:00
|
|
|
|
#pragma once
|
2018-08-19 15:31:26 +08:00
|
|
|
|
#include "../acl_cpp_define.hpp"
|
|
|
|
|
#include "diff_object.hpp"
|
|
|
|
|
|
|
|
|
|
namespace acl
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
class diff_string : public diff_object
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
2019-07-27 22:44:32 +08:00
|
|
|
|
* 构造函数
|
2018-08-19 15:31:26 +08:00
|
|
|
|
* @param manager {diff_manager&}
|
2019-07-27 22:44:32 +08:00
|
|
|
|
* @param key {const char*} 以字符串方式表示的键,非空字符串
|
|
|
|
|
* @param val {const char*} 以字符串方式表示的值,非空字符串
|
2018-08-19 15:31:26 +08:00
|
|
|
|
*/
|
|
|
|
|
diff_string(diff_manager& manager, const char* key, const char* val);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-27 22:44:32 +08:00
|
|
|
|
* 设置本对象所在的区间值
|
2018-08-19 15:31:26 +08:00
|
|
|
|
* @param range {long long}
|
|
|
|
|
*/
|
|
|
|
|
void set_range(long long range);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-27 22:44:32 +08:00
|
|
|
|
* 获得本对象所在的区间值
|
2018-08-19 15:31:26 +08:00
|
|
|
|
* @return {long long}
|
|
|
|
|
*/
|
|
|
|
|
long long get_range(void) const
|
|
|
|
|
{
|
|
|
|
|
return range_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// override: 基类纯虚函数的实现
|
2018-08-19 15:31:26 +08:00
|
|
|
|
const char* get_key(void) const;
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// override: 基类纯虚函数的实现
|
2018-08-19 15:31:26 +08:00
|
|
|
|
const char* get_val(void) const;
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// override: 基类纯函数的实现
|
2018-08-19 15:31:26 +08:00
|
|
|
|
bool operator== (const diff_object& obj) const;
|
|
|
|
|
|
|
|
|
|
// @override
|
|
|
|
|
bool check_range(long long range_from, long long range_to) const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const char* key_;
|
|
|
|
|
const char* val_;
|
|
|
|
|
long long range_;
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// 析构函数声明为私有的,从而要求动态创建本类对象
|
2018-08-19 15:31:26 +08:00
|
|
|
|
~diff_string(void);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|