{"id":27066065,"url":"https://github.com/maxrt101/xcfg","last_synced_at":"2025-04-05T18:34:54.794Z","repository":{"id":272742503,"uuid":"822682698","full_name":"maxrt101/xcfg","owner":"maxrt101","description":"Custom configuration format parser.","archived":false,"fork":false,"pushed_at":"2025-01-16T10:07:08.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T11:43:28.132Z","etag":null,"topics":["configuration","cpp17","parser"],"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/maxrt101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2024-07-01T15:48:17.000Z","updated_at":"2025-01-16T10:07:10.000Z","dependencies_parsed_at":"2025-01-16T11:43:29.963Z","dependency_job_id":"1ae41be9-a042-49c1-9c14-7b78f16f00d2","html_url":"https://github.com/maxrt101/xcfg","commit_stats":null,"previous_names":["maxrt101/xcfg"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxrt101%2Fxcfg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxrt101%2Fxcfg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxrt101%2Fxcfg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxrt101%2Fxcfg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxrt101","download_url":"https://codeload.github.com/maxrt101/xcfg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247384988,"owners_count":20930567,"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":["configuration","cpp17","parser"],"created_at":"2025-04-05T18:34:54.686Z","updated_at":"2025-04-05T18:34:54.789Z","avatar_url":"https://github.com/maxrt101.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XCFG  \n\nCustom configuration format.  \n\n### Config format\n```\nsection {\n    field: value,\n    subsection [attribute=value] {\n        field: value\n        list: {element1, element2, element3}\n    }\n    another_subsection [attribute1, attribute2] {\n        field: \"Some string\",\n        empty_subsubsection {}\n    }\n}\n```\n\n### API\nBase type for config is `xcfg::Value`.  \nValues can store an object (key-value pair) or a string value.  \nValues can also be empty or contain an expression.   \n  \n`xcfg::Value::string()` - returns string value of a field.  \n`xcfg::Value::attrs()` - returns attributes of a section as a map of `string` and `string`.  \n`xcfg::Value::items()` - returns fields and subsections as map of `string` and `Value`.  \n`xcfg::Value::get(const std::string\u0026 path)` - returns nested value, e.g. `root.get(\"section.subsection.field\")`, which itself will return `xcfg::Value`.  \n`xcfg::Value::isString()` - returns true if value is a string.  \n`xcfg::Value::isObject()` - returns true if value is an object.  \n  \nString can be parsed into a `xcfg::Value` using `xcfg::parse(const std::string\u0026 src)`.  \nAs was mentioned above - a value can also be an expression.  \nExpressions allow users to include other files, define constants and use them later on.  \nExpressions aren't processed automatically, to process all expressions in a value `xcfg::process(Value\u0026 root, Value\u0026 value, Env\u0026 env)` is used.  \n`xcfg::Env` contains include paths and defines.  \n\nExample of expressions:  \n```\n${include another_config_file.xcfg}\n${define CONSTANT 42}\nsection {\n    subsection1 {\n        value: ${CONSTANT}\n    }\n    subsection2 {\n        ${insert section.subsection1}\n    }\n}\n```\n  \n`include` - takes 1 parameter - path to file, which will be parsed and inserted in place of include directive.  \n`define` - takes 2 parameters - name and value of a constant.  \n`insert` - takes 1 parameter - comma separated path of an element relative to root, this element will be inserted in place.  \n  \nAny other words encased in `${}` will be treated as a constant name, and will be inserted in place.\n\n\n### How to install  \n#### Prerequisites:  \n - Unix like system (WSL works too)\n - `gcc` or `clang` with `c++17` support\n - `cmake`\n\n#### To build:  \n - `cmake -S . -B build`\n - `cmake --build build`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxrt101%2Fxcfg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxrt101%2Fxcfg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxrt101%2Fxcfg/lists"}