twain2/hugaotwainds/JsonConfig.h

26 lines
744 B
C
Raw Normal View History

2020-03-11 02:53:30 +00:00
#pragma once
#include "PublicFunc.h"
#include <vector>
#include <json.h>
using namespace std;
class JsonConfig
{
public:
JsonConfig(void);
~JsonConfig(void);
public:
void WriteToJson(PCONFIGPARAMS pConfigItem,const std::string fileName,bool isConfigItem=true);
//PCONFIGPARAMS ReadJsonFromFile(const char* fileNames);
void WriteJsonData(const std::string fileName);
void WriteJsonArrayToFile(std::vector<CONFIGPARAMS> cfgArray,const std::string filename);
CONFIGPARAMS ReadDefaultConfig();
bool DeleteJsonFile(std::string path);
std::vector<CONFIGPARAMS> ReadJsonArrayFromFile(const std::string filename);
CONFIGPARAMS GetDefaultConfigParams();
private:
std::vector<CONFIGPARAMS> parseJsonFromString(const std::string str) ;
};