Dynalib Utils
JSONGenerator.h
Go to the documentation of this file.
1 #ifndef JSON_GENERATOR_H
2 #define JSON_GENERATOR_H
3 
4 #include "../String.h"
5 #include "../DynaList.h"
6 #include "../IntWrapper.h"
7 #include "../Parser/Tokenizer.h"
8 #include "../Parser/Token.h"
9 #include "../Graph/Node.h"
10 
11 using namespace Graph;
12 class DynaLogger;
13 
14 namespace KAML {
15 
16  class JSONGenerator {
17  static DynaLogger* logger;
18  bool _pretty;
19  int _indentLevel;
20 
21  private:
22  void _addIndent(String& str);
23  public:
24  static String& jsonise(String& str);
25  static String& unjsonise(String& str);
26 
27  JSONGenerator();
28  virtual ~JSONGenerator();
29 
30  bool isPretty();
31  String generateJson(Node& rootNode, bool pretty = false, int docSelect = -1);
32  bool generateValue(Node& node, String& outStr);
33  bool generateTypeObject(Node& node, String& outStr, const String& type, const String& value);
34  bool generateScalar(Node& node, String& outStr);
35  };
36 }
37 
38 #endif
DynaLogger * logger
Definition: Manager.cpp:23
GeneratorWrapper< T > value(T &&value)
Definition: catch.hpp:4005
Definition: String.h:60
Definition: Node.h:47
Definition: JSONGenerator.h:16
return os str()
Definition: DynaLogger.h:321
Definition: File.cpp:10
Definition: Node.cpp:13