1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
therubyracer/ext/v8/class_builder.h
Georgy Angelov 2fca33f9d0 Remove old ext files and spec & link to the new V8
The functionality will be added (that is, if I don't get bored) one thing at a time with the spec.
If you want to test, point the libv8 gem (in Gemfile) to its trunk branch & my changes at stormbreakerbg/libv8 @ trunk.

What works currently is getting V8 to initialize, say its version and create a new Isolate.
2015-03-18 21:57:39 +00:00

40 lines
1.5 KiB
C++

#ifndef RR_CLASS_BUILDER
#define RR_CLASS_BUILDER
namespace rr {
class ClassBuilder {
public:
static VALUE defineClass(const char *name, VALUE superclass = rb_cObject);
static VALUE defineModule(const char *name);
ClassBuilder() {};
ClassBuilder(const char* name, VALUE superclass = rb_cObject);
ClassBuilder(const char* name, const char* supername);
ClassBuilder& defineConst(const char* name, VALUE value);
ClassBuilder& defineMethod(const char* name, VALUE (*impl)(int, VALUE*, VALUE));
ClassBuilder& defineMethod(const char* name, VALUE (*impl)(VALUE));
ClassBuilder& defineMethod(const char* name, VALUE (*impl)(VALUE, VALUE));
ClassBuilder& defineMethod(const char* name, VALUE (*impl)(VALUE, VALUE, VALUE));
ClassBuilder& defineMethod(const char* name, VALUE (*impl)(VALUE, VALUE, VALUE, VALUE));
ClassBuilder& defineSingletonMethod(const char* name, VALUE (*impl)(int, VALUE*, VALUE));
ClassBuilder& defineSingletonMethod(const char* name, VALUE (*impl)(VALUE));
ClassBuilder& defineSingletonMethod(const char* name, VALUE (*impl)(VALUE, VALUE));
ClassBuilder& defineSingletonMethod(const char* name, VALUE (*impl)(VALUE, VALUE, VALUE));
ClassBuilder& defineSingletonMethod(const char* name, VALUE (*impl)(VALUE, VALUE, VALUE, VALUE));
ClassBuilder& defineEnumConst(const char* name, int value);
ClassBuilder& store(VALUE* storage);
inline operator VALUE() {return this->value;}
protected:
VALUE value;
};
}
#endif