Update README.md

This commit is contained in:
2025-02-02 20:54:38 +01:00
committed by GitHub
parent 04dcc77db6
commit d7bc969b70

View File

@@ -51,12 +51,12 @@ int main()
// Get a sub-section by using the dot operator // Get a sub-section by using the dot operator
result = gameSection->GetSubSection("window.platform", &windowPlatformSection); result = gameSection->GetSubSection("window.platform", &windowPlatformSection);
MiniPPFile::Values::ArrayValue* pointsValue = nullptr; MiniPPFile::Values::ArrayValue* platformTargetsValue = nullptr;
// Retrieve an array by using the relative value path (the game section is a child of the root section) // Retrieve an array by using the relative value path (the game section is a child of the root section)
result = root.GetValue("game.window.platform.targets", &pointsValue); result = root.GetValue("game.window.platform.targets", &platformTargetsValue);
// Modify the "targets" array by adding a new value // Modify the "targets" array by adding a new value
pointsValue->GetValues().push_back(std::make_unique<MiniPPFile::Values::StringValue>("haiku")); platformTargetsValue->GetValues().push_back(std::make_unique<MiniPPFile::Values::StringValue>("haiku"));
// Serialize the config // Serialize the config
result = file.Write("test_out.mini"); result = file.Write("test_out.mini");
@@ -113,11 +113,11 @@ int main()
```cpp ```cpp
// Handle arrays // Handle arrays
MiniPPFile::Values::ArrayValue* platformsValue = nullptr; MiniPPFile::Values::ArrayValue* pointsValue = nullptr;
result = root.GetValue("game.window.platform.points", &platformsValue); result = root.GetValue("game.window.platform.points", &pointsValue);
// Modify the array values (or read them) // Modify the array values (or read them)
platformsValue->GetValue().push_back(std::make_unique<MiniPPFile::Values::StringValue>("haiku")); pointsValue->GetValue().push_back(std::make_unique<MiniPPFile::Values::StringValue>("haiku"));
``` ```
5. **Write new files**: 5. **Write new files**: