![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Functions | |
| bool | LoadJsonFromFile (const std::string &filepath, json &j) |
| Load and parse a JSON file. | |
| bool | SaveJsonToFile (const std::string &filepath, const json &j, int indent=4) |
| Save a JSON object to a file with formatting. | |
| std::string | GetString (const json &j, const std::string &key, const std::string &defaultValue="") |
| Safely get a string value from JSON. | |
| int | GetInt (const json &j, const std::string &key, int defaultValue=0) |
| Safely get an integer value from JSON. | |
| uint32_t | GetUInt (const json &j, const std::string &key, uint32_t defaultValue=0) |
| Safely get an unsigned integer value from JSON. | |
| float | GetFloat (const json &j, const std::string &key, float defaultValue=0.0f) |
| Safely get a float value from JSON. | |
| double | GetDouble (const json &j, const std::string &key, double defaultValue=0.0) |
| Safely get a double value from JSON. | |
| bool | GetBool (const json &j, const std::string &key, bool defaultValue=false) |
| Safely get a boolean value from JSON. | |
| template<typename T > | |
| T | json_get (const json &j, const std::string &key, const T &defaultValue) |
| Generic template function to safely get any type from JSON. | |
| bool | IsArray (const json &j, const std::string &key) |
| Check if a key contains an array. | |
| bool | IsObject (const json &j, const std::string &key) |
| Check if a key contains an object. | |
| size_t | GetArraySize (const json &j, const std::string &key) |
| Get the size of an array. | |
| void | ForEachInArray (const json &j, const std::string &key, std::function< void(const json &, size_t)> callback) |
| Iterate over an array with a callback function. | |
| float | GetNestedFloat (const json &j, const std::string &parentKey, const std::string &childKey, float defaultValue=0.0f) |
| Get a nested float value from a parent object. | |
| std::string | GetNestedString (const json &j, const std::string &parentKey, const std::string &childKey, const std::string &defaultValue="") |
| Get a nested string value from a parent object. | |
| int | GetNestedInt (const json &j, const std::string &parentKey, const std::string &childKey, int defaultValue=0) |
| Get a nested int value from a parent object. | |
| bool | LoadConfig (const std::string &filepath, json &j) |
| Load a configuration file (alias for LoadJsonFromFile) | |
| bool | SaveConfig (const std::string &filepath, const json &j) |
| Save a configuration file (alias for SaveJsonToFile with indent=2) | |
| bool | ValidateKeys (const json &j, const std::vector< std::string > &requiredKeys) |
| Validate that all required keys exist in a JSON object. | |
| bool | ValidateKeysVerbose (const json &j, const std::vector< std::string > &requiredKeys, const std::string &context="") |
| Validate that all required keys exist and log which ones are missing. | |
|
inline |
Iterate over an array with a callback function.
| j | JSON object |
| key | Key to the array |
| callback | Function to call for each element (takes const json& and size_t index) |
Definition at line 263 of file json_helper.h.
References GetComponentTypeID_Static(), and IsArray().
Referenced by Olympe::Blueprint::EntityBlueprint::FromJson(), Graph::FromJson(), Olympe::NodeGraph::FromJson(), BehaviorTreeManager::LoadTreeFromFile(), Olympe::EnumCatalogManager::ParseCatalogJson(), and Olympe::EnumCatalogManager::ParseCatalogType().
Here is the call graph for this function:
Here is the caller graph for this function:Get the size of an array.
| j | JSON object |
| key | Key to the array |
Definition at line 250 of file json_helper.h.
References GetComponentTypeID_Static(), and IsArray().
Here is the call graph for this function:
|
inline |
Safely get a boolean value from JSON.
| j | JSON object |
| key | Key to access |
| defaultValue | Default value if key doesn't exist or type mismatch |
Definition at line 182 of file json_helper.h.
References GetComponentTypeID_Static().
Referenced by Olympe::AnimationEditorWindow::ImportBankJSON(), Olympe::BehaviorTreeDebugWindow::LoadBTConfig(), Olympe::EnumCatalogManager::ParseCatalogParameter(), OlympeAnimation::AnimationBank::ParseJSON(), and OlympeAnimation::AnimationGraph::ParseJSON().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Safely get a double value from JSON.
| j | JSON object |
| key | Key to access |
| defaultValue | Default value if key doesn't exist or type mismatch |
Definition at line 168 of file json_helper.h.
References GetComponentTypeID_Static().
Here is the call graph for this function:
|
inline |
Safely get a float value from JSON.
| j | JSON object |
| key | Key to access |
| defaultValue | Default value if key doesn't exist or type mismatch |
Definition at line 154 of file json_helper.h.
References GetComponentTypeID_Static().
Referenced by Graph::FromJson(), Olympe::NodeGraph::FromJson(), GetNestedFloat(), Olympe::AnimationEditorWindow::ImportBankJSON(), Olympe::BehaviorTreeDebugWindow::LoadBTConfig(), BehaviorTreeManager::LoadTreeFromFile(), OlympeAnimation::AnimationBank::ParseJSON(), and OlympeAnimation::AnimationGraph::ParseJSON().
Here is the call graph for this function:
Here is the caller graph for this function:Safely get an integer value from JSON.
| j | JSON object |
| key | Key to access |
| defaultValue | Default value if key doesn't exist or type mismatch |
Definition at line 120 of file json_helper.h.
References GetComponentTypeID_Static().
Referenced by Graph::FromJson(), Olympe::NodeGraph::FromJson(), GetNestedInt(), Olympe::AnimationEditorWindow::ImportBankJSON(), Olympe::BehaviorTreeDebugWindow::LoadBTConfig(), BehaviorTreeManager::LoadTreeFromFile(), OlympeAnimation::AnimationBank::ParseJSON(), and OlympeAnimation::AnimationGraph::ParseJSON().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Get a nested float value from a parent object.
| j | JSON object |
| parentKey | Key to the parent object |
| childKey | Key within the parent object |
| defaultValue | Default value if not found |
Definition at line 283 of file json_helper.h.
References GetComponentTypeID_Static(), GetFloat(), and IsObject().
Here is the call graph for this function:
|
inline |
Get a nested int value from a parent object.
| j | JSON object |
| parentKey | Key to the parent object |
| childKey | Key within the parent object |
| defaultValue | Default value if not found |
Definition at line 317 of file json_helper.h.
References GetComponentTypeID_Static(), GetInt(), and IsObject().
Here is the call graph for this function:
|
inline |
Get a nested string value from a parent object.
| j | JSON object |
| parentKey | Key to the parent object |
| childKey | Key within the parent object |
| defaultValue | Default value if not found |
Definition at line 300 of file json_helper.h.
References GetComponentTypeID_Static(), GetString(), and IsObject().
Here is the call graph for this function:
|
inline |
Safely get a string value from JSON.
| j | JSON object |
| key | Key to access |
| defaultValue | Default value if key doesn't exist or type mismatch |
Definition at line 106 of file json_helper.h.
References GetComponentTypeID_Static().
Referenced by Olympe::Blueprint::EntityBlueprint::FromJson(), Graph::FromJson(), Olympe::NodeGraph::FromJson(), GetNestedString(), Olympe::AnimationEditorWindow::ImportBankJSON(), Olympe::BehaviorTreeDebugWindow::LoadBTConfig(), BehaviorTreeManager::LoadTreeFromFile(), Olympe::BlueprintEditor::ParseAssetMetadata(), Olympe::BlueprintEditor::ParseBehaviorTree(), Olympe::EnumCatalogManager::ParseCatalogJson(), Olympe::EnumCatalogManager::ParseCatalogParameter(), Olympe::EnumCatalogManager::ParseCatalogType(), Olympe::BlueprintEditor::ParseEntityBlueprint(), Olympe::BlueprintEditor::ParseHFSM(), OlympeAnimation::AnimationBank::ParseJSON(), and OlympeAnimation::AnimationGraph::ParseJSON().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Safely get an unsigned integer value from JSON.
| j | JSON object |
| key | Key to access |
| defaultValue | Default value if key doesn't exist or type mismatch |
Definition at line 134 of file json_helper.h.
References GetComponentTypeID_Static().
Referenced by BehaviorTreeManager::LoadTreeFromFile().
Here is the call graph for this function:
Here is the caller graph for this function:Check if a key contains an array.
| j | JSON object |
| key | Key to check |
Definition at line 228 of file json_helper.h.
References GetComponentTypeID_Static().
Referenced by ForEachInArray(), Olympe::Blueprint::EntityBlueprint::FromJson(), Graph::FromJson(), Olympe::NodeGraph::FromJson(), GetArraySize(), BehaviorTreeManager::LoadTreeFromFile(), Olympe::EnumCatalogManager::ParseCatalogJson(), and Olympe::EnumCatalogManager::ParseCatalogType().
Here is the call graph for this function:
Here is the caller graph for this function:Check if a key contains an object.
| j | JSON object |
| key | Key to check |
Definition at line 239 of file json_helper.h.
References GetComponentTypeID_Static().
Referenced by GetNestedFloat(), GetNestedInt(), GetNestedString(), and Olympe::BehaviorTreeDebugWindow::LoadBTConfig().
Here is the call graph for this function:
Here is the caller graph for this function:Generic template function to safely get any type from JSON.
| T | Type to extract |
| j | JSON object |
| key | Key to access |
| defaultValue | Default value if key doesn't exist or type mismatch |
Definition at line 202 of file json_helper.h.
References GetComponentTypeID_Static().
Here is the call graph for this function:Load a configuration file (alias for LoadJsonFromFile)
| filepath | Path to the config file |
| j | Output json object |
Definition at line 336 of file json_helper.h.
References GetComponentTypeID_Static(), and LoadJsonFromFile().
Here is the call graph for this function:Load and parse a JSON file.
| filepath | Path to the JSON file |
| j | Output json object |
Definition at line 42 of file json_helper.h.
References GetComponentTypeID_Static().
Referenced by Olympe::BlueprintEditor::DetectAssetType(), Olympe::AnimationEditorWindow::ImportBankJSON(), Olympe::BlueprintEditor::IsAssetValid(), Olympe::BehaviorTreeDebugWindow::LoadBTConfig(), LoadConfig(), OlympeAnimation::AnimationBank::LoadFromFile(), OlympeAnimation::AnimationGraph::LoadFromFile(), Olympe::Blueprint::EntityBlueprint::LoadFromFile(), BehaviorTreeManager::LoadTreeFromFile(), Olympe::BlueprintEditor::MigrateAllBlueprints(), and Olympe::BlueprintEditor::ParseAssetMetadata().
Here is the call graph for this function:
Here is the caller graph for this function:Save a configuration file (alias for SaveJsonToFile with indent=2)
| filepath | Path to save the config file |
| j | JSON object to save |
Definition at line 347 of file json_helper.h.
References GetComponentTypeID_Static(), and SaveJsonToFile().
Here is the call graph for this function:
|
inline |
Save a JSON object to a file with formatting.
| filepath | Path to save the file |
| j | JSON object to save |
| indent | Number of spaces for indentation (default: 4) |
Definition at line 73 of file json_helper.h.
References GetComponentTypeID_Static().
Referenced by Olympe::AnimationEditorWindow::ExportBankJSON(), Olympe::BehaviorTreeDebugWindow::Save(), SaveConfig(), and Olympe::Blueprint::EntityBlueprint::SaveToFile().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Validate that all required keys exist in a JSON object.
| j | JSON object to validate |
| requiredKeys | Vector of required key names |
Definition at line 362 of file json_helper.h.
References GetComponentTypeID_Static().
Here is the call graph for this function:
|
inline |
Validate that all required keys exist and log which ones are missing.
| j | JSON object to validate |
| requiredKeys | Vector of required key names |
| context | Context string for error messages |
Definition at line 382 of file json_helper.h.
References GetComponentTypeID_Static().
Here is the call graph for this function: