{"id":15423617,"url":"https://github.com/tido64/panini","last_synced_at":"2025-03-28T04:33:34.907Z","repository":{"id":81982603,"uuid":"176104834","full_name":"tido64/panini","owner":"tido64","description":"panini 🥪 is a dumb-as-bread INI file reader with a SAX-like interface.","archived":false,"fork":false,"pushed_at":"2021-07-03T22:10:41.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"trunk","last_synced_at":"2025-02-02T05:26:27.166Z","etag":null,"topics":["cpp","cpp17","ini","ini-parser","parser","reader","sax"],"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/tido64.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-03-17T13:26:37.000Z","updated_at":"2023-02-18T00:28:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"4e69faf0-a47e-48e3-b6d7-da308854279f","html_url":"https://github.com/tido64/panini","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"1b141fc7a0c5f4dd8806691e1be02070cbaa8479"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tido64%2Fpanini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tido64%2Fpanini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tido64%2Fpanini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tido64%2Fpanini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tido64","download_url":"https://codeload.github.com/tido64/panini/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245971927,"owners_count":20702705,"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":["cpp","cpp17","ini","ini-parser","parser","reader","sax"],"created_at":"2024-10-01T17:44:01.661Z","updated_at":"2025-03-28T04:33:34.884Z","avatar_url":"https://github.com/tido64.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# panini 🥪\n\npanini 🥪 is a dumb-as-bread [INI file](https://en.wikipedia.org/wiki/INI_file)\nreader with a SAX-like interface.\n\n## Example\n\n`config.ini`:\n\n```ini\n[core]\nResolutionWidth = 1280\nResolutionHeight = 720\nMSAA = 4\nAllowHiDPI = true\n; This is a comment.\n```\n\n`main.cpp`:\n\n```c++\n#include \u003calgorithm\u003e\n#include \u003ccstdio\u003e\n#include \u003ccstdlib\u003e\n#include \u003cmemory\u003e\n#include \u003cstring\u003e\n#include \u003cstring_view\u003e\n\n#include \u003cpanini/panini.hpp\u003e\n\nusing namespace std::literals::string_view_literals;\n\nauto main(int argc, char* argv[]) -\u003e int\n{\n  auto f = fopen(\"config.ini\", \"rb\");\n  fseek(f, 0, SEEK_END);\n\n  const auto size = ftell(f);\n  auto config = std::make_unique\u003cchar[]\u003e(size + 1);\n\n  fseek(f, 0, SEEK_SET);\n  fread(config.get(), sizeof(char), size, f);\n  config[size] = '\\0';\n  fclose(f);\n\n  // The callback is called for every key/value pair read.\n  panini::parse(\n    config.get(),\n    [](panini::State state,\n       std::string_view section,\n       std::string_view key,\n       std::string_view value) {\n\n      if (state == panini::State::Error) {\n        printf(\"Error parsing config.ini:%s: %s\", section.data(), key.data());\n        return;\n      }\n\n      if (section != \"core\"sv) {\n        return;\n      }\n\n      if (key == \"ResolutionWidth\"sv) {\n        printf(\"Width: %s px\", value.data());\n      } else if (key == \"ResolutionHeight\"sv) {\n        printf(\"Height: %s px\", value.data());\n      } else if (key == \"MSAA\"sv) {\n        printf(\"MSAA: %i\", std::clamp(atoi(value.data()), 0, 16));\n      } else if (key == \"AllowHiDPI\"sv) {\n        printf(\"Allow HiDPI: %s\", value.data());\n      }\n    });\n\n  return 0;\n}\n```\n\n## Features\n\n- Leading and trailing whitespaces, and blank lines are ignored\n- Sections\n- Case sensitive\n- Comment lines start with semicolons (`;`)\n\n### Not Supported\n\n- Nested sections\n- Multi-line support\n- Writing\n\n## Requirements\n\n- A C++17 compiler\n\n## License\n\nCopyright \u0026copy; 2019 Tommy Nguyen\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\nall copies 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\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftido64%2Fpanini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftido64%2Fpanini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftido64%2Fpanini/lists"}