49 #ifndef __CU_JSON_WRITER_H__
50 #define __CU_JSON_WRITER_H__
51 #include <cugl/io/CUTextWriter.h>
52 #include <cugl/assets/CUJsonValue.h>
72 #pragma mark Static Constructors
90 static std::shared_ptr<JsonWriter>
alloc(
const std::string& file) {
91 std::shared_ptr<JsonWriter> result = std::make_shared<JsonWriter>();
92 return (result->init(file) ? result :
nullptr);
111 static std::shared_ptr<JsonWriter>
alloc(
const char* file) {
112 std::shared_ptr<JsonWriter> result = std::make_shared<JsonWriter>();
113 return (result->init(file) ? result :
nullptr);
133 std::shared_ptr<JsonWriter> result = std::make_shared<JsonWriter>();
134 return (result->init(file) ? result :
nullptr);
151 static std::shared_ptr<JsonWriter>
alloc(
const std::string& file,
unsigned int capacity) {
152 std::shared_ptr<JsonWriter> result = std::make_shared<JsonWriter>();
153 return (result->init(file,capacity) ? result :
nullptr);
170 static std::shared_ptr<JsonWriter>
alloc(
const char* file,
unsigned int capacity) {
171 std::shared_ptr<JsonWriter> result = std::make_shared<JsonWriter>();
172 return (result->init(file,capacity) ? result :
nullptr);
189 static std::shared_ptr<JsonWriter>
alloc(
const Pathname& file,
unsigned int capacity) {
190 std::shared_ptr<JsonWriter> result = std::make_shared<JsonWriter>();
191 return (result->init(file,capacity) ? result :
nullptr);
196 #pragma mark Write Methods
208 void writeJson(
const std::shared_ptr<JsonValue>& json,
bool format=
true) {