{"id":15634197,"url":"https://github.com/qix-/tortellini","last_synced_at":"2026-03-04T11:32:16.323Z","repository":{"id":44667107,"uuid":"245334600","full_name":"Qix-/tortellini","owner":"Qix-","description":"A really stupid INI file format for C++11","archived":false,"fork":false,"pushed_at":"2023-09-25T15:24:27.000Z","size":647,"stargazers_count":145,"open_issues_count":1,"forks_count":11,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-29T04:41:27.935Z","etag":null,"topics":["cpp","cpp11","header-only","ini","ini-config","ini-emitter","ini-file","ini-files","ini-generator","ini-parser","ini-reader","ini-settings-file","ini-writer","maybe-pesto","no-dependencies","pasta","tortellini","with-filling","zero-dependencies","zero-dependency"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Qix-.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":"qix-"}},"created_at":"2020-03-06T05:06:16.000Z","updated_at":"2025-06-19T20:44:46.000Z","dependencies_parsed_at":"2024-04-23T13:43:27.237Z","dependency_job_id":null,"html_url":"https://github.com/Qix-/tortellini","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Qix-/tortellini","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qix-%2Ftortellini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qix-%2Ftortellini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qix-%2Ftortellini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qix-%2Ftortellini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Qix-","download_url":"https://codeload.github.com/Qix-/tortellini/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qix-%2Ftortellini/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30078992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T08:01:56.766Z","status":"ssl_error","status_checked_at":"2026-03-04T08:00:42.919Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cpp","cpp11","header-only","ini","ini-config","ini-emitter","ini-file","ini-files","ini-generator","ini-parser","ini-reader","ini-settings-file","ini-writer","maybe-pesto","no-dependencies","pasta","tortellini","with-filling","zero-dependencies","zero-dependency"],"created_at":"2024-10-03T10:52:19.592Z","updated_at":"2026-03-04T11:32:16.275Z","avatar_url":"https://github.com/Qix-.png","language":"C++","funding_links":["https://github.com/sponsors/qix-"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n\t\u003cimg height=\"250\" src=\"logo.png\" alt=\"Tortellini\"\u003e\n\u003c/h1\u003e\n\nThe stupid - _and I mean really, really stupid_ - INI file reader and writer for C++11 and above. Calorie free (no dependencies)!\n\n```c++\n#include \u003ctortellini.hh\u003e\n\n// (optional)\n#include \u003cfstream\u003e\n\nint main() {\n\ttortellini::ini ini;\n\n\t// (optional) Read INI in from a file.\n\t// Default construction and subsequent assignment is just fine, too.\n\tstd::ifstream in(\"config.ini\");\n\tin \u003e\u003e ini;\n\n\t// Retrieval\n\t//\n\t// All value retrievals must be done via the \"default\" operator\n\t// (the pipe operator).\n\t//\n\t// The right-hand-side type is what is returned. Anything other\n\t// than a string-like type causes a parse (see caveats section below).\n\t//\n\t// All keys are case-INsensitive. This includes section headers.\n\tstd::string s          = ini[\"Section\"][\"key\"] | \"default string\";\n\tint i                  = ini[\"Section\"][\"key\"] | 42;    // default int\n\tlong l                 = ini[\"Section\"][\"key\"] | 42L;   // default long\n\tlong long ll           = ini[\"Section\"][\"key\"] | 42LL;  // default long long\n\tunsigned int u         = ini[\"Section\"][\"key\"] | 42u;   // default unsigned int\n\tunsigned long ul       = ini[\"Section\"][\"key\"] | 42UL;  // default unsigned long\n\tunsigned long long ull = ini[\"Section\"][\"key\"] | 42ULL; // default unsigned long long\n\tfloat f                = ini[\"Section\"][\"key\"] | 42.0f; // default float\n\tdouble d               = ini[\"Section\"][\"key\"] | 42.0;  // default double\n\tlong double ld         = ini[\"Section\"][\"key\"] | 42.0L; // default long double\n\tbool b                 = ini[\"Section\"][\"key\"] | true;  // default bool\n\n\t// Assignment\n\t//\n\t// (This example uses the same key, but of course\n\t// in reality this would just be overwriting the\n\t// same key over and over again - probably not\n\t// what you'd really want. I would hope I wouldn't\n\t// have to explain this, but you never know.)\n\tini[\"New Section\"][\"new-key\"] = \"Noodles are tasty.\";\n\tini[\"New Section\"][\"new-key\"] = 1234;\n\tini[\"New Section\"][\"new-key\"] = 1234u;\n\tini[\"New Section\"][\"new-key\"] = 1234L;\n\tini[\"New Section\"][\"new-key\"] = 1234UL;\n\tini[\"New Section\"][\"new-key\"] = 1234LL;\n\tini[\"New Section\"][\"new-key\"] = 1234ULL;\n\tini[\"New Section\"][\"new-key\"] = 1234.0f;\n\tini[\"New Section\"][\"new-key\"] = 1234.0;\n\tini[\"New Section\"][\"new-key\"] = 1234.0L;\n\tini[\"New Section\"][\"new-key\"] = true;\n\n\t// \"Naked\" section (top-most key/value pairs, before a section header)\n\t// denoted by empty string in section selector\n\tini[\"\"][\"naked-key\"] = \"I'll be at the very top, without a section\";\n\n\t// You can also iterate over all sections\n\tfor (auto \u0026pair : ini) {\n\t\tstd::cout \u003c\u003c pair.name \u003c\u003c \"\\n\"; // the name of the section\n\t\tint v = pair.section[\"some-key\"] | 1234;\n\t\tstd::cout \u003c\u003c \"some-key=\" \u003c\u003c v \u003c\u003c \"\\n\";\n\t}\n\n\t// (optional) Write INI to file.\n\tstd::ofstream out(\"config.ini\");\n\tout \u003c\u003c ini;\n}\n```\n\n# Things you should know.\n\nThis library has very few bells and whistles. It doesn't do anything fancy.\n\nHere are the guarantees/features:\n\n- Case-insensitive keys and section headers. Reading from a key/section with different cases will work fine, and writing to an existing section/key will preserve the casing.\n- Untouched output (from using `stream \u003c\u003c ini`) is guaranteed to be parsable (by using `stream \u003e\u003e ini`).\n- Barring I/O issues or exceptions coming from the standard library, Tortellini will not throw or abort (see below section about \"invalid data\").\n- _Pasta in, pasta out._ Source strings (from a parse) are preserved to the output. If you use `yes` instead of `true`, Tortellini will preserve that (unless the application overwrites the value).\n- `yes`, `1` and `true` are all parsable as `bool(true)`. All other values equate to `false`. **NOTE:** This means that `ini[\"\"][\"b\"] | true` will return `false`, _not_ `true`, if the key exists but is not a valid, parsable truth-ey value. This may be counter-intuitive for some users.\n- All values are inherently string, and only parsed when retrieved.\n\nHere are the caveats:\n\n- **Do not store or share anything returned from the subscript operators (`[]`).** They return temporary objects that are meant for short-lived interactions. They are NOT lifetime safe and expect the underlying `tortellini::ini` instance to subsist beyond their own lifetimes.\n- Invalid keys, values or section names skip the line entirely. This condition is henceforth referred to as \"invalid data\".\n- Integer overflows when parsing are invalid data.\n- Mismatched `]` for a `[` line is invalid data. Yes, keys _will_ bleed into the preceding section name. That's user error, not your application's. _Embrace it._\n- Empty keys or empty values (excluding leading/trailing whitespace!) are \"invalid data\" in that they might be valid but not included in the resulting data and thus _won't_ be re-emitted.\n- Empty sections (or sections with 100% invalid data as key/value pairs) are themselves invalid data and are not emitted.\n- `[]` is a valid section name. It means the \"naked\" section. Re-emitting the INI will move those keys to the top regardless of where `[]` is positioned in the input file.\n- No comments are supported; `;` is a valid (string) character.\n- No caching or memoization; if you retrieve anything but a `std::string`, there _will_ be a parse. I never said Tortellini was hyper-over-optimized.\n\n# Testing\nYou can test by running:\n\n```bash\nmkdir build \u0026\u0026 cd build\ncmake .. -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug\ncmake --build .\nctest\n```\n\n# License\n\nYou have two choices in license. Pick whichever one you want.\nTortellini is uncucumbered. Go crazy. Eat some pasta.\n\n### Unlicense\n\n```\nThis is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to \u003chttp://unlicense.org/\u003e\n```\n\n### MIT License\n\n```\nCopyright (c) 2020 Josh Junon\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqix-%2Ftortellini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqix-%2Ftortellini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqix-%2Ftortellini/lists"}