Welcome to the C++ Reflection Library! This library provides a powerful and flexible way to add reflection capabilities to your C++ classes. With this library, you can easily introspect classes, their attributes, and methods at runtime. 🚀
- Reflect on class attributes and methods.
- Generate human-readable class information.
- Easily extendable and customizable.
- Minimal overhead and easy integration.
- Clone the repository:
git clone https://github.com/Dheovani/ReflectionSystem.git
- Include the header files in your project:
#include "reflection_system.h"
Here's a quick example to get you started:
#include <iostream>
#include "reflection.h"
class Base {};
struct BaseStruct {};
class Derived : public Base, public BaseStruct
{
std::string str = "string";
static const long long fl = 5;
void func1() { std::cout << "func1" << std::endl; }
int func2() { return 0; }
public:
Derived() = default;
Derived(const std::string& s) : str(s)
{}
static void StaticMethod(void) { std::cout << "In the static method" << std::endl; }
void SetStr(const std::string& s) { this->str = s; }
UseReflectionTrait
(
Derived,
Attributes(str, fl),
Methods(func1, func2, StaticMethod, SetStr),
Parents(Base, BaseStruct)
)
};
int main(void)
{
auto derived = Derived::GetInstance();
std::cout << Derived::Classname() << std::endl;
std::cout << Derived::Size() << std::endl;
return 0;
}
Here are some tasks and improvements planned for the C++ Introspection System:
- 🛠️ Add Support for Parent Classes: Implement introspection for parents, allowing dynamic data gathering.
- 📚 Documentation: Expand the documentation with detailed usage examples and best practices.
- 🧪 Testing: Increase unit test coverage to ensure the robustness and reliability of the system.
- 🌐 Multi-format Serialization Support: Implement support for additional serialization formats, such as JSON.
- 🔒 Access Modifiers: Find a way to verify if methods are either private, protected or public.
Feel free to contribute to any of these tasks or suggest new features and improvements!
Contributions are welcome! Please feel free to submit a pull request or open an issue.
This project is licensed under the MIT License - see the LICENSE file for details.
Special thanks to the following projects for their inspiration and contributions to the C++ community:
Happy Coding! 😊