atk 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/atk/extconf.rb +3 -0
- data/ext/atk/rbatk.c +56 -17
- data/ext/atk/rbatk.h +21 -12
- data/ext/atk/rbatkaction.c +38 -27
- data/ext/atk/rbatkcomponent.c +61 -50
- data/ext/atk/rbatkconversions.h +70 -0
- data/ext/atk/rbatkdocument.c +38 -27
- data/ext/atk/rbatkeditabletext.c +123 -39
- data/ext/atk/rbatkgobjectaccessible.c +30 -19
- data/ext/atk/rbatkhyperlink.c +34 -22
- data/ext/atk/rbatkhypertext.c +32 -20
- data/ext/atk/rbatkimage.c +34 -22
- data/ext/atk/rbatkimplementor.c +26 -14
- data/ext/atk/rbatknoopobject.c +28 -17
- data/ext/atk/rbatknoopobjectfactory.c +28 -17
- data/ext/atk/rbatkobject.c +48 -63
- data/ext/atk/rbatkobjectfactory.c +32 -20
- data/ext/atk/rbatkobjectrole.c +50 -0
- data/ext/atk/rbatkprivate.h +48 -0
- data/ext/atk/rbatkregistry.c +34 -22
- data/ext/atk/rbatkrelation.c +68 -43
- data/ext/atk/rbatkrelationset.c +44 -32
- data/ext/atk/rbatkrelationtype.c +38 -0
- data/ext/atk/rbatkselection.c +38 -26
- data/ext/atk/rbatkstate.c +32 -20
- data/ext/atk/rbatkstateset.c +113 -65
- data/ext/atk/rbatkstreamablecontent.c +33 -23
- data/ext/atk/rbatktable.c +91 -80
- data/ext/atk/rbatktext.c +85 -107
- data/ext/atk/rbatktextattribute.c +54 -0
- data/ext/atk/rbatktextrange.c +38 -33
- data/ext/atk/rbatktextrectangle.c +53 -48
- data/ext/atk/rbatkutil.c +44 -35
- data/ext/atk/rbatkvalue.c +39 -29
- metadata +14 -12
- data/ChangeLog +0 -278
- data/ext/atk/makeinits.rb +0 -39
- data/ext/atk/rbatkinits.c +0 -56
@@ -1,41 +1,53 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2003 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbatkprivate.h"
|
23
|
+
|
24
|
+
#define RG_TARGET_NAMESPACE cObjectFactory
|
25
|
+
#define _SELF(s) (RVAL2ATKOBJECTFACTORY(s))
|
14
26
|
|
15
27
|
static VALUE
|
16
|
-
|
28
|
+
rg_create_accessible(VALUE self, VALUE obj)
|
17
29
|
{
|
18
30
|
return GOBJ2RVAL(atk_object_factory_create_accessible(_SELF(self), RVAL2GOBJ(obj)));
|
19
31
|
}
|
20
32
|
|
21
33
|
static VALUE
|
22
|
-
|
34
|
+
rg_accessible_type(VALUE self)
|
23
35
|
{
|
24
36
|
return GTYPE2CLASS(atk_object_factory_get_accessible_type(_SELF(self)));
|
25
37
|
}
|
26
38
|
|
27
39
|
static VALUE
|
28
|
-
|
40
|
+
rg_invalidate(VALUE self)
|
29
41
|
{
|
30
42
|
atk_object_factory_invalidate(_SELF(self));
|
31
43
|
return self;
|
32
44
|
}
|
33
45
|
|
34
46
|
void
|
35
|
-
Init_atk_objectfactory()
|
47
|
+
Init_atk_objectfactory(VALUE mAtk)
|
36
48
|
{
|
37
|
-
VALUE
|
38
|
-
|
39
|
-
|
40
|
-
|
49
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_OBJECT_FACTORY, "ObjectFactory", mAtk);
|
50
|
+
RG_DEF_METHOD(create_accessible, 0);
|
51
|
+
RG_DEF_METHOD(accessible_type, 0);
|
52
|
+
RG_DEF_METHOD(invalidate, 0);
|
41
53
|
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2003,2004 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbatkprivate.h"
|
23
|
+
|
24
|
+
#define RG_TARGET_NAMESPACE cRole
|
25
|
+
|
26
|
+
static VALUE
|
27
|
+
rg_localized_name(G_GNUC_UNUSED VALUE self)
|
28
|
+
{
|
29
|
+
#ifdef HAVE_ATK_ROLE_GET_LOCALIZED_NAME
|
30
|
+
return CSTR2RVAL(atk_role_get_localized_name(RVAL2ATKROLE(self)));
|
31
|
+
#else
|
32
|
+
rb_warning("not supported in this version of ATK.");
|
33
|
+
return Qnil;
|
34
|
+
#endif
|
35
|
+
}
|
36
|
+
|
37
|
+
static VALUE
|
38
|
+
rg_s_for_name(G_GNUC_UNUSED VALUE self, VALUE name)
|
39
|
+
{
|
40
|
+
return ATKROLE2RVAL(atk_role_for_name(RVAL2CSTR(name)));
|
41
|
+
}
|
42
|
+
|
43
|
+
void
|
44
|
+
Init_atk_object_role(VALUE cObject)
|
45
|
+
{
|
46
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_ROLE, "Role", cObject);
|
47
|
+
RG_DEF_METHOD(localized_name, 0);
|
48
|
+
RG_DEF_SMETHOD(for_name, 1);
|
49
|
+
G_DEF_CONSTANTS(cObject, ATK_TYPE_ROLE, "ATK_");
|
50
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#ifndef RB_ATK_PRIVATE_H
|
2
|
+
#define RB_ATK_PRIVATE_H
|
3
|
+
|
4
|
+
#include "rbatk.h"
|
5
|
+
|
6
|
+
#ifndef HAVE_RB_ERRINFO
|
7
|
+
# define rb_errinfo() (ruby_errinfo)
|
8
|
+
#endif
|
9
|
+
|
10
|
+
#ifndef G_VALUE_INIT
|
11
|
+
# define G_VALUE_INIT { 0, { { 0 } } }
|
12
|
+
#endif
|
13
|
+
|
14
|
+
G_BEGIN_DECLS
|
15
|
+
|
16
|
+
G_GNUC_INTERNAL void Init_atk_action(VALUE mAtk);
|
17
|
+
G_GNUC_INTERNAL void Init_atk_component(VALUE mAtk);
|
18
|
+
G_GNUC_INTERNAL void Init_atk_document(VALUE mAtk);
|
19
|
+
G_GNUC_INTERNAL void Init_atk_editabletext(VALUE mAtk);
|
20
|
+
G_GNUC_INTERNAL void Init_atk_gobjectaccessible(VALUE mAtk);
|
21
|
+
G_GNUC_INTERNAL void Init_atk_hyperlink(VALUE mAtk);
|
22
|
+
G_GNUC_INTERNAL void Init_atk_hypertext(VALUE mAtk);
|
23
|
+
G_GNUC_INTERNAL void Init_atk_image(VALUE mAtk);
|
24
|
+
G_GNUC_INTERNAL void Init_atk_implementor(VALUE mAtk);
|
25
|
+
G_GNUC_INTERNAL void Init_atk_noopobject(VALUE mAtk);
|
26
|
+
G_GNUC_INTERNAL void Init_atk_noopobjectfactory(VALUE mAtk);
|
27
|
+
G_GNUC_INTERNAL void Init_atk_object(VALUE mAtk);
|
28
|
+
G_GNUC_INTERNAL void Init_atk_object_role(VALUE cObject);
|
29
|
+
G_GNUC_INTERNAL void Init_atk_objectfactory(VALUE mAtk);
|
30
|
+
G_GNUC_INTERNAL void Init_atk_registry(VALUE mAtk);
|
31
|
+
G_GNUC_INTERNAL void Init_atk_relation(VALUE mAtk);
|
32
|
+
G_GNUC_INTERNAL void Init_atk_relation_type(VALUE cRelation);
|
33
|
+
G_GNUC_INTERNAL void Init_atk_relation_set(VALUE mAtk);
|
34
|
+
G_GNUC_INTERNAL void Init_atk_selection(VALUE mAtk);
|
35
|
+
G_GNUC_INTERNAL void Init_atk_state(VALUE mAtk);
|
36
|
+
G_GNUC_INTERNAL void Init_atk_state_set(VALUE mAtk);
|
37
|
+
G_GNUC_INTERNAL void Init_atk_streamable_content(VALUE mAtk);
|
38
|
+
G_GNUC_INTERNAL void Init_atk_table(VALUE mAtk);
|
39
|
+
G_GNUC_INTERNAL void Init_atk_text(VALUE mAtk);
|
40
|
+
G_GNUC_INTERNAL void Init_atk_text_attribute(VALUE mText);
|
41
|
+
G_GNUC_INTERNAL void Init_atk_text_range(VALUE mAtk);
|
42
|
+
G_GNUC_INTERNAL void Init_atk_text_rectangle(VALUE mAtk);
|
43
|
+
G_GNUC_INTERNAL void Init_atk_util(VALUE mAtk);
|
44
|
+
G_GNUC_INTERNAL void Init_atk_value(VALUE mAtk);
|
45
|
+
|
46
|
+
G_END_DECLS
|
47
|
+
|
48
|
+
#endif /* RB_ATK_PRIVATE_H */
|
data/ext/atk/rbatkregistry.c
CHANGED
@@ -1,19 +1,31 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2003 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbatkprivate.h"
|
23
|
+
|
24
|
+
#define RG_TARGET_NAMESPACE cRegistry
|
25
|
+
#define _SELF(s) (RVAL2ATKREGISTRY(s))
|
14
26
|
|
15
27
|
static VALUE
|
16
|
-
|
28
|
+
rg_set_factory_type(VALUE self, VALUE type, VALUE factory_type)
|
17
29
|
{
|
18
30
|
atk_registry_set_factory_type(_SELF(self),
|
19
31
|
CLASS2GTYPE(type),
|
@@ -22,30 +34,30 @@ rbatkregistry_set_factory_type(VALUE self, VALUE type, VALUE factory_type)
|
|
22
34
|
}
|
23
35
|
|
24
36
|
static VALUE
|
25
|
-
|
37
|
+
rg_get_factory_type(VALUE self, VALUE type)
|
26
38
|
{
|
27
39
|
return GTYPE2CLASS(atk_registry_get_factory_type(_SELF(self), CLASS2GTYPE(type)));
|
28
40
|
}
|
29
41
|
|
30
42
|
static VALUE
|
31
|
-
|
43
|
+
rg_get_factory(VALUE self, VALUE type)
|
32
44
|
{
|
33
45
|
return GOBJ2RVAL(atk_registry_get_factory(_SELF(self),
|
34
46
|
CLASS2GTYPE(type)));
|
35
47
|
}
|
36
48
|
|
37
49
|
static VALUE
|
38
|
-
|
50
|
+
rg_s_default_registry(G_GNUC_UNUSED VALUE self)
|
39
51
|
{
|
40
52
|
return GOBJ2RVAL(atk_get_default_registry());
|
41
53
|
}
|
42
54
|
|
43
55
|
void
|
44
|
-
Init_atk_registry()
|
56
|
+
Init_atk_registry(VALUE mAtk)
|
45
57
|
{
|
46
|
-
VALUE
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
58
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_REGISTRY, "Registry", mAtk);
|
59
|
+
RG_DEF_METHOD(set_factory_type, 2);
|
60
|
+
RG_DEF_METHOD(get_factory_type, 1);
|
61
|
+
RG_DEF_METHOD(get_factory, 1);
|
62
|
+
RG_DEF_SMETHOD(default_registry, 0);
|
51
63
|
}
|
data/ext/atk/rbatkrelation.c
CHANGED
@@ -1,77 +1,102 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2003 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbatkprivate.h"
|
23
|
+
|
24
|
+
#define RG_TARGET_NAMESPACE cRelation
|
25
|
+
#define _SELF(s) (RVAL2ATKRELATION(s))
|
14
26
|
|
15
27
|
static VALUE
|
16
|
-
|
28
|
+
rg_s_type_register(G_GNUC_UNUSED VALUE self, VALUE name)
|
17
29
|
{
|
18
|
-
return
|
30
|
+
return ATKRELATIONTYPE2RVAL(atk_relation_type_register(RVAL2CSTR(name)));
|
19
31
|
}
|
20
32
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
33
|
+
struct rval2atkobjects_args {
|
34
|
+
VALUE ary;
|
35
|
+
long n;
|
36
|
+
AtkObject **result;
|
37
|
+
};
|
25
38
|
|
26
39
|
static VALUE
|
27
|
-
|
40
|
+
rval2atkobjects_body(VALUE value)
|
28
41
|
{
|
29
|
-
|
42
|
+
long i;
|
43
|
+
struct rval2atkobjects_args *args = (struct rval2atkobjects_args *)value;
|
44
|
+
|
45
|
+
for (i = 0; i < args->n; i++)
|
46
|
+
args->result[i] = RVAL2ATKOBJECT(RARRAY_PTR(args->ary)[i]);
|
47
|
+
|
48
|
+
return Qnil;
|
30
49
|
}
|
31
50
|
|
51
|
+
static G_GNUC_NORETURN VALUE
|
52
|
+
rval2atkobjects_rescue(VALUE value)
|
53
|
+
{
|
54
|
+
g_free(((struct rval2atkobjects_args *)value)->result);
|
55
|
+
|
56
|
+
rb_exc_raise(rb_errinfo());
|
57
|
+
}
|
32
58
|
|
33
59
|
static VALUE
|
34
|
-
|
60
|
+
rg_initialize(VALUE self, VALUE targets, VALUE rbrelationship)
|
35
61
|
{
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
62
|
+
AtkRelationType relationship = RVAL2ATKRELATIONTYPE(rbrelationship);
|
63
|
+
struct rval2atkobjects_args args;
|
64
|
+
AtkRelation *relation;
|
65
|
+
|
66
|
+
args.ary = rb_ary_to_ary(targets);
|
67
|
+
args.n = RARRAY_LEN(args.ary);
|
68
|
+
args.result = g_new(AtkObject *, args.n + 1);
|
69
|
+
|
70
|
+
rb_rescue(rval2atkobjects_body, (VALUE)&args,
|
71
|
+
rval2atkobjects_rescue, (VALUE)&args);
|
40
72
|
|
41
|
-
|
42
|
-
objects[i] = RVAL2ATKOBJECT(RARRAY_PTR(targets)[i]);
|
73
|
+
relation = atk_relation_new(args.result, args.n, relationship);
|
43
74
|
|
44
|
-
|
45
|
-
len,
|
46
|
-
RVAL2GENUM(relationship, ATK_TYPE_RELATION_TYPE)));
|
75
|
+
g_free(args.result);
|
47
76
|
|
48
|
-
|
77
|
+
G_INITIALIZE(self, relation);
|
49
78
|
|
50
79
|
return Qnil;
|
51
80
|
}
|
52
81
|
|
53
82
|
#if ATK_CHECK_VERSION(1,9,0)
|
54
83
|
static VALUE
|
55
|
-
|
84
|
+
rg_add_target(VALUE self, VALUE obj)
|
56
85
|
{
|
57
|
-
atk_relation_add_target(_SELF(self),
|
86
|
+
atk_relation_add_target(_SELF(self), RVAL2ATKOBJECT(obj));
|
58
87
|
return self;
|
59
88
|
}
|
60
89
|
#endif
|
61
90
|
|
62
91
|
void
|
63
|
-
Init_atk_relation()
|
92
|
+
Init_atk_relation(VALUE mAtk)
|
64
93
|
{
|
65
|
-
VALUE
|
66
|
-
|
67
|
-
|
68
|
-
rb_define_method(rel, "initialize", rbatkrel_initialize, 2);
|
94
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_RELATION, "Relation", mAtk);
|
95
|
+
RG_DEF_SMETHOD(type_register, 1);
|
96
|
+
RG_DEF_METHOD(initialize, 2);
|
69
97
|
#if ATK_CHECK_VERSION(1,9,0)
|
70
|
-
|
98
|
+
RG_DEF_METHOD(add_target, 1);
|
71
99
|
#endif
|
72
100
|
|
73
|
-
|
74
|
-
type = G_DEF_CLASS(ATK_TYPE_RELATION_TYPE, "Type", rel);
|
75
|
-
rb_define_singleton_method(type, "for_name", rbatkrelation_s_for_name, 1);
|
76
|
-
G_DEF_CONSTANTS(rel, ATK_TYPE_RELATION_TYPE, "ATK_");
|
101
|
+
Init_atk_relation_type(RG_TARGET_NAMESPACE);
|
77
102
|
}
|
data/ext/atk/rbatkrelationset.c
CHANGED
@@ -1,59 +1,71 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2003 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
3
21
|
|
4
|
-
|
22
|
+
#include "rbatkprivate.h"
|
5
23
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Copyright (C) 2003 Masao Mutoh
|
10
|
-
************************************************/
|
11
|
-
#include "rbatk.h"
|
12
|
-
|
13
|
-
#define _SELF(s) (ATK_RELATION_SET(RVAL2GOBJ(s)))
|
24
|
+
#define RG_TARGET_NAMESPACE cRelationSet
|
25
|
+
#define _SELF(s) (RVAL2ATKRELATIONSET(s))
|
14
26
|
|
15
27
|
static VALUE
|
16
|
-
|
28
|
+
rg_initialize(VALUE self)
|
17
29
|
{
|
18
30
|
G_INITIALIZE(self, atk_relation_set_new());
|
19
31
|
return Qnil;
|
20
32
|
}
|
21
33
|
|
22
34
|
static VALUE
|
23
|
-
|
35
|
+
rg_contains_p(VALUE self, VALUE relationship)
|
24
36
|
{
|
25
37
|
return CBOOL2RVAL(atk_relation_set_contains(
|
26
38
|
_SELF(self),
|
27
|
-
|
39
|
+
RVAL2ATKRELATIONTYPE(relationship)));
|
28
40
|
}
|
29
41
|
|
30
42
|
static VALUE
|
31
|
-
|
43
|
+
rg_remove(VALUE self, VALUE relation)
|
32
44
|
{
|
33
|
-
atk_relation_set_remove(_SELF(self),
|
45
|
+
atk_relation_set_remove(_SELF(self), RVAL2ATKRELATION(relation));
|
34
46
|
return self;
|
35
47
|
}
|
36
48
|
|
37
49
|
static VALUE
|
38
|
-
|
50
|
+
rg_add(VALUE self, VALUE relation)
|
39
51
|
{
|
40
|
-
atk_relation_set_add(_SELF(self),
|
52
|
+
atk_relation_set_add(_SELF(self), RVAL2ATKRELATION(relation));
|
41
53
|
return self;
|
42
54
|
}
|
43
55
|
|
44
56
|
static VALUE
|
45
|
-
|
57
|
+
rg_n_relations(VALUE self)
|
46
58
|
{
|
47
59
|
return INT2NUM(atk_relation_set_get_n_relations(_SELF(self)));
|
48
60
|
}
|
49
61
|
|
50
62
|
static VALUE
|
51
|
-
|
63
|
+
rg_get_relation(VALUE self, VALUE i)
|
52
64
|
{
|
53
65
|
if (rb_obj_is_kind_of(i, GTYPE2CLASS(ATK_TYPE_RELATION_TYPE))){
|
54
66
|
return GOBJ2RVAL(atk_relation_set_get_relation_by_type(
|
55
67
|
_SELF(self),
|
56
|
-
|
68
|
+
RVAL2ATKRELATIONTYPE(i)));
|
57
69
|
} else {
|
58
70
|
return GOBJ2RVAL(atk_relation_set_get_relation(_SELF(self), NUM2INT(i)));
|
59
71
|
}
|
@@ -61,27 +73,27 @@ rbatkrelset_get_relation(VALUE self, VALUE i)
|
|
61
73
|
|
62
74
|
#if ATK_CHECK_VERSION(1,9,0)
|
63
75
|
static VALUE
|
64
|
-
|
76
|
+
rg_add_relation(VALUE self, VALUE relationship, VALUE obj)
|
65
77
|
{
|
66
78
|
atk_relation_set_add_relation_by_type(_SELF(self),
|
67
|
-
|
68
|
-
|
79
|
+
RVAL2ATKRELATIONTYPE(relationship),
|
80
|
+
RVAL2ATKOBJECT(obj));
|
69
81
|
return self;
|
70
82
|
}
|
71
83
|
#endif
|
72
84
|
|
73
85
|
void
|
74
|
-
Init_atk_relation_set()
|
86
|
+
Init_atk_relation_set(VALUE mAtk)
|
75
87
|
{
|
76
|
-
VALUE
|
88
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(ATK_TYPE_RELATION_SET, "RelationSet", mAtk);
|
77
89
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
90
|
+
RG_DEF_METHOD(initialize, 0);
|
91
|
+
RG_DEF_METHOD_P(contains, 1);
|
92
|
+
RG_DEF_METHOD(remove, 1);
|
93
|
+
RG_DEF_METHOD(add, 1);
|
94
|
+
RG_DEF_METHOD(n_relations, 0);
|
95
|
+
RG_DEF_METHOD(get_relation, 1);
|
84
96
|
#if ATK_CHECK_VERSION(1,9,0)
|
85
|
-
|
97
|
+
RG_DEF_METHOD(add_relation, 2);
|
86
98
|
#endif
|
87
99
|
}
|