aboutsummaryrefslogtreecommitdiff
path: root/ruby/package_dep_spec_constraint.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ruby/package_dep_spec_constraint.cc')
-rw-r--r--ruby/package_dep_spec_constraint.cc62
1 files changed, 62 insertions, 0 deletions
diff --git a/ruby/package_dep_spec_constraint.cc b/ruby/package_dep_spec_constraint.cc
index 4cfd42f67..925b70e2d 100644
--- a/ruby/package_dep_spec_constraint.cc
+++ b/ruby/package_dep_spec_constraint.cc
@@ -32,6 +32,8 @@ namespace
{
static VALUE c_package_dep_spec_constraint;
static VALUE c_name_constraint;
+ static VALUE c_package_name_part_constraint;
+ static VALUE c_category_name_part_constraint;
struct V
{
@@ -48,6 +50,18 @@ namespace
value = Data_Wrap_Struct(c_name_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free,
new std::shared_ptr<const PackageDepSpecConstraint>(mm));
}
+
+ void visit(const CategoryNamePartConstraint &)
+ {
+ value = Data_Wrap_Struct(c_category_name_part_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free,
+ new std::shared_ptr<const PackageDepSpecConstraint>(mm));
+ }
+
+ void visit(const PackageNamePartConstraint &)
+ {
+ value = Data_Wrap_Struct(c_package_name_part_constraint, 0, &Common<std::shared_ptr<const PackageDepSpecConstraint> >::free,
+ new std::shared_ptr<const PackageDepSpecConstraint>(mm));
+ }
};
/*
@@ -63,6 +77,32 @@ namespace
return qualified_package_name_to_value((std::static_pointer_cast<const NameConstraint>(*ptr))->name());
}
+ /*
+ * Document-method: name_part
+ *
+ * The name part constraint.
+ */
+ static VALUE
+ package_name_part_constraint_name_part(VALUE self)
+ {
+ std::shared_ptr<const PackageDepSpecConstraint> * ptr;
+ Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecConstraint>, ptr);
+ return rb_str_new2(stringify((std::static_pointer_cast<const PackageNamePartConstraint>(*ptr))->name_part()).c_str());
+ }
+
+ /*
+ * Document-method: name_part
+ *
+ * The name part constraint.
+ */
+ static VALUE
+ category_name_part_constraint_name_part(VALUE self)
+ {
+ std::shared_ptr<const PackageDepSpecConstraint> * ptr;
+ Data_Get_Struct(self, std::shared_ptr<const PackageDepSpecConstraint>, ptr);
+ return rb_str_new2(stringify((std::static_pointer_cast<const CategoryNamePartConstraint>(*ptr))->name_part()).c_str());
+ }
+
void do_register_package_dep_spec_constraint()
{
/*
@@ -82,6 +122,28 @@ namespace
paludis_module(), "NameConstraint", c_package_dep_spec_constraint);
rb_funcall(c_name_constraint, rb_intern("private_class_method"), 1, rb_str_new2("new"));
rb_define_method(c_package_dep_spec_constraint, "name", RUBY_FUNC_CAST(&name_constraint_name), 0);
+
+ /*
+ * Document-class: Paludis::PackageNamePartConstraint
+ *
+ * Represents a /pkg name constraint in a PackageDepSpec.
+ */
+ c_package_name_part_constraint = rb_define_class_under(
+ paludis_module(), "PackageNamePartConstraint", c_package_dep_spec_constraint);
+ rb_funcall(c_package_name_part_constraint, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_define_method(c_package_name_part_constraint, "name_part", RUBY_FUNC_CAST(
+ &package_name_part_constraint_name_part), 0);
+
+ /*
+ * Document-class: Paludis::CategoryNamePartConstraint
+ *
+ * Represents a /pkg name constraint in a PackageDepSpec.
+ */
+ c_category_name_part_constraint = rb_define_class_under(
+ paludis_module(), "CategoryNamePartConstraint", c_package_dep_spec_constraint);
+ rb_funcall(c_category_name_part_constraint, rb_intern("private_class_method"), 1, rb_str_new2("new"));
+ rb_define_method(c_category_name_part_constraint, "name_part", RUBY_FUNC_CAST(
+ &category_name_part_constraint_name_part), 0);
}
}