{"id":13418501,"url":"https://github.com/rttrorg/rttr","last_synced_at":"2025-04-13T13:24:27.312Z","repository":{"id":38374992,"uuid":"48062533","full_name":"rttrorg/rttr","owner":"rttrorg","description":"C++ Reflection Library","archived":false,"fork":false,"pushed_at":"2024-04-25T13:07:08.000Z","size":6648,"stargazers_count":3280,"open_issues_count":145,"forks_count":451,"subscribers_count":91,"default_branch":"master","last_synced_at":"2025-04-06T10:08:00.469Z","etag":null,"topics":["c-plus-plus","cmake","cplusplus-11","introspection","library","properties","reflection","serialization"],"latest_commit_sha":null,"homepage":"https://www.rttr.org","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/rttrorg.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","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":"2015-12-15T18:52:32.000Z","updated_at":"2025-04-03T14:19:39.000Z","dependencies_parsed_at":"2024-05-02T00:53:21.728Z","dependency_job_id":"555263ba-95af-42c3-a350-abc9186fa50b","html_url":"https://github.com/rttrorg/rttr","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rttrorg%2Frttr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rttrorg%2Frttr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rttrorg%2Frttr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rttrorg%2Frttr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rttrorg","download_url":"https://codeload.github.com/rttrorg/rttr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248718883,"owners_count":21150652,"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":["c-plus-plus","cmake","cplusplus-11","introspection","library","properties","reflection","serialization"],"created_at":"2024-07-30T22:01:03.020Z","updated_at":"2025-04-13T13:24:27.267Z","avatar_url":"https://github.com/rttrorg.png","language":"C++","readme":"[![Version](https://badge.fury.io/gh/rttrorg%2Frttr.svg)](https://github.com/rttrorg/rttr/releases/latest)\n[![Travis status](https://travis-ci.org/rttrorg/rttr.svg?branch=master)](https://travis-ci.org/rttrorg/rttr)\n[![Appveyor status](https://ci.appveyor.com/api/projects/status/github/rttrorg/rttr?svg=true\u0026branch=master)](https://ci.appveyor.com/project/acki-m/rttr)\n[![Coverage Status](https://coveralls.io/repos/rttrorg/rttr/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/rttrorg/rttr)\n[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/783/badge)](https://bestpractices.coreinfrastructure.org/projects/783)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/9821799170644782ac8d7885d393e686)](https://www.codacy.com/app/acki-m/rttr?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=rttrorg/rttr\u0026amp;utm_campaign=Badge_Grade)\n[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](http://www.rttr.org/doc/master/classes.html)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/rttrorg/rttr/master/LICENSE.txt)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=JQ65KGGCSUZMS)\n\n\u003ca target=\"_blank\" href=\"http://www.rttr.org/news/major-release-0-9-6\"\u003e!New Release - 0.9.6!\u003c/a\u003e\n==\n\nRTTR\n====\n\u003e C++ Reflection Library\n\nRTTR stands for Run Time Type Reflection.\nIt describes the ability of a computer program to introspect and modify an object at runtime. It is also the name of the library itself, which is written in C++ and released as open source library.\nYou can find more information on: \u003ca target=\"_blank\" href=\"http://www.rttr.org\"\u003ewww.rttr.org\u003c/a\u003e\n\n----------\n\nHow to Use\n----------\n\n### Manual registration\n```cpp\n#include \u003crttr/registration\u003e\nusing namespace rttr;\n\nstruct MyStruct { MyStruct() {}; void func(double) {}; int data; };\n\nRTTR_REGISTRATION\n{\n    registration::class_\u003cMyStruct\u003e(\"MyStruct\")\n         .constructor\u003c\u003e()\n         .property(\"data\", \u0026MyStruct::data)\n         .method(\"func\", \u0026MyStruct::func);\n}\n```\n### Iterate over members\n```cpp\ntype t = type::get\u003cMyStruct\u003e();\nfor (auto\u0026 prop : t.get_properties())\n    std::cout \u003c\u003c \"name: \" \u003c\u003c prop.get_name();\n\nfor (auto\u0026 meth : t.get_methods())\n    std::cout \u003c\u003c \"name: \" \u003c\u003c meth.get_name();\n```\n\n### Constructing types\n```cpp\ntype t = type::get_by_name(\"MyStruct\");\nvariant var = t.create();    // will invoke the previously registered ctor\n\nconstructor ctor = t.get_constructor();  // 2nd way with the constructor class\nvar = ctor.invoke();\nstd::cout \u003c\u003c var.get_type().get_name(); // prints 'MyStruct'\n```\n\n### Set/get properties\n```cpp\nMyStruct obj;\n\nproperty prop = type::get(obj).get_property(\"data\");\nprop.set_value(obj, 23);\n\nvariant var_prop = prop.get_value(obj);\nstd::cout \u003c\u003c var_prop.to_int(); // prints '23'\n```\n\n### Invoke Methods:\n```cpp\nMyStruct obj;\n\nmethod meth = type::get(obj).get_method(\"func\");\nmeth.invoke(obj, 42.0);\n\nvariant var = type::get(obj).create();\nmeth.invoke(var, 42.0);\n```\n\nFeatures\n---------\n- reflect constructors, methods, data member or enums\n- classes; with *single*-, *multiple*- and *virtual*-inheritance\n- constructors (arbitrary argument count)\n- methods (*virtual*, *abstract*, *overloaded*, arbitrary argument count)\n- arrays (incl. raw-arrays; arbitrary dimension count)\n- ability to invoke properties and methods of classes from any arbitrary class level\n- no header pollution; the reflection information is created in the cpp file to minimize compile time when modifying the data\n- working with custom types without the need of having the declaration of the type available at compile time (useful for plugins)\n- possibility to add additional *metadata* to all reflection objects\n- possibility to add *default arguments* to methods or constructors\n- adjust registration behaviour through *policies*\n- minimal macro usage\n- **no** additional 3rd party dependencies are needed\n- **no** rtti required; contains a faster and across shared libraries working replacement\n- **no** exceptions (this feature come with cost and is also regularly disabled on consoles)\n- **no** external compiler or tool needed, only standard ISO C++11\n\nPortability\n-----------\nTested and compiled with:\n- Microsoft Visual Studio 2015 \u0026 2017 (2013 support till version 0.9.6)\n- GCC 4.8.1\n- Clang 3.7\n- MinGW 4.8.2\n\nLicense\n-------\n\n\u003cimg align=\"right\" src=\"http://opensource.org/trademarks/opensource/OSI-Approved-License-100x137.png\"\u003e\n\nRTTR is released under the terms of the [MIT](LICENSE.txt) license,\nso it is free to use in your free or commercial projects.\n\nCopyright (c) 2014 - 2018 Axel Menzel \u003cinfo@rttr.org\u003e\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\nInstallation\n------------\nThe installation guide can be found [here][rttr.install].\n\n\nGet Started:\n------------\nTake a look at the [documentation][rttr.docs] or start with the [tutorial][rttr.tutorial].\n\nDonation:\n---------\nWhen you use RTTR and you would like to say thank you for its development,\nI am happy to receive any donation.\n\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=JQ65KGGCSUZMS)\n\n\u003c!-- Links --\u003e\n[rttr.docs]: http://www.rttr.org/doc/master/classes.html\n[rttr.install]: http://www.rttr.org/doc/master/building_install_page.html\n[rttr.tutorial]: http://www.rttr.org/doc/master/tutorial_page.html\n","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=JQ65KGGCSUZMS"],"categories":["TODO scan for Android support in followings","Reflection","C++","映射","Libraries"],"sub_categories":["物理学","C++"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frttrorg%2Frttr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frttrorg%2Frttr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frttrorg%2Frttr/lists"}