20#include "../../third_party/nlohmann/json.hpp"
Loads and parses a JSON file on a background thread.
AsyncLoadState GetState() const
Returns the current state of the loader.
const std::string & GetLastError() const
Returns the last error message (non-empty when state == Failed).
std::future< nlohmann::json > m_Future
bool HasFailed() const
Returns true if the load failed (state == Failed).
nlohmann::json GetResult()
Returns the parsed JSON if ready; returns an empty object otherwise.
void Reset()
Resets state to Idle and clears the result / error.
void LoadAsync(const std::string &path)
Starts loading path on a background thread.
static nlohmann::json LoadFile(const std::string &path)
Opens, reads, and parses the JSON file; called on the background thread.
bool IsReady() const
Returns true if the result is available (state == Ready).
< Provides AssetID and INVALID_ASSET_ID
AsyncLoadState
Lifecycle state of an AsyncJSONLoader.
@ Loading
Background thread is running.
@ Failed
Load or parse failed — call GetLastError()
@ Idle
No load has been requested.
@ Ready
Result is available — call GetResult()