45 #ifndef __CU_JSON_LOADER_H__
46 #define __CU_JSON_LOADER_H__
47 #include <cugl/assets/CULoader.h>
48 #include <cugl/assets/CUJsonValue.h>
82 void materialize(
const std::string& key,
const std::shared_ptr<JsonValue>& json,
83 LoaderCallback callback);
102 virtual bool read(
const std::string& key,
const std::string& source,
103 LoaderCallback callback,
bool async)
override;
125 virtual bool read(
const std::shared_ptr<JsonValue>& json,
126 LoaderCallback callback,
bool async)
override;
130 #pragma mark Constructors
165 static std::shared_ptr<JsonLoader>
alloc() {
166 std::shared_ptr<JsonLoader> result = std::make_shared<JsonLoader>();
167 return (result->init() ? result :
nullptr);
183 static std::shared_ptr<JsonLoader>
alloc(
const std::shared_ptr<ThreadPool>& threads) {
184 std::shared_ptr<JsonLoader> result = std::make_shared<JsonLoader>();
185 return (result->init(threads) ? result :
nullptr);
void materialize(const std::string &key, const std::shared_ptr< JsonValue > &json, LoaderCallback callback)
std::shared_ptr< ThreadPool > _loader
Definition: CULoader.h:105
static std::shared_ptr< JsonLoader > alloc(const std::shared_ptr< ThreadPool > &threads)
Definition: CUJsonLoader.h:183
JsonLoader()
Definition: CUJsonLoader.h:137
virtual bool read(const std::string &key, const std::string &source, LoaderCallback callback, bool async) override
Definition: CUJsonLoader.h:63
std::unordered_map< std::string, std::shared_ptr< JsonValue > > _assets
Definition: CULoader.h:736
static std::shared_ptr< JsonLoader > alloc()
Definition: CUJsonLoader.h:165
Definition: CULoader.h:733
void dispose() override
Definition: CUJsonLoader.h:149
Definition: CUAction.h:51