#ifndef __SENDDEVINFO_H_ #define __SENDDEVINFO_H_ #include <iostream> #include <vector> #include <rapidjson/document.h> #include <rapidjson/rapidjson.h> #include <rapidjson/stringbuffer.h> #include <rapidjson/writer.h> class SendDevInfo { public: std::string SNCode; std::string Address; std::string Time; public: SendDevInfo(){} ~SendDevInfo(){} void objectToJson(std::string& str){ rapidjson::StringBuffer strBuf; rapidjson::Writer<rapidjson::StringBuffer> writer(strBuf); this->objectToJson(writer); str = strBuf.GetString(); } void objectToJson(rapidjson::Writer<rapidjson::StringBuffer>& writer){ writer.StartObject(); writer.Key("SNCode"); writer.String(SNCode.c_str()); writer.Key("Address"); writer.String(Address.c_str()); writer.Key("Time"); writer.String(Time.c_str()); writer.EndObject(); } }; #endif