aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-06 14:14:38 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-06 14:14:38 +0000
commit550c857e9c3aa30b6084c6d4927b0ccc5f102ca8 (patch)
treece18bead72bacbd009b52601415f98287a6a3ea5
parent34529ec5b80366de6214472ced13aedd883b432f (diff)
downloadpaludis-550c857e9c3aa30b6084c6d4927b0ccc5f102ca8.tar.gz
paludis-550c857e9c3aa30b6084c6d4927b0ccc5f102ca8.tar.xz
(ruby) Add metadata spec key classes with no public methods
-rw-r--r--ruby/metadata_key.cc78
-rw-r--r--ruby/package_id_TEST.rb4
2 files changed, 75 insertions, 7 deletions
diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc
index 2abc30d..1d150e2 100644
--- a/ruby/metadata_key.cc
+++ b/ruby/metadata_key.cc
@@ -46,6 +46,12 @@ namespace
static VALUE c_metadata_string_set_key;
static VALUE c_metadata_package_id_sequence_key;
static VALUE c_metadata_key_type;
+ static VALUE c_metadata_provide_spec_tree_key;
+ static VALUE c_metadata_license_spec_tree_key;
+ static VALUE c_metadata_fetchable_uri_spec_tree_key;
+ static VALUE c_metadata_simple_uri_spec_tree_key;
+ static VALUE c_metadata_dependency_spec_tree_key;
+ static VALUE c_metadata_restrict_spec_tree_key;
static VALUE c_repository_mask_info;
/*
@@ -156,32 +162,50 @@ namespace
void visit(const MetadataSpecTreeKey<LicenseSpecTree> &)
{
- value = Qnil;
+ value = Data_Wrap_Struct(c_metadata_license_spec_tree_key, 0,
+ &Common<tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> > >::free,
+ new tr1::shared_ptr<const MetadataSpecTreeKey<LicenseSpecTree> >(
+ tr1::static_pointer_cast<const MetadataSpecTreeKey<LicenseSpecTree> >(mm)));
}
void visit(const MetadataSpecTreeKey<ProvideSpecTree> &)
{
- value = Qnil;
+ value = Data_Wrap_Struct(c_metadata_provide_spec_tree_key, 0,
+ &Common<tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> > >::free,
+ new tr1::shared_ptr<const MetadataSpecTreeKey<ProvideSpecTree> >(
+ tr1::static_pointer_cast<const MetadataSpecTreeKey<ProvideSpecTree> >(mm)));
}
void visit(const MetadataSpecTreeKey<DependencySpecTree> &)
{
- value = Qnil;
+ value = Data_Wrap_Struct(c_metadata_dependency_spec_tree_key, 0,
+ &Common<tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> > >::free,
+ new tr1::shared_ptr<const MetadataSpecTreeKey<DependencySpecTree> >(
+ tr1::static_pointer_cast<const MetadataSpecTreeKey<DependencySpecTree> >(mm)));
}
void visit(const MetadataSpecTreeKey<RestrictSpecTree> &)
{
- value = Qnil;
+ value = Data_Wrap_Struct(c_metadata_restrict_spec_tree_key, 0,
+ &Common<tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> > >::free,
+ new tr1::shared_ptr<const MetadataSpecTreeKey<RestrictSpecTree> >(
+ tr1::static_pointer_cast<const MetadataSpecTreeKey<RestrictSpecTree> >(mm)));
}
void visit(const MetadataSpecTreeKey<FetchableURISpecTree> &)
{
- value = Qnil;
+ value = Data_Wrap_Struct(c_metadata_fetchable_uri_spec_tree_key, 0,
+ &Common<tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> > >::free,
+ new tr1::shared_ptr<const MetadataSpecTreeKey<FetchableURISpecTree> >(
+ tr1::static_pointer_cast<const MetadataSpecTreeKey<FetchableURISpecTree> >(mm)));
}
void visit(const MetadataSpecTreeKey<SimpleURISpecTree> &)
{
- value = Qnil;
+ value = Data_Wrap_Struct(c_metadata_simple_uri_spec_tree_key, 0,
+ &Common<tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > >::free,
+ new tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> >(
+ tr1::static_pointer_cast<const MetadataSpecTreeKey<SimpleURISpecTree> >(mm)));
}
};
@@ -389,6 +413,48 @@ namespace
rb_define_method(c_metadata_string_set_key, "value", RUBY_FUNC_CAST((&SetValue<Set<std::string> >::fetch)), 0);
/*
+ * Document-class: Paludis::MetadataLicenseSpecTreeKey
+ *
+ * Metadata class for license specs
+ */
+ c_metadata_license_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataLicenseSpecTreeKey", c_metadata_key);
+
+ /*
+ * Document-class: Paludis::MetadataProvideSpecTreeKey
+ *
+ * Metadata class for provide specs
+ */
+ c_metadata_provide_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataProvideSpecTreeKey", c_metadata_key);
+
+ /*
+ * Document-class: Paludis::MetadataRestrictSpecTreeKey
+ *
+ * Metadata class for restrict specs
+ */
+ c_metadata_restrict_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataRestrictSpecTreeKey", c_metadata_key);
+
+ /*
+ * Document-class: Paludis::MetadataDependencySpecTreeKey
+ *
+ * Metadata class for dependency specs
+ */
+ c_metadata_dependency_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataDependencySpecTreeKey", c_metadata_key);
+
+ /*
+ * Document-class: Paludis::MetadataFetchableURISpecTreeKey
+ *
+ * Metadata class for fetchable uri specs
+ */
+ c_metadata_fetchable_uri_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataFetchableURISpecTreeKey", c_metadata_key);
+
+ /*
+ * Document-class: Paludis::MetadataSimpleURISpecTreeKey
+ *
+ * Metadata class for simple uri specs
+ */
+ c_metadata_simple_uri_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataSimpleURISpecTreeKey", c_metadata_key);
+
+ /*
* Document-module: Paludis::MetadataKeyType
*
* The significance of a MetadataKey to a user.
diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb
index ad1851a..f3ba8e4 100644
--- a/ruby/package_id_TEST.rb
+++ b/ruby/package_id_TEST.rb
@@ -144,7 +144,9 @@ module Paludis
end
def test_each_metadata
- keys = { "DESCRIPTION"=>1, "IUSE"=>1, "INHERITED"=>1, "KEYWORDS"=>1, "EAPI"=>1, "repository_mask"=>1, "profile_mask"=>1 }
+ keys = { "DESCRIPTION" => 1, "IUSE" => 1, "INHERITED" => 1, "KEYWORDS" => 1, "EAPI" => 1, "repository_mask" => 1,
+ "profile_mask" => 1, "DEPEND" => 1, "RDEPEND" => 1, "PDEPEND" => 1, "LICENSE" => 1, "PROVIDE" => 1,
+ "RESTRICT" => 1, "SRC_URI" => 1, "HOMEPAGE" => 1 }
pid_testrepo.each_metadata do | key |
assert keys.has_key?(key.raw_name)
keys.delete key.raw_name