All Projects → rttrorg → Rttr

rttrorg / Rttr

Licence: mit
C++ Reflection Library

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Rttr

Rawspeed
fast raw decoding library
Stars: ✭ 179 (-91.19%)
Mutual labels:  cmake, library
Reproc
A cross-platform (C99/C++11) process library
Stars: ✭ 325 (-84%)
Mutual labels:  cmake, library
Cdt
C++ library for constrained Delaunay triangulation (CDT)
Stars: ✭ 165 (-91.88%)
Mutual labels:  cmake, library
Raz
Modern & multiplatform game engine in C++17
Stars: ✭ 161 (-92.07%)
Mutual labels:  cmake, library
Hazelcast Cpp Client
Hazelcast IMDG C++ Client
Stars: ✭ 67 (-96.7%)
Mutual labels:  cmake, library
Units
A compile-time enabled Modern C++ library that provides compile-time dimensional analysis and unit/quantity manipulation.
Stars: ✭ 365 (-82.03%)
Mutual labels:  cmake, library
dataconf
Simple dataclasses configuration management for Python with hocon/json/yaml/properties/env-vars/dict support.
Stars: ✭ 40 (-98.03%)
Mutual labels:  serialization, properties
Protobuf Nim
Protobuf implementation in pure Nim that leverages the power of the macro system to not depend on any external tools
Stars: ✭ 90 (-95.57%)
Mutual labels:  serialization, library
Cxxctp
DEPRECATED. USE INSTEAD github.com/blockspacer/flextool
Stars: ✭ 58 (-97.14%)
Mutual labels:  cmake, serialization
Pbf
A low-level, lightweight protocol buffers implementation in JavaScript.
Stars: ✭ 618 (-69.57%)
Mutual labels:  serialization, library
Tristeon3d
A 3D Engine built by two Game Engineering students.
Stars: ✭ 68 (-96.65%)
Mutual labels:  cmake, serialization
Vrt
🔅 Ray tracing library for Vulkan API (indev)
Stars: ✭ 111 (-94.53%)
Mutual labels:  cmake, library
Cmake Avr
cmake toolchain for AVR
Stars: ✭ 137 (-93.25%)
Mutual labels:  cmake
Lc kicad lib
kicad production symbol and footprint library auto convert from JLC's integrate Altium Designer library
Stars: ✭ 140 (-93.11%)
Mutual labels:  library
Org Java
Org mode files Java parser
Stars: ✭ 138 (-93.21%)
Mutual labels:  library
Fluid Slider
💧 A slider widget with a popup bubble displaying the precise value selected. Swift UI library made by @Ramotion
Stars: ✭ 1,798 (-11.47%)
Mutual labels:  library
Kiwix Tools
Command line Kiwix tools: kiwix-serve, kiwix-manage, ...
Stars: ✭ 139 (-93.16%)
Mutual labels:  library
Criterion
Microbenchmarking for Modern C++
Stars: ✭ 140 (-93.11%)
Mutual labels:  library
Azos
A to Z Sky Operating System / Microservice Chassis Framework
Stars: ✭ 137 (-93.25%)
Mutual labels:  serialization
Deku
Declarative binary reading and writing: bit-level, symmetric, serialization/deserialization
Stars: ✭ 136 (-93.3%)
Mutual labels:  serialization

Version Travis status Appveyor status Coverage Status CII Best Practices Codacy Badge Documentation License Donate

!New Release - 0.9.6!

RTTR

C++ Reflection Library

RTTR stands for Run Time Type Reflection. It 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. You can find more information on: www.rttr.org


How to Use

Manual registration

#include <rttr/registration>
using namespace rttr;

struct MyStruct { MyStruct() {}; void func(double) {}; int data; };

RTTR_REGISTRATION
{
    registration::class_<MyStruct>("MyStruct")
         .constructor<>()
         .property("data", &MyStruct::data)
         .method("func", &MyStruct::func);
}

Iterate over members

type t = type::get<MyStruct>();
for (auto& prop : t.get_properties())
    std::cout << "name: " << prop.get_name();

for (auto& meth : t.get_methods())
    std::cout << "name: " << meth.get_name();

Constructing types

type t = type::get_by_name("MyStruct");
variant var = t.create();    // will invoke the previously registered ctor

constructor ctor = t.get_constructor();  // 2nd way with the constructor class
var = ctor.invoke();
std::cout << var.get_type().get_name(); // prints 'MyStruct'

Set/get properties

MyStruct obj;

property prop = type::get(obj).get_property("data");
prop.set_value(obj, 23);

variant var_prop = prop.get_value(obj);
std::cout << var_prop.to_int(); // prints '23'

Invoke Methods:

MyStruct obj;

method meth = type::get(obj).get_method("func");
meth.invoke(obj, 42.0);

variant var = type::get(obj).create();
meth.invoke(var, 42.0);

Features

  • reflect constructors, methods, data member or enums
  • classes; with single-, multiple- and virtual-inheritance
  • constructors (arbitrary argument count)
  • methods (virtual, abstract, overloaded, arbitrary argument count)
  • arrays (incl. raw-arrays; arbitrary dimension count)
  • ability to invoke properties and methods of classes from any arbitrary class level
  • no header pollution; the reflection information is created in the cpp file to minimize compile time when modifying the data
  • working with custom types without the need of having the declaration of the type available at compile time (useful for plugins)
  • possibility to add additional metadata to all reflection objects
  • possibility to add default arguments to methods or constructors
  • adjust registration behaviour through policies
  • minimal macro usage
  • no additional 3rd party dependencies are needed
  • no rtti required; contains a faster and across shared libraries working replacement
  • no exceptions (this feature come with cost and is also regularly disabled on consoles)
  • no external compiler or tool needed, only standard ISO C++11

Portability

Tested and compiled with:

  • Microsoft Visual Studio 2015 & 2017 (2013 support till version 0.9.6)
  • GCC 4.8.1
  • Clang 3.7
  • MinGW 4.8.2

License

RTTR is released under the terms of the MIT license, so it is free to use in your free or commercial projects.

Copyright (c) 2014 - 2018 Axel Menzel [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Installation

The installation guide can be found here.

Get Started:

Take a look at the documentation or start with the tutorial.

Donation:

When you use RTTR and you would like to say thank you for its development, I am happy to receive any donation.

paypal

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].