Sha256: 312df9c7ac3f3692f6a3205a259f807d7d2e85e93f0b7bf275feeb58ffc6a19a

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

#include "reflex/ruby/event.h"


#include <rucy.h>
#include "defs.h"


using namespace Rucy;


RUCY_DEFINE_VALUE_FROM_TO(Reflex::Event)

#define THIS  to<Reflex::Event*>(self)

#define CHECK RUCY_CHECK_OBJ(Reflex::Event, self)


static
VALUE alloc(VALUE klass)
{
	return new_type<Reflex::Event>(klass);
}

static
VALUE initialize_copy(VALUE self, VALUE obj)
{
	CHECK;
	*THIS = to<Reflex::Event&>(obj);
	return self;
}

static
VALUE block(VALUE self)
{
	CHECK;
	THIS->block();
}

static
VALUE is_blocked(VALUE self)
{
	CHECK;
	return value(THIS->is_blocked());
}


static Class cEvent;

void
Init_event ()
{
	Module mReflex = rb_define_module("Reflex");

	cEvent = rb_define_class_under(mReflex, "Event", rb_cObject);
	rb_define_alloc_func(cEvent, alloc);
	rb_define_private_method(cEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
	rb_define_method(cEvent, "block", RUBY_METHOD_FUNC(block), 0);
	cEvent.define_method("block?", is_blocked);
}


namespace Reflex
{


	Class
	event_class ()
	{
		return cEvent;
	}


}// Reflex

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
reflexion-0.1.12 .doc/ext/reflex/event.cpp
reflexion-0.1.11 .doc/ext/reflex/event.cpp
reflexion-0.1.10 .doc/ext/reflex/event.cpp
reflexion-0.1.9.1 .doc/ext/reflex/event.cpp
reflexion-0.1.9 .doc/ext/reflex/event.cpp
reflexion-0.1.8 .doc/ext/reflex/event.cpp