aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-10-25 22:07:18 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-10-25 22:07:18 +0000
commit75615b91e37d7148461f988c5eab2fb214a62b85 (patch)
tree98b43bc0d04f55945eea0a782107a04b3f46f39a
parent08ac2c69c0075f332c0ae3593c92704c9b5b4ace (diff)
downloadpaludis-75615b91e37d7148461f988c5eab2fb214a62b85.tar.gz
paludis-75615b91e37d7148461f988c5eab2fb214a62b85.tar.xz
Allow UseDepAtom.flag and UseDepAtom.inverse?
-rw-r--r--paludis/dep_atom.hh10
-rw-r--r--ruby/dep_atom.cc18
2 files changed, 28 insertions, 0 deletions
diff --git a/paludis/dep_atom.hh b/paludis/dep_atom.hh
index d44e344..d293648 100644
--- a/paludis/dep_atom.hh
+++ b/paludis/dep_atom.hh
@@ -222,6 +222,16 @@ namespace paludis
}
virtual const UseDepAtom * as_use_dep_atom() const;
+
+ /**
+ * A non-constant smart pointer to ourself.
+ */
+ typedef CountedPtr<UseDepAtom, count_policy::InternalCountTag> Pointer;
+
+ /**
+ * A constant smart pointer to ourself.
+ */
+ typedef CountedPtr<const UseDepAtom, count_policy::InternalCountTag> ConstPointer;
};
/**
diff --git a/ruby/dep_atom.cc b/ruby/dep_atom.cc
index ec66dc5..b0ea8dc 100644
--- a/ruby/dep_atom.cc
+++ b/ruby/dep_atom.cc
@@ -125,6 +125,22 @@ namespace
};
VALUE
+ use_dep_atom_flag(VALUE self)
+ {
+ UseDepAtom::ConstPointer * p;
+ Data_Get_Struct(self, UseDepAtom::ConstPointer, p);
+ return rb_str_new2(stringify((*p)->flag()).c_str());
+ }
+
+ VALUE
+ use_dep_atom_inverse(VALUE self)
+ {
+ UseDepAtom::ConstPointer * p;
+ Data_Get_Struct(self, UseDepAtom::ConstPointer, p);
+ return (*p)->inverse() ? Qtrue : Qfalse;
+ }
+
+ VALUE
composite_dep_atom_each(VALUE self)
{
CompositeDepAtom::Pointer * m_ptr;
@@ -152,6 +168,8 @@ namespace
c_use_dep_atom = rb_define_class_under(master_class(), "UseDepAtom", c_composite_dep_atom);
rb_funcall(c_use_dep_atom, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_define_method(c_use_dep_atom, "flag", RUBY_FUNC_CAST(&use_dep_atom_flag), 0);
+ rb_define_method(c_use_dep_atom, "inverse?", RUBY_FUNC_CAST(&use_dep_atom_inverse), 0);
c_string_dep_atom = rb_define_class_under(master_class(), "StringDepAtom", c_dep_atom);
rb_funcall(c_string_dep_atom, rb_intern("private_class_method"), 1, rb_str_new2("new"));