Code Monkey home page Code Monkey logo

refl-ht's Introduction

refl-ht - refl-cpp Header Tool (v0.4.0-beta)

A fast, portable and non-intrusive C++ preprocessor that generates static reflection metadata for refl-cpp.

Minimum refl-cpp version required: v0.3.1

How to use:

Just annotate the desired struct/class/member with the REFL() macro and do #include REFL_METADATA_FILE at the end of the file (will be appended automatically if omitted). If the target filename is User.hpp then append #include "User.reflmd" at the bottom. Reflmd files are C++ source files and do not require to be treated specially by the compiler. They contain the required REFL_TYPE/FUNC/FIELD macros, that would otherwise need to be manually written out.

Then run the following command to generate appropriate .reflmd files for discovered header files used by the input .cpp file. ./refl-ht -input=<filename> -verbose=<y|n>

How to compile:

g++ -std=c++17 -O2 -Wall -I/usr/lib/llvm-7/include rht-main.cpp -lclang -o refl-ht

(Use appropriate path for your version of llvm libs. On Ubuntu, you might need to install libclang.)

Screenshots

Download

Prebuilt binaries - coming coon

Example

struct UserModel
{
    REFL(property(read)) uint64_t id;
    REFL(property(/* default: read_write */) std::string first_name;
    REFL(property()) std::string last_name;
    REFL(property()) std::string email;
    REFL(property()) ns::datetime date_of_birth;

    REFL() std::shared_ptr<UserRepository> get_repo() const;
};

Changelog

  • v0.4.0 - refl-ht now no-longer depends on std::filesystem and does not require special linker flags.
  • v0.3.1 - Fixed a bug where input files would get improperly formatted.

refl-ht's People

Contributors

veselink1 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.