| 23 | protected: |
| 24 | template <typename Writer> |
| 25 | void Serialize(Writer& writer) const { |
| 26 | // This base class just write out name-value pairs, without wrapping within an object. |
| 27 | writer.String("name"); |
| 28 | #if RAPIDJSON_HAS_STDSTRING |
| 29 | writer.String(name_); |
| 30 | #else |
| 31 | writer.String(name_.c_str(), static_cast<SizeType>(name_.length())); // Supplying length of string is faster. |
| 32 | #endif |
| 33 | writer.String("age"); |
| 34 | writer.Uint(age_); |
| 35 | } |
| 36 | |
| 37 | private: |
| 38 | std::string name_; |