Sha256: 8c4b69e3fe6db4c2d98fb14c3d11284aa8ab80143c3ef4b0469ee6771f041c41

Contents?: true

Size: 1.11 KB

Versions: 21

Compression:

Stored size: 1.11 KB

Contents

#include "reflex/ruby/event.h"


#include "reflex/exception.h"
#include "defs.h"


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)
{
	Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Event class.");
}

static
VALUE block(VALUE self)
{
	CHECK;
	check_arg_count(__FILE__, __LINE__, "Event#block", argc, 0, 1);

	if (argc >= 1)
		THIS->block((bool) argv[0]);
	else
		THIS->block();
}

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

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


static Class cEvent;

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

	cEvent = rb_define_class_under(mReflex, "Event", rb_cObject);
	rb_define_alloc_func(cEvent, alloc);
	rb_define_method(cEvent, "block", RUBY_METHOD_FUNC(block), -1);
	cEvent.define_method("blocked?", is_blocked);
	rb_define_method(cEvent, "time", RUBY_METHOD_FUNC(get_time), 0);
}


namespace Reflex
{


	Class
	event_class ()
	{
		return cEvent;
	}


}// Reflex

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
reflexion-0.2.1 .doc/ext/reflex/event.cpp
reflexion-0.2 .doc/ext/reflex/event.cpp
reflexion-0.1.57 .doc/ext/reflex/event.cpp
reflexion-0.1.56 .doc/ext/reflex/event.cpp
reflexion-0.1.55 .doc/ext/reflex/event.cpp
reflexion-0.1.54 .doc/ext/reflex/event.cpp
reflexion-0.1.53 .doc/ext/reflex/event.cpp
reflexion-0.1.52 .doc/ext/reflex/event.cpp
reflexion-0.1.51 .doc/ext/reflex/event.cpp
reflexion-0.1.50 .doc/ext/reflex/event.cpp
reflexion-0.1.49 .doc/ext/reflex/event.cpp
reflexion-0.1.48 .doc/ext/reflex/event.cpp
reflexion-0.1.47 .doc/ext/reflex/event.cpp
reflexion-0.1.46 .doc/ext/reflex/event.cpp
reflexion-0.1.45 .doc/ext/reflex/event.cpp
reflexion-0.1.44 .doc/ext/reflex/event.cpp
reflexion-0.1.43 .doc/ext/reflex/event.cpp
reflexion-0.1.42 .doc/ext/reflex/event.cpp
reflexion-0.1.41 .doc/ext/reflex/event.cpp
reflexion-0.1.40 .doc/ext/reflex/event.cpp