Sha256: 866f96133754ec72fc9dfa6cbf74e4429e1e3695243050bbfdc28759f6abac8f

Contents?: true

Size: 1.05 KB

Versions: 21

Compression:

Stored size: 1.05 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
RUCY_DEF_ALLOC(alloc, klass)
{
	Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Event class.");
}
RUCY_END

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

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

static
RUCY_DEF0(is_blocked)
{
	CHECK;
	return value(THIS->is_blocked());
}
RUCY_END

static
RUCY_DEF0(get_time)
{
	CHECK;
	return value(THIS->time());
}
RUCY_END


static Class cEvent;

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

	cEvent = mReflex.define_class("Event");
	cEvent.define_alloc_func(alloc);
	cEvent.define_method("block",    block);
	cEvent.define_method("blocked?", is_blocked);
	cEvent.define_method("time",     get_time);
}


namespace Reflex
{


	Class
	event_class ()
	{
		return cEvent;
	}


}// Reflex

Version data entries

21 entries across 21 versions & 1 rubygems

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