SendDevInfo.h 956 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef __SENDDEVINFO_H_
  2. #define __SENDDEVINFO_H_
  3. #include <iostream>
  4. #include <vector>
  5. #include <rapidjson/document.h>
  6. #include <rapidjson/rapidjson.h>
  7. #include <rapidjson/stringbuffer.h>
  8. #include <rapidjson/writer.h>
  9. class SendDevInfo
  10. {
  11. public:
  12. std::string SNCode;
  13. std::string Address;
  14. std::string Time;
  15. public:
  16. SendDevInfo(){}
  17. ~SendDevInfo(){}
  18. void objectToJson(std::string& str){
  19. rapidjson::StringBuffer strBuf;
  20. rapidjson::Writer<rapidjson::StringBuffer> writer(strBuf);
  21. this->objectToJson(writer);
  22. str = strBuf.GetString();
  23. }
  24. void objectToJson(rapidjson::Writer<rapidjson::StringBuffer>& writer){
  25. writer.StartObject();
  26. writer.Key("SNCode");
  27. writer.String(SNCode.c_str());
  28. writer.Key("Address");
  29. writer.String(Address.c_str());
  30. writer.Key("Time");
  31. writer.String(Time.c_str());
  32. writer.EndObject();
  33. }
  34. };
  35. #endif