Advertisement
146f73

rapidjson_wtf

Jun 17th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. class Encoder
  2. {
  3. private:
  4.     rapidjson::Document json;
  5. public:
  6.     Encoder();
  7.     ~Encoder();
  8.     bool load(std::string path);
  9.     std::string get_value_by_key(const char* key);
  10.     std::string encode_str(const char* input);
  11. };
  12.  
  13. ...
  14.  
  15.  
  16. std::string Encoder::get_value_by_key(const char* key)
  17. {
  18.     rapidjson::Value& s = json[key];
  19.     return s.GetString();
  20. }
  21.  
  22. std::string Encoder::encode_str(const char* input){
  23.     for (int i = 0; i < strLength(input); i++)
  24.     {
  25.         std::stringstream tmp;
  26.         tmp.str("");
  27.         tmp << input[i];
  28.         std::cout << get_value_by_key(tmp.str().c_str()) << std::endl;
  29.     }
  30.     //std::cout << input << std::endl;
  31.     return "ok";
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement