aboutsummaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-02-16 09:17:23 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-02-16 09:17:23 +0000
commit830cd0e27f1acdbfdf66e6dd7a8630a35a6869b5 (patch)
tree1b486967b2b840ea87a8fbf311c13a823540116e /ruby
parent169e91b611f2a12b89467e03abb4c76ddbe3fe7e (diff)
downloadpaludis-830cd0e27f1acdbfdf66e6dd7a8630a35a6869b5.tar.gz
paludis-830cd0e27f1acdbfdf66e6dd7a8630a35a6869b5.tar.xz
Merge various metadata key things.
Diffstat (limited to 'ruby')
-rw-r--r--ruby/metadata_key.cc28
-rw-r--r--ruby/package_id.cc21
-rw-r--r--ruby/repository.cc4
3 files changed, 29 insertions, 24 deletions
diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc
index 871b66c..bbb5dd8 100644
--- a/ruby/metadata_key.cc
+++ b/ruby/metadata_key.cc
@@ -105,19 +105,19 @@ namespace
{
}
- void visit(const MetadataPackageIDKey &)
+ void visit(const MetadataValueKey<tr1::shared_ptr<const PackageID> > &)
{
value = Data_Wrap_Struct(c_metadata_package_id_key, 0, &Common<tr1::shared_ptr<const MetadataKey> >::free,
new tr1::shared_ptr<const MetadataKey>(mm));
}
- void visit(const MetadataStringKey &)
+ void visit(const MetadataValueKey<std::string> &)
{
value = Data_Wrap_Struct(c_metadata_string_key, 0, &Common<tr1::shared_ptr<const MetadataKey> >::free,
new tr1::shared_ptr<const MetadataKey>(mm));
}
- void visit(const MetadataSizeKey &)
+ void visit(const MetadataValueKey<long> &)
{
value = Data_Wrap_Struct(c_metadata_size_key, 0, &Common<tr1::shared_ptr<const MetadataKey> >::free,
new tr1::shared_ptr<const MetadataKey>(mm));
@@ -129,13 +129,13 @@ namespace
new tr1::shared_ptr<const MetadataKey>(mm));
}
- void visit(const MetadataContentsKey &)
+ void visit(const MetadataValueKey<tr1::shared_ptr<const Contents> > &)
{
value = Data_Wrap_Struct(c_metadata_contents_key, 0, &Common<tr1::shared_ptr<const MetadataKey> >::free,
new tr1::shared_ptr<const MetadataKey>(mm));
}
- void visit(const MetadataFSEntryKey &)
+ void visit(const MetadataValueKey<FSEntry> &)
{
value = Data_Wrap_Struct(c_metadata_fsentry_key, 0, &Common<tr1::shared_ptr<const MetadataKey> >::free,
new tr1::shared_ptr<const MetadataKey>(mm));
@@ -147,7 +147,7 @@ namespace
new tr1::shared_ptr<const MetadataKey>(mm));
}
- void visit(const MetadataRepositoryMaskInfoKey &)
+ void visit(const MetadataValueKey<tr1::shared_ptr<const RepositoryMaskInfo> > &)
{
value = Data_Wrap_Struct(c_metadata_repository_mask_info_key, 0, &Common<tr1::shared_ptr<const MetadataKey> >::free,
new tr1::shared_ptr<const MetadataKey>(mm));
@@ -253,7 +253,7 @@ namespace
{
tr1::shared_ptr<const MetadataKey> * self_ptr;
Data_Get_Struct(self, tr1::shared_ptr<const MetadataKey>, self_ptr);
- return package_id_to_value((tr1::static_pointer_cast<const MetadataPackageIDKey>(*self_ptr))->value());
+ return package_id_to_value((tr1::static_pointer_cast<const MetadataValueKey<tr1::shared_ptr<const PackageID> > >(*self_ptr))->value());
}
catch (const std::exception & e)
{
@@ -274,7 +274,7 @@ namespace
{
tr1::shared_ptr<const MetadataKey> * self_ptr;
Data_Get_Struct(self, tr1::shared_ptr<const MetadataKey>, self_ptr);
- return rb_str_new2((tr1::static_pointer_cast<const MetadataStringKey>(*self_ptr))->value().c_str());
+ return rb_str_new2((tr1::static_pointer_cast<const MetadataValueKey<std::string> >(*self_ptr))->value().c_str());
}
catch (const std::exception & e)
{
@@ -295,7 +295,7 @@ namespace
{
tr1::shared_ptr<const MetadataKey> * self_ptr;
Data_Get_Struct(self, tr1::shared_ptr<const MetadataKey>, self_ptr);
- return LONG2NUM((tr1::static_pointer_cast<const MetadataSizeKey>(*self_ptr))->value());
+ return LONG2NUM((tr1::static_pointer_cast<const MetadataValueKey<long> >(*self_ptr))->value());
}
catch (const std::exception & e)
{
@@ -316,7 +316,7 @@ namespace
{
tr1::shared_ptr<const MetadataKey> * self_ptr;
Data_Get_Struct(self, tr1::shared_ptr<const MetadataKey>, self_ptr);
- return rb_str_new2(stringify((tr1::static_pointer_cast<const MetadataFSEntryKey>(*self_ptr))->value()).c_str());
+ return rb_str_new2(stringify((tr1::static_pointer_cast<const MetadataValueKey<FSEntry> >(*self_ptr))->value()).c_str());
}
catch (const std::exception & e)
{
@@ -358,8 +358,8 @@ namespace
{
tr1::shared_ptr<const MetadataKey> * self_ptr;
Data_Get_Struct(self, tr1::shared_ptr<const MetadataKey>, self_ptr);
- if (tr1::static_pointer_cast<const MetadataContentsKey>(*self_ptr)->value())
- return contents_to_value(tr1::static_pointer_cast<const MetadataContentsKey>(*self_ptr)->value());
+ if (tr1::static_pointer_cast<const MetadataValueKey<tr1::shared_ptr<const Contents> > >(*self_ptr)->value())
+ return contents_to_value(tr1::static_pointer_cast<const MetadataValueKey<tr1::shared_ptr<const Contents> > >(*self_ptr)->value());
return Qnil;
}
catch (const std::exception & e)
@@ -381,8 +381,8 @@ namespace
{
tr1::shared_ptr<const MetadataKey> * self_ptr;
Data_Get_Struct(self, tr1::shared_ptr<const MetadataKey>, self_ptr);
- if ((tr1::static_pointer_cast<const MetadataRepositoryMaskInfoKey>(*self_ptr))->value())
- return repository_mask_info_to_value(tr1::static_pointer_cast<const MetadataRepositoryMaskInfoKey>(*self_ptr)->value());
+ if ((tr1::static_pointer_cast<const MetadataValueKey<tr1::shared_ptr<const RepositoryMaskInfo> > >(*self_ptr))->value())
+ return repository_mask_info_to_value(tr1::static_pointer_cast<const MetadataValueKey<tr1::shared_ptr<const RepositoryMaskInfo> > >(*self_ptr)->value());
return Qnil;
}
catch (const std::exception & e)
diff --git a/ruby/package_id.cc b/ruby/package_id.cc
index 102a7e0..108fa61 100644
--- a/ruby/package_id.cc
+++ b/ruby/package_id.cc
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2007, 2008 Richard Brown
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -433,7 +433,7 @@ namespace
rb_define_method(c_package_id, "invalidate_masks", RUBY_FUNC_CAST(&package_id_invalidate_masks), 0);
rb_define_method(c_package_id, "breaks_portage?", RUBY_FUNC_CAST((&PackageIDBool<&PackageID::breaks_portage>::fetch)), 0);
- rb_define_method(c_package_id, "virtual_for_key", RUBY_FUNC_CAST((&KeyValue<MetadataPackageIDKey, &PackageID::virtual_for_key>::fetch)), 0);
+ rb_define_method(c_package_id, "virtual_for_key", RUBY_FUNC_CAST((&KeyValue<MetadataValueKey<tr1::shared_ptr<const PackageID> > , &PackageID::virtual_for_key>::fetch)), 0);
rb_define_method(c_package_id, "keywords_key", RUBY_FUNC_CAST((&KeyValue<MetadataCollectionKey<KeywordNameSet>,&PackageID::keywords_key>::fetch)), 0);
rb_define_method(c_package_id, "iuse_key", RUBY_FUNC_CAST((&KeyValue<MetadataCollectionKey<IUseFlagSet>,&PackageID::iuse_key>::fetch)), 0);
rb_define_method(c_package_id, "provide_key", RUBY_FUNC_CAST((
@@ -448,14 +448,19 @@ namespace
&KeyValue<MetadataSpecTreeKey<DependencySpecTree>, &PackageID::suggested_dependencies_key>::fetch)), 0);
rb_define_method(c_package_id, "homepage_key", RUBY_FUNC_CAST((
&KeyValue<MetadataSpecTreeKey<SimpleURISpecTree>, &PackageID::homepage_key>::fetch)), 0);
- rb_define_method(c_package_id, "short_description_key", RUBY_FUNC_CAST((&KeyValue<MetadataStringKey,&PackageID::short_description_key>::fetch)), 0);
- rb_define_method(c_package_id, "long_description_key", RUBY_FUNC_CAST((&KeyValue<MetadataStringKey,&PackageID::long_description_key>::fetch)), 0);
- rb_define_method(c_package_id, "contents_key", RUBY_FUNC_CAST((&KeyValue<MetadataContentsKey,&PackageID::contents_key>::fetch)), 0);
+ rb_define_method(c_package_id, "short_description_key", RUBY_FUNC_CAST((&KeyValue<MetadataValueKey<std::string>,
+ &PackageID::short_description_key>::fetch)), 0);
+ rb_define_method(c_package_id, "long_description_key", RUBY_FUNC_CAST((&KeyValue<MetadataValueKey<std::string>,
+ &PackageID::long_description_key>::fetch)), 0);
+ rb_define_method(c_package_id, "contents_key", RUBY_FUNC_CAST((&KeyValue<MetadataValueKey<tr1::shared_ptr<const Contents> >,
+ &PackageID::contents_key>::fetch)), 0);
rb_define_method(c_package_id, "installed_time_key", RUBY_FUNC_CAST((&KeyValue<MetadataTimeKey,&PackageID::installed_time_key>::fetch)), 0);
- rb_define_method(c_package_id, "source_origin_key", RUBY_FUNC_CAST((&KeyValue<MetadataStringKey,&PackageID::source_origin_key>::fetch)), 0);
- rb_define_method(c_package_id, "binary_origin_key", RUBY_FUNC_CAST((&KeyValue<MetadataStringKey,&PackageID::binary_origin_key>::fetch)), 0);
+ rb_define_method(c_package_id, "source_origin_key", RUBY_FUNC_CAST((&KeyValue<MetadataValueKey<std::string>,
+ &PackageID::source_origin_key>::fetch)), 0);
+ rb_define_method(c_package_id, "binary_origin_key", RUBY_FUNC_CAST((&KeyValue<MetadataValueKey<std::string>,
+ &PackageID::binary_origin_key>::fetch)), 0);
rb_define_method(c_package_id, "fs_location_key", RUBY_FUNC_CAST((
- &KeyValue<MetadataFSEntryKey, &PackageID::fs_location_key>::fetch)), 0);
+ &KeyValue<MetadataValueKey<FSEntry>, &PackageID::fs_location_key>::fetch)), 0);
rb_define_method(c_package_id, "fetches_key", RUBY_FUNC_CAST((
&KeyValue<MetadataSpecTreeKey<FetchableURISpecTree>, &PackageID::fetches_key>::fetch)), 0);
diff --git a/ruby/repository.cc b/ruby/repository.cc
index faf5fe9..4108480 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -963,9 +963,9 @@ namespace
rb_define_method(c_repository, "[]", RUBY_FUNC_CAST(&repository_subscript), 1);
rb_define_method(c_repository, "each_metadata", RUBY_FUNC_CAST(&repository_each_metadata), 0);
rb_define_method(c_repository, "format_key",
- RUBY_FUNC_CAST((&RepositoryKey<MetadataStringKey, &Repository::format_key>::fetch)), 0);
+ RUBY_FUNC_CAST((&RepositoryKey<MetadataValueKey<std::string> , &Repository::format_key>::fetch)), 0);
rb_define_method(c_repository, "installed_root_key",
- RUBY_FUNC_CAST((&RepositoryKey<MetadataFSEntryKey, &Repository::installed_root_key>::fetch)), 0);
+ RUBY_FUNC_CAST((&RepositoryKey<MetadataValueKey<FSEntry>, &Repository::installed_root_key>::fetch)), 0);
rb_define_method(c_repository, "get_environment_variable", RUBY_FUNC_CAST(&repository_get_environment_variable), 2);
/*