60 lines
1.4 KiB
Markdown
60 lines
1.4 KiB
Markdown
# iKvxx
|
|
|
|
Modern C++17 bindings for [iKv](https://dock-it.dev/iDENTITY-Technology/iKv), with RAII ownership and a JsonCpp-style `Value` API.
|
|
|
|
For installation, the complete API reference, format details, binary layout, testing, and more examples, see the **[iKvxx Wiki](https://dock-it.dev/iDENTITY-Technology/iKvxx/wiki)**.
|
|
|
|
## Simple syntax
|
|
|
|
```ikv
|
|
ikv2 "player_save"
|
|
{
|
|
"title" "iKvxx demo"
|
|
"version" 2
|
|
"player" {
|
|
"name" "Ada"
|
|
"alive" true
|
|
"speed" 12.5
|
|
}
|
|
"inventory" [
|
|
"wrench"
|
|
"battery"
|
|
"map"
|
|
]
|
|
}
|
|
```
|
|
|
|
## Library example
|
|
|
|
```cpp
|
|
#include <ikvxx/ikvxx.hpp>
|
|
|
|
int main()
|
|
{
|
|
ikv::Value root(ikv::objectValue, "player_save");
|
|
root["title"] = "iKvxx demo";
|
|
root["version"] = 2;
|
|
|
|
auto player = root.makeObject("player");
|
|
player["name"] = "Ada";
|
|
player["alive"] = true;
|
|
player["speed"] = 12.5;
|
|
|
|
auto inventory = root.makeArray("inventory", ikv::stringValue);
|
|
inventory.append("wrench");
|
|
inventory.append("battery");
|
|
inventory.append("map");
|
|
|
|
root.write("player_save.ikv");
|
|
|
|
auto loaded = ikv::Value::load("player_save.ikv");
|
|
return loaded["player"]["alive"].asBool() ? 0 : 1;
|
|
}
|
|
```
|
|
|
|
## License
|
|
|
|
This project is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International license](./LICENSE).
|
|
|
|
The iKv submodule includes its own [license file](./third_party/iKv/LICENSE).
|