Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- static int count = 0;
- class Serializer {
- public:
- virtual void BeginArray(){}
- virtual void AddArrayItem(const std::string &){}
- virtual void EndArray(){}
- };
- class JsonSerializer : public Serializer {
- public:
- void BeginArray() {
- std::cout << '[';
- }
- void EndArray() {
- if (count > 0) {
- std::cout << '\b';
- }
- std::cout << ']';
- }
- void AddArrayItem(const std::string& str) {
- std::cout << "\"" << str << "\"" << ',';
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement