Coder Social home page Coder Social logo

jseto / jrtti Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 6.0 45.95 MB

C++ class template library providing rtti-reflection capabilities. Gives reflection abstraction access for standard and custom C++ types and classes. Exposes class members at run time, wich can be accessed by name. Object serialization and deserialization and annotations.

Home Page: http://jseto.github.io/jrtti/

C++ 100.00%

jrtti's People

Contributors

gitter-badger avatar jcangas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jrtti's Issues

Problem with collections saving pointers

Try the code below it test_jrtti.cpp and check res.txt file. String s is not streamed!!!

struct Test {
    std::string str;
    std::string * ptr;
};

typedef std::vector< Test * > TestVector;

TEST_F(MetaTypeTest, CollectionOfStrings) {
    declare< Test >()
        .property("str",&Test::str)
        .property("ptr",&Test::ptr);
    declareCollection< TestVector >();

    TestVector elements;
    std::string s = "fins dema **************";

    for ( int i = 0; i < 2; ++i ) {
        Test * ptr = new Test();
        ptr->ptr = &s;
        ptr->str = "hola";
        elements.push_back( ptr );
    }

    std::string str = metatype< TestVector >().toStr( &elements );
    std::ofstream f( "res.txt" );
    f << str;
//  EXPECT_EQ("double", mClass()["testDouble"].metatype().name());

    for ( TestVector::iterator it = elements.begin(); it != elements.end(); ++it ) {
        delete *it;
    }                       
}

Implement multiple inheritance

Metatypes can call derivesFrom multiple times and this effectively adds properties and methods from parent classes passed to derivesFrom.
What fails is inherits from method since parent atttibute of metatype is set to the last call to derivesFrom

Review CollectionInterface

The commented behavior of CollectionInterface and iterator is not correct.
If you have a collection class using a internal stl container, deriving from CollectionInterface will not work as the iterator is not well formed. ex

class TVMContour : public CollectionInterface<TVMPoint>
{
public:
    typedef TVMComponent inherited;
    typedef std::vector<TVMPoint> ContourPoints;

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.