2024-05-15 10:59:43 +08:00
|
|
|
#ifndef CONIFG_HEADER
|
|
|
|
|
#define CONIFG_HEADER
|
|
|
|
|
|
|
|
|
|
#include <SimpleIni.h>
|
2024-09-14 00:02:48 +08:00
|
|
|
|
|
|
|
|
#include <string>
|
2024-08-27 20:15:41 +08:00
|
|
|
#include <vector>
|
2024-05-15 10:59:43 +08:00
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
[Basic]
|
|
|
|
|
oper_node=IODEF/ITEMS
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
2024-08-27 17:30:48 +08:00
|
|
|
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
|
2024-05-15 10:59:43 +08:00
|
|
|
{
|
|
|
|
|
public:
|
2024-08-27 17:30:48 +08:00
|
|
|
CGroupIni();
|
2024-05-15 10:59:43 +08:00
|
|
|
|
|
|
|
|
public:
|
2024-08-27 17:30:48 +08:00
|
|
|
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);
|
2024-05-15 10:59:43 +08:00
|
|
|
|
|
|
|
|
private:
|
2024-08-27 17:30:48 +08:00
|
|
|
void default_set();
|
2024-05-28 09:17:23 +08:00
|
|
|
|
2024-05-15 10:59:43 +08:00
|
|
|
private:
|
|
|
|
|
std::string work_dir_{};
|
2024-08-27 17:30:48 +08:00
|
|
|
std::string work_file_{};
|
2024-05-28 09:17:23 +08:00
|
|
|
CSimpleIniA ini_{};
|
2024-05-15 10:59:43 +08:00
|
|
|
};
|
|
|
|
|
|
2024-05-17 22:46:33 +08:00
|
|
|
#endif
|