aboutsummaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-09-14 17:40:39 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-09-14 18:06:37 +0100
commit7ce0a00a008983de8a8e61d33d41a4f41147db9b (patch)
treeba35068b18f5745145d0eefe02df85c0cd0aa5cc /ruby
parent2bff9772cc069fe98e281432bddd0b35c1e934e4 (diff)
downloadpaludis-7ce0a00a008983de8a8e61d33d41a4f41147db9b.tar.gz
paludis-7ce0a00a008983de8a8e61d33d41a4f41147db9b.tar.xz
Refactor to allow subslots
Diffstat (limited to 'ruby')
-rw-r--r--ruby/dep_spec.cc54
-rw-r--r--ruby/dep_spec_TEST.rb2
-rw-r--r--ruby/metadata_key.cc5
-rw-r--r--ruby/package_id.cc2
4 files changed, 46 insertions, 17 deletions
diff --git a/ruby/dep_spec.cc b/ruby/dep_spec.cc
index 32d07b023..207b3f748 100644
--- a/ruby/dep_spec.cc
+++ b/ruby/dep_spec.cc
@@ -65,8 +65,10 @@ namespace
static VALUE c_version_requirements_mode;
static VALUE c_slot_requirement;
- static VALUE c_slot_exact_requirement;
- static VALUE c_slot_any_locked_requirement;
+ static VALUE c_slot_exact_partial_requirement;
+ static VALUE c_slot_exact_full_requirement;
+ static VALUE c_slot_any_partial_locked_requirement;
+ static VALUE c_slot_any_at_all_locked_requirement;
static VALUE c_slot_any_unlocked_requirement;
struct V
@@ -79,15 +81,27 @@ namespace
{
}
- void visit(const SlotExactRequirement &)
+ void visit(const SlotExactPartialRequirement &)
{
- value = Data_Wrap_Struct(c_slot_exact_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
+ value = Data_Wrap_Struct(c_slot_exact_partial_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
new std::shared_ptr<const SlotRequirement>(mm));
}
- void visit(const SlotAnyLockedRequirement &)
+ void visit(const SlotExactFullRequirement &)
{
- value = Data_Wrap_Struct(c_slot_any_locked_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
+ value = Data_Wrap_Struct(c_slot_exact_full_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
+ new std::shared_ptr<const SlotRequirement>(mm));
+ }
+
+ void visit(const SlotAnyAtAllLockedRequirement &)
+ {
+ value = Data_Wrap_Struct(c_slot_any_at_all_locked_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
+ new std::shared_ptr<const SlotRequirement>(mm));
+ }
+
+ void visit(const SlotAnyPartialLockedRequirement &)
+ {
+ value = Data_Wrap_Struct(c_slot_any_partial_locked_requirement, 0, &Common<std::shared_ptr<const SlotRequirement> >::free,
new std::shared_ptr<const SlotRequirement>(mm));
}
@@ -976,8 +990,8 @@ namespace
VALUE
slot_exact_requirement_slot(VALUE self)
{
- std::shared_ptr<const SlotExactRequirement> * ptr;
- Data_Get_Struct(self, std::shared_ptr<const SlotExactRequirement>, ptr);
+ std::shared_ptr<const SlotExactPartialRequirement> * ptr;
+ Data_Get_Struct(self, std::shared_ptr<const SlotExactPartialRequirement>, ptr);
return rb_str_new2(stringify((*ptr)->slot()).c_str());
}
@@ -1228,19 +1242,33 @@ namespace
rb_define_method(c_slot_requirement, "to_s", RUBY_FUNC_CAST(&Common<std::shared_ptr<const SlotRequirement> >::to_s_via_ptr), 0);
/*
- * Document-class: Paludis::ExactSlotRequirement
+ * Document-class: Paludis::SlotExactPartialRequirement
*
* An exact slot requiremet (:)
*/
- c_slot_exact_requirement = rb_define_class_under(paludis_module(), "SlotExactRequirement", c_slot_requirement);
- rb_define_method(c_slot_exact_requirement, "slot", RUBY_FUNC_CAST(&slot_exact_requirement_slot), 0);
+ c_slot_exact_partial_requirement = rb_define_class_under(paludis_module(), "SlotExactPartialRequirement", c_slot_requirement);
+ rb_define_method(c_slot_exact_partial_requirement, "slot", RUBY_FUNC_CAST(&slot_exact_requirement_slot), 0);
+
+ /*
+ * Document-class: Paludis::SlotExactFullRequirement
+ *
+ * An exact slot requiremet
+ */
+ c_slot_exact_full_requirement = rb_define_class_under(paludis_module(), "SlotExactFullRequirement", c_slot_requirement);
+
+ /*
+ * Document-class: Paludis::SlotAnyPartialLockedRequirement
+ *
+ * An any locked slot requiremet (:=)
+ */
+ c_slot_any_partial_locked_requirement = rb_define_class_under(paludis_module(), "SlotAnyPartialLockedRequirement", c_slot_requirement);
/*
- * Document-class: Paludis::SlotAnyLockedRequirement
+ * Document-class: Paludis::SlotAnyAtAllLockedRequirement
*
* An any locked slot requiremet (:=)
*/
- c_slot_any_locked_requirement = rb_define_class_under(paludis_module(), "SlotAnyLockedRequirement", c_slot_requirement);
+ c_slot_any_at_all_locked_requirement = rb_define_class_under(paludis_module(), "SlotAnyAtAllLockedRequirement", c_slot_requirement);
/*
* Document-class: Paludis::ExactSlotRequirement
diff --git a/ruby/dep_spec_TEST.rb b/ruby/dep_spec_TEST.rb
index 526186a59..f9a2666f3 100644
--- a/ruby/dep_spec_TEST.rb
+++ b/ruby/dep_spec_TEST.rb
@@ -130,7 +130,7 @@ module Paludis
end
def test_slot
- assert_kind_of SlotExactRequirement, pda.slot_requirement
+ assert_kind_of SlotExactPartialRequirement, pda.slot_requirement
assert_equal ":100", pda.slot_requirement.to_s
assert_equal "100", pda.slot_requirement.slot
assert_nil pdb.slot_requirement
diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc
index dba7cfae4..188bd3df3 100644
--- a/ruby/metadata_key.cc
+++ b/ruby/metadata_key.cc
@@ -23,6 +23,7 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/mask.hh>
+#include <paludis/slot.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/visitor_cast.hh>
@@ -115,7 +116,7 @@ namespace
new std::shared_ptr<const MetadataKey>(mm));
}
- void visit(const MetadataValueKey<SlotName> &)
+ void visit(const MetadataValueKey<Slot> &)
{
value = Data_Wrap_Struct(c_metadata_slot_key, 0, &Common<std::shared_ptr<const MetadataKey> >::free,
new std::shared_ptr<const MetadataKey>(mm));
@@ -305,7 +306,7 @@ namespace
{
std::shared_ptr<const MetadataKey> * self_ptr;
Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr);
- return rb_str_new2(stringify((std::static_pointer_cast<const MetadataValueKey<SlotName> >(*self_ptr))->parse_value()).c_str());
+ return rb_str_new2(stringify((std::static_pointer_cast<const MetadataValueKey<Slot> >(*self_ptr))->parse_value().raw_value()).c_str());
}
catch (const std::exception & e)
{
diff --git a/ruby/package_id.cc b/ruby/package_id.cc
index 8b8ddfc2d..75e623281 100644
--- a/ruby/package_id.cc
+++ b/ruby/package_id.cc
@@ -573,7 +573,7 @@ namespace
rb_define_method(c_package_id, "choices_key", RUBY_FUNC_CAST((
&KeyValue<MetadataValueKey<std::shared_ptr<const Choices> >, &PackageID::choices_key>::fetch)), 0);
rb_define_method(c_package_id, "slot_key", RUBY_FUNC_CAST((
- &KeyValue<MetadataValueKey<SlotName>, &PackageID::slot_key>::fetch)), 0);
+ &KeyValue<MetadataValueKey<Slot>, &PackageID::slot_key>::fetch)), 0);
rb_define_method(c_package_id, "behaviours_key", RUBY_FUNC_CAST((
&KeyValue<MetadataCollectionKey<Set<std::string> >, &PackageID::behaviours_key>::fetch)), 0);
rb_define_method(c_package_id, "uniquely_identifying_spec", RUBY_FUNC_CAST(&package_id_uniquely_identifying_spec), 0);