Sha256: 7c8514b30972c75f006a56d6e32e7475f2a7da313b9f986fd9e944b2924c332b
Contents?: true
Size: 1.92 KB
Versions: 3
Compression:
Stored size: 1.92 KB
Contents
#include "reflex/ruby/application.h" #include <rucy.h> #include "defs.h" using namespace Rucy; static Class cApplication; namespace Reflex { Class application_class () { return cApplication; } }// Reflex typedef Reflex::RubyApplication<Reflex::Application> RubyApplication; #define THIS to<Reflex::Application*>(self) #define CHECK RUCY_CHECK_OBJECT(self, Reflex::Application, cApplication) #define CALL(fun) RUCY_WRAPPER_CALL(RubyApplication, THIS, fun) static VALUE alloc(VALUE klass) { return value(new RubyApplication, klass); } static VALUE run(VALUE self) { CHECK; if (!CALL(run())) system_error("failed to run application."); return self; } static VALUE quit(VALUE self) { CHECK; if (!CALL(quit())) system_error("failed to quit application."); return self; } static VALUE about(VALUE self) { CHECK; if (!CALL(about())) system_error("failed to show about application."); return self; } static VALUE set_name(VALUE self, VALUE name) { CHECK; if (!THIS->set_name(name.c_str())) system_error("failed to set name of application."); return name; } static VALUE get_name(VALUE self) { CHECK; const char* s = THIS->name(); if (!s) system_error("failed to get name of application."); return value(s); } static VALUE instance(VALUE self) { return value(Reflex::app()); } void Init_application () { Module mReflex = rb_define_module("Reflex"); cApplication = rb_define_class_under(mReflex, "Application", rb_cObject); rb_define_alloc_func(cApplication, alloc); rb_define_method(cApplication, "run", RUBY_METHOD_FUNC(run), 0); rb_define_method(cApplication, "quit", RUBY_METHOD_FUNC(quit), 0); rb_define_method(cApplication, "about", RUBY_METHOD_FUNC(about), 0); rb_define_method(cApplication, "name=", RUBY_METHOD_FUNC(set_name), 1); rb_define_method(cApplication, "name", RUBY_METHOD_FUNC(get_name), 0); rb_define_singleton_method(cApplication, "instance", RUBY_METHOD_FUNC(instance), 0); }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reflexion-0.1.6 | .doc/ext/reflex/application.cpp |
reflexion-0.1.5 | .doc/ext/reflex/application.cpp |
reflexion-0.1.4 | .doc/ext/reflex/application.cpp |