PlayerLogout.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef __PALYERLOGOUT_H_
  2. #define __PALYERLOGOUT_H_
  3. #include <iostream>
  4. #include <rapidjson/document.h>
  5. #include <rapidjson/rapidjson.h>
  6. #include <rapidjson/stringbuffer.h>
  7. #include <rapidjson/writer.h>
  8. using namespace std;
  9. class PlayerLogout
  10. {
  11. private:
  12. std::string URL = "/manager.do";
  13. public:
  14. std::string cid;
  15. std::string ctype;
  16. std::string cname;
  17. public:
  18. PlayerLogout();
  19. ~PlayerLogout();
  20. void setURL(std::string url){
  21. this->URL = url;
  22. }
  23. std::string getUrl(){
  24. return this->URL;
  25. }
  26. void objectToJson(std::string& str){
  27. rapidjson::StringBuffer strBuf;
  28. rapidjson::Writer<rapidjson::StringBuffer> writer(strBuf);
  29. this->objectToJson(writer);
  30. str = strBuf.GetString();
  31. }
  32. void objectToJson(rapidjson::Writer<rapidjson::StringBuffer>& writer){
  33. writer.StartObject();
  34. writer.Key("cid");
  35. writer.String(cid.c_str());
  36. writer.Key("ctype");
  37. writer.String(ctype.c_str());
  38. writer.Key("cname");
  39. writer.String(cname.c_str());
  40. writer.EndObject();
  41. }
  42. };
  43. #endif