GrabBag/VrConfig/_Inc/VrConfig.h

64 lines
1.7 KiB
C++

#ifndef VRCONFIG_H
#define VRCONFIG_H
#include "IVrConfig.h"
#include "tinyxml2.h"
#include <string>
/**
* @brief 实现IVrConfig接口的配置类
*/
class CVrConfig : public IVrConfig
{
public:
/**
* @brief 构造函数
*/
CVrConfig();
/**
* @brief 析构函数
*/
virtual ~CVrConfig();
/**
* @brief 加载配置文件
* @param filePath 配置文件路径
* @return 加载的配置结果
*/
virtual ConfigResult LoadConfig(const std::string& filePath) override;
/**
* @brief 保存配置文件
* @param filePath 配置文件路径
* @param configResult 配置结果
* @return 是否保存成功
*/
virtual bool SaveConfig(const std::string& filePath, ConfigResult& configResult) override;
/**
* @brief 设置配置改变通知回调
* @param notify 通知接口指针
*/
virtual void SetConfigChangeNotify(IVrConfigChangeNotify* notify) override;
private:
IVrConfigChangeNotify* m_pNotify = nullptr; // 配置改变通知回调
/**
* @brief 解析颜色模板字符串
* @param colorStr 颜色模板字符串,格式为"0.0,0.0,0.0,..."
* @param colorTemplate 输出的颜色模板数组
*/
void ParseColorTemplate(const std::string& colorStr, double colorTemplate[RGN_HIST_SIZE]);
/**
* @brief 序列化颜色模板数组为字符串
* @param colorTemplate 颜色模板数组
* @return 序列化后的字符串
*/
std::string SerializeColorTemplate(const double colorTemplate[RGN_HIST_SIZE]);
};
#endif // VRCONFIG_H