big-change:添加两种类型结构读写支持
This commit is contained in:
31
src/config.h
31
src/config.h
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <string>
|
||||
#include <SimpleIni.h>
|
||||
#include "../public_def.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -12,25 +11,37 @@ oper_node=IODEF/ITEMS
|
||||
|
||||
*/
|
||||
|
||||
class ConfigIni
|
||||
using StrVec_t = std::vector<std::string>;
|
||||
struct OneGroupIni {
|
||||
std::string name;
|
||||
std::string main_nodes;
|
||||
std::string relative_nodes;
|
||||
std::string item_key;
|
||||
std::string propertis;
|
||||
long max_col_len{1000};
|
||||
long max_blank_add{60};
|
||||
bool is_same;
|
||||
};
|
||||
|
||||
class CGroupIni
|
||||
{
|
||||
public:
|
||||
ConfigIni() = default;
|
||||
~ConfigIni() = default;
|
||||
CGroupIni();
|
||||
|
||||
public:
|
||||
bool set_work_exe(const std::string& dir);
|
||||
bool set_xml_path(const std::string& path);
|
||||
OprBase get_config();
|
||||
bool load_ini();
|
||||
void get_all_node(StrVec_t& vec);
|
||||
bool add_item(const OneGroupIni& group);
|
||||
bool get_item(OneGroupIni& group);
|
||||
bool del_item(const std::string& key);
|
||||
|
||||
private:
|
||||
bool parse_ini();
|
||||
void default_set();
|
||||
|
||||
private:
|
||||
std::string work_dir_{};
|
||||
std::string ini_path_{};
|
||||
std::string work_file_{};
|
||||
CSimpleIniA ini_{};
|
||||
OprBase opr_base_{};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user