mirror of
https://github.com/mariiaan/minipp.git
synced 2026-05-14 10:11:17 +02:00
Update README.md
This commit is contained in:
12
README.md
12
README.md
@@ -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**:
|
||||||
|
|||||||
Reference in New Issue
Block a user