You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
746 B

#ifndef JsonCoversion_H
#define JsonCoversion_H
#include<iostream>
#include<memory>
#include<string>
#include "json/json.h"
using namespace std;
class JsonCoversion
{
protected:
Json::Value root;
// Json::FastWriter writer; //弃用 改用StreamWriterBuilder
Json::StreamWriterBuilder writerBuilder;
// Json::Reader reader; //弃用 改用CharReaderBuilder
Json::CharReaderBuilder readerBuilder;
public:
JsonCoversion();
virtual ~JsonCoversion();
protected:
public:
string toJson();
void toObject(string & strBuf);
protected:
virtual Json::Value toJsonValue() = 0;
virtual void toObjectFromValue(Json::Value root) = 0;
};
#endif // JsonCoversion_H