Sha256: e06f2a2f7d9b36dd5040a3e67a1b8d3764225c311e63c789226236abb7066f67

Contents?: true

Size: 1.53 KB

Versions: 6

Compression:

Stored size: 1.53 KB

Contents

#include "reflex/ruby/event.h"


#include <rucy.h>
#include "rays/ruby/point.h"
#include "defs.h"


using namespace Rucy;


RUCY_DEFINE_VALUE_FROM_TO(Reflex::CaptureEvent)

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

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


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

static
VALUE initialize(VALUE self)
{
	CHECK;
	check_arg_count(__FILE__, __LINE__, "CaptureEvent#initialize", argc, 0, 1, 2);

	THIS->begin = (argc >= 1) ? to<uint>(argv[0]) : 0;
	THIS->end   = (argc >= 2) ? to<uint>(argv[1]) : 0;

	return rb_call_super(0, NULL);
}

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

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

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


static Class cCaptureEvent;

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

	cCaptureEvent = mReflex.define_class("CaptureEvent", Reflex::event_class());
	rb_define_alloc_func(cCaptureEvent, alloc);
	rb_define_private_method(cCaptureEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
	rb_define_private_method(cCaptureEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
	rb_define_private_method(cCaptureEvent, "get_begin", RUBY_METHOD_FUNC(begin), 0);
	rb_define_private_method(cCaptureEvent, "get_end", RUBY_METHOD_FUNC(end), 0);
}


namespace Reflex
{


	Class
	capture_event_class ()
	{
		return cCaptureEvent;
	}


}// Reflex

Version data entries

6 entries across 6 versions & 1 rubygems

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