{"id":18919048,"url":"https://github.com/mohido/tiny_yaml","last_synced_at":"2025-04-15T10:33:18.386Z","repository":{"id":129107817,"uuid":"522281693","full_name":"Mohido/Tiny_Yaml","owner":"Mohido","description":"A powerful lightweight YAML parser library for C++","archived":false,"fork":false,"pushed_at":"2025-02-25T00:09:43.000Z","size":26,"stargazers_count":7,"open_issues_count":5,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T20:11:18.308Z","etag":null,"topics":["cpp","library","parser","yaml"],"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/Mohido.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":"2022-08-07T17:39:02.000Z","updated_at":"2025-02-22T11:12:52.000Z","dependencies_parsed_at":"2025-02-15T18:25:28.954Z","dependency_job_id":null,"html_url":"https://github.com/Mohido/Tiny_Yaml","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mohido%2FTiny_Yaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mohido%2FTiny_Yaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mohido%2FTiny_Yaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mohido%2FTiny_Yaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mohido","download_url":"https://codeload.github.com/Mohido/Tiny_Yaml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249051923,"owners_count":21204918,"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","library","parser","yaml"],"created_at":"2024-11-08T10:34:47.052Z","updated_at":"2025-04-15T10:33:18.380Z","avatar_url":"https://github.com/Mohido.png","language":"C++","readme":"# Tiny_Yaml\nA powerful simple lightweight YAML parser library for C++. There are lots of libraries which parse yaml files in C++, yet they are cumbersome and very heavy to include \nin a performance-matter project, thus increasing the need for a minimal robust parser. This library is useful when you already know that the yaml file will NOT be changing Also, keep in mind that all values are returned as strings:\n\n```\n# example:\n123 is represented as std::string(\"123\") in C++\n\ntrue is std::string(\"true\")\n\n\"true\" is std::string(\"\\\"true\\\"\")\n```\n\n\u003e This behavior will change in the future and support a better type-parsing (during yaml loadtime and not during application execution time). But for now, you should know parse the values to the type you need. \n\n### Features:\n1. Very easy to integrate to your project:\n    1. Copy the `yaml/` directory to your project.\n    2. Include the `yaml.hpp` file in your source code.\n    3. Add the `yaml.cpp` to the compiler and linker.\n\n2. Robust and Recovery:\n    * Simple indentation errors are recoverable. The parser will try its best to find the best suit for the yaml layout even if there are unconsistant indentations.\n    * Abilty to parse list-elements and list-nodes. These happen when a parent node either has a list of nodes or elements attached to it. \n    \n3. Simple to Use:\n    * Retreiving values of nodes or lists are quite simple and intuitive. Note, the syntax is shown below.\n\n---\n\n### How to Use:\nThe content below represents a yaml file, then a set of examples on how to extract the data:\n\n\u003e `example.yaml`\n```\n object:\t\t\t\t\t\n   name: \"mohido\"\t\t\t\n   property: \"cool as hell\"\n \t\t\t\t\t\t\t\n version: 123\t\t\t\t\n academy: \"333\"\t\t\t\n \t\t\t\t\t\t\t\n list:\t\t\t\t\t\t\n   - item1\t\t\t\t\t\n   - item2\t\t\t\t\t\n   - item3\t\t\t\t\t\n \t\t\t\t\t\t\t\n node_list: \t\t\t\t\n   - name : \"node1\"\t\t\n     value: 1\t\t\t\t\n     hell:\t\t\t\t\t\n       - item1: \"sang\"\t\t\n       - item1: \"mang\"\t\t\n   - name : \"node2\"\t\t\n     value: 2\t\t\t\t\n     temp: extra\t\t\t\n     extra:\t\t\t\t\n       - extra1\t\t\t\n       - extra2\t\t\t\n       - extra3\t\t\t\n```\n\nFirst of all, create a yaml parser object:\n  ```\n  TINY_YAML::Yaml coolYamlObject(\u003cyaml_file_path\u003e);\n  ```\n  \n -\tvalue `\"mohido\"` of `object.name` can be accessed as follows:\n      ```\n      coolYamlObject[\"object\"][\"name\"].getData\u003cstd::string\u003e();\n      ```\n\n - value `123` of `version` can be accessed as follows:\n      ```\n      coolYamlObject[\"version\"].getData\u003cstd::string\u003e();\n      ```\n\n - value `item1` of `list[0]` can be accessed as follows:\n      ```\n      coolYamlObject[\"list\"].getData\u003cstd::vector\u003cstd::string\u003e\u003e()[0];\n      ```\n\n - value `\"node1\"` of `node_list[0].name` can be accessed as follows:\n      ```\n      coolYamlObject[\"node_list\"][\"0\"][\"name\"].getData\u003cstd::string\u003e();\n      ```\n\n - value `extra3` of `node_list[1].extra[2]` can be accessed as follows:\n      ```\n      coolYamlObject[\"node_list\"][\"1\"][\"extra\"].getData\u003cstd::vector\u003cstd::string\u003e\u003e()[2];\n      ```\n      \n---\n\n# Notes:\n    - Contributions are welcome!\n    - Bugs/Suggestions/Reports can be created as issues on Github with the desired label.\n    - This library is still in development (which means it does not fully support all yaml features yet).\n    - I am trying to add new features and fix bugs for features I use. If I don't use a feature, it won't be added soon. Therefore, if you need a feature, feel free to create an issue or a PR. Just make sure to follow the contribution guide.\n\n# Issues:\nI plan to add more features in the future, but I am not sure when I will get to it. If you need a feature, feel free to create an issue or a PR (ofc PR is better). Just make sure to follow the contribution guide.\n\n  - There must be no space between the key and the colon (`:`). (e.g `key : value` is invalid)\n  - Does not support all yaml specifications\n  - Does not support multi-line strings\n  - Does not support multiple yaml documents in a single file (`---`, `...` can cause bugs)\n  - Does not write yaml files (it only reads them)\n  - Does not support `%` specification (e.g. `%YAML 1.2`)\n  - All values must be gotten as strings (by using `getData\u003cstring\u003e()`) (even numbers and booleans must be gotten as strings and then casted dynamically)\n    - e.g: `variable: \"\"` in yaml will return `\"\\\"\\\"\"` value in C++\n  - Does not support inline lists (e.g. `[1, 2, 3]`). Does not support inline lists with quotes (e.g. `[\"a\", \"b\", \"c\"]`).\n  - Does not support inline objects (e.g. `{a: 1, b: 2, c: 3}`). \n  - Getting data from lists is a very annoying syntax. `getData\u003cstd::vector\u003cstd::string\u003e\u003e()`. (This will be changed when implementing type-parsing).\n  - Can't get the number of object-items in the current node. \n  ```\n  # Getting number of children in \"object\" doesn't work.\n  object: \n    - name: 1\n    - name: 2\n  ```\n\n# Development Setup\n\n### VSCode\n\n\u003e NOTE: Only windows configuration is given in the `.vscode` directory. \n1. Install the C/C++ extension\n2. Install CLANG compiler\n3. Set the compiler path to `clang++` in `.vscode/c_cpp_properties.json` (incase you installed clang in a different path)\n4. Go to the `Run and Debug` tab in the left side bar and click the `Run` button. This will run the `tests/main.cpp` (testing the package).\n\n\n# Conttribution Guide\n\n\n\n# License\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. Meaning, you can do whatever you want with this code.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohido%2Ftiny_yaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohido%2Ftiny_yaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohido%2Ftiny_yaml/lists"}