From 3d48174f837aeaa48e0cacfe5a558946122db20e Mon Sep 17 00:00:00 2001 From: Smajic Date: Mon, 22 Jan 2024 13:11:52 +0100 Subject: [PATCH] Update README.md to include new overwriteDuplicateFields option --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index c506ba4..f5a90c7 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,21 @@ int main() } ``` +When duplicate fields are decoded the previous value is simply overwritten by default. You can disallow duplicate fields from being overwritten by using the ```allowOverwriteDuplicateFields(false)``` function. If you do this, an exception will be thrown if a duplicate field is found inside a section. + +```cpp +#include + +int main() +{ + // load an ini file + ini::IniFile myIni; + myIni.allowOverwriteDuplicateFields(false); + // throws an exception if the ini file has duplicate fields + myIni.load("some/ini/path"); +} +``` + Sections and fields can be accessed using the index operator ```[]```. The values can be converted to various native types: