MyLib
This commit is contained in:
29
Log/ConfigParser.h
Normal file
29
Log/ConfigParser.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef CONFIGPARSER_H
|
||||
#define CONFIGPARSER_H
|
||||
/**
|
||||
* 配置文件解析模块
|
||||
* 目标:实现对多种文件格式的解析功能
|
||||
* 1、ini格式文件 √
|
||||
* 2、json格式文件 未实现
|
||||
* 3、YAML格式文件 未实现
|
||||
* 4、Protobuf格式文件 未实现
|
||||
*/
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
/** 状态码 */
|
||||
enum CPStatus {
|
||||
CPSUCCESS = 0,//成功
|
||||
CPFILE = -1//文件错误
|
||||
};
|
||||
|
||||
/**
|
||||
* 读取ini类型的配置文件
|
||||
* @param path 配置文件路径
|
||||
* @param config 存储配置文件的unordered_map容器
|
||||
* @return 状态码
|
||||
*/
|
||||
CPStatus configFromIni(const std::string &path, std::unordered_map<std::string, std::string> &config);
|
||||
|
||||
|
||||
#endif //CONFIGPARSER_H
|
||||
Reference in New Issue
Block a user