{"id":13494755,"url":"https://github.com/mcmtroffaes/inipp","last_synced_at":"2025-04-12T21:26:39.768Z","repository":{"id":39617609,"uuid":"90781361","full_name":"mcmtroffaes/inipp","owner":"mcmtroffaes","description":"Simple C++ ini parser.","archived":false,"fork":false,"pushed_at":"2024-09-24T09:45:13.000Z","size":103,"stargazers_count":290,"open_issues_count":2,"forks_count":57,"subscribers_count":11,"default_branch":"develop","last_synced_at":"2025-04-05T12:01:42.226Z","etag":null,"topics":["configparser","cpp","header-only","ini","parser","parsing","python-configparser","simple"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcmtroffaes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-09T18:54:58.000Z","updated_at":"2025-03-27T02:15:12.000Z","dependencies_parsed_at":"2024-01-31T09:03:11.178Z","dependency_job_id":"fd2438f3-a049-4c7f-9732-430367190b53","html_url":"https://github.com/mcmtroffaes/inipp","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmtroffaes%2Finipp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmtroffaes%2Finipp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmtroffaes%2Finipp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmtroffaes%2Finipp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcmtroffaes","download_url":"https://codeload.github.com/mcmtroffaes/inipp/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248633544,"owners_count":21136886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configparser","cpp","header-only","ini","parser","parsing","python-configparser","simple"],"created_at":"2024-07-31T19:01:27.799Z","updated_at":"2025-04-12T21:26:39.741Z","avatar_url":"https://github.com/mcmtroffaes.png","language":"C++","readme":"# IniPP\n\nSimple header-only C++ ini parser and generator.\n\n[![Build Status](https://github.com/mcmtroffaes/inipp/actions/workflows/build.yml/badge.svg)](https://github.com/mcmtroffaes/inipp/actions/workflows/build.yml)\n\n## Features\n\n* Header-only.\n* Both parsing and generating.\n* Wide character support for native unicode on Windows.\n* Default section support (similar to Python's ConfigParser).\n* Interpolation support (i.e. variable substitution, similar to Python's ConfigParser).\n* Trailing comments support.\n* Simple design and implementation.\n* Permissive MIT license.\n\n## Example\n\n```cpp\n#include \u003cfstream\u003e\n#include \"inipp.h\"\n\nint main() {\n\tinipp::Ini\u003cchar\u003e ini;\n\tstd::ifstream is(\"example.ini\");\n\tini.parse(is);\n\tstd::cout \u003c\u003c \"raw ini file:\" \u003c\u003c std::endl;\n\tini.generate(std::cout);\n\tini.strip_trailing_comments();\n\tini.default_section(ini.sections[\"DEFAULT\"]);\n\tini.interpolate();\n\tstd::cout \u003c\u003c \"ini file after default section and interpolation:\" \u003c\u003c std::endl;\n\tini.generate(std::cout);\n\tint compression_level = -1;\n\tinipp::get_value(ini.sections[\"bitbucket.org\"], \"CompressionLevel\", compression_level);\n\tstd::cout \u003c\u003c \"bitbucket.org compression level: \" \u003c\u003c compression_level \u003c\u003c std::endl;\n\treturn 0;\n}\n```\n\nTo include in a cmake project:\n\n```\nFetchContent_Declare(inipp GIT_REPOSITORY https://github.com/mcmtroffaes/inipp.git)\nFetchContent_MakeAvailable(inipp)\ntarget_link_libraries(MyTarget PRIVATE inipp::inipp)\n```\n\n## Parsing algorithm\n\n* The *section* is set to the empty string.\n\n* Every *line* is read from the file and trimmed from whitespace.\n\n    * If *line* is empty or starts with ``;`` then nothing happens.\n\n    * Otherwise, if *line* starts with ``[`` then *section* is changed\n      to the string between ``[`` and ``]``. If *line* does not end\n      with ``]`` then an error is reported.\n\n    * Otherwise, if *line* contains an ``=`` sign, then all characters\n      before ``=`` are treated as *variable* and all characters\n      following ``=`` are treated as *value*. Both are trimmed. If the\n      variable was already assigned earlier, an error is\n      reported. Otherwise, the corresponding assigment is added to the\n      *section*.\n\n    * Otherwise, the *line* is reported as an error.\n\n## Default section algorithm\n\nInsert every variable from the default section into every other section, without overwriting existing variables.\n\n## Interpolation algorithm\n\n1. Locally within each section, every occurrence \"${variable}\" is replaced by \"${section:variable}\".\n2. Every occurrence of \"${section:variable}\" is replaced by its value.\n3. The previous step is repeated until no more replacements are possible, or until the recursion depth (by default, 10) is reached.\n\n","funding_links":[],"categories":["Configuration","C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcmtroffaes%2Finipp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcmtroffaes%2Finipp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcmtroffaes%2Finipp/lists"}