diff options
author | 2011-09-04 23:30:07 +0100 | |
---|---|---|
committer | 2011-09-04 23:30:07 +0100 | |
commit | 27d57d9ed2f2a24a86b91029638563cd8ccfabab (patch) | |
tree | cc8bd72c1be1741d3206735ca591bffac9c49d75 | |
parent | b5280212886a3a31703600c12608c5a5a8be5555 (diff) | |
download | paludis-27d57d9ed2f2a24a86b91029638563cd8ccfabab.tar.gz paludis-27d57d9ed2f2a24a86b91029638563cd8ccfabab.tar.xz |
Contents is not a MetadataKey
-rw-r--r-- | doc/api/cplusplus/examples/example_metadata_key.cc | 9 | ||||
-rw-r--r-- | paludis/metadata_key.cc | 1 | ||||
-rw-r--r-- | paludis/metadata_key.hh | 2 | ||||
-rw-r--r-- | paludis/user_dep_spec.cc | 18 | ||||
-rw-r--r-- | python/metadata_key.cc | 92 | ||||
-rw-r--r-- | ruby/metadata_key.cc | 40 | ||||
-rw-r--r-- | ruby/package_id_TEST.rb | 3 | ||||
-rwxr-xr-x | src/clients/cave/cmd_display_resolution.cc | 5 | ||||
-rw-r--r-- | src/clients/cave/cmd_info.cc | 4 | ||||
-rw-r--r-- | src/clients/cave/cmd_match.cc | 4 | ||||
-rw-r--r-- | src/clients/cave/cmd_show.cc | 35 | ||||
-rw-r--r-- | src/clients/cave/format_plain_metadata_key.cc | 5 |
12 files changed, 2 insertions, 216 deletions
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc index 02f4b3272..fffa6ea13 100644 --- a/doc/api/cplusplus/examples/example_metadata_key.cc +++ b/doc/api/cplusplus/examples/example_metadata_key.cc @@ -100,15 +100,6 @@ namespace cout << indent << left << setw(30) << " Value:" << " " << pretty_print_time(key.parse_value().seconds()) << endl; } - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > &) - { - cout << indent << left << setw(30) << " Class:" << " " << - "MetadataValueKey<std::shared_ptr<const Contents> > " << endl; - /* We won't display the contents of the contents key here, since - * it involves creating another visitor. See \ref - * example_contents.cc "example_contents.cc" for that. */ - } - void visit(const MetadataValueKey<std::shared_ptr<const Choices> > &) { cout << indent << left << setw(30) << " Class:" << " " << diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc index 299e54ecc..2f009e549 100644 --- a/paludis/metadata_key.cc +++ b/paludis/metadata_key.cc @@ -91,6 +91,5 @@ namespace paludis template class MetadataValueKey<FSPath>; template class MetadataValueKey<SlotName>; template class MetadataValueKey<std::shared_ptr<const PackageID> >; - template class MetadataValueKey<std::shared_ptr<const Contents> >; template class MetadataValueKey<std::shared_ptr<const Choices> >; } diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh index 396edcb14..ad7794288 100644 --- a/paludis/metadata_key.hh +++ b/paludis/metadata_key.hh @@ -26,7 +26,6 @@ #include <paludis/name-fwd.hh> #include <paludis/dep_spec-fwd.hh> #include <paludis/spec_tree.hh> -#include <paludis/contents-fwd.hh> #include <paludis/repository-fwd.hh> #include <paludis/metadata_key_holder.hh> #include <paludis/choice-fwd.hh> @@ -104,7 +103,6 @@ namespace paludis MetadataValueKey<FSPath>, MetadataValueKey<SlotName>, MetadataValueKey<std::shared_ptr<const PackageID> >, - MetadataValueKey<std::shared_ptr<const Contents> >, MetadataValueKey<std::shared_ptr<const Choices> >, MetadataTimeKey, MetadataSectionKey diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc index 7c336f686..6d8400514 100644 --- a/paludis/user_dep_spec.cc +++ b/paludis/user_dep_spec.cc @@ -643,24 +643,6 @@ namespace return false; } - bool visit(const MetadataValueKey<std::shared_ptr<const Contents> > & s) const - { - auto v(s.parse_value()); - switch (op) - { - case '=': - return pattern == join(indirect_iterator(v->begin()), indirect_iterator(v->end()), " ", - stringify_contents_entry); - case '<': - return indirect_iterator(v->end()) != std::find_if( - indirect_iterator(v->begin()), - indirect_iterator(v->end()), - StringifyEqual(pattern)); - } - - return false; - } - bool visit(const MetadataValueKey<std::shared_ptr<const PackageID> > & k) const { return pattern == stringify(*k.parse_value()); diff --git a/python/metadata_key.cc b/python/metadata_key.cc index 4b362836c..a41f1f65b 100644 --- a/python/metadata_key.cc +++ b/python/metadata_key.cc @@ -75,11 +75,6 @@ class MetadataKeySptrToPythonVisitor obj = bp::object(std::static_pointer_cast<const MetadataTimeKey>(_m_ptr)); } - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > & k) - { - obj = bp::object(std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const Contents> > >(_m_ptr)); - } - void visit(const MetadataValueKey<std::shared_ptr<const Choices> > & k) { obj = bp::object(std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const Choices> > >(_m_ptr)); @@ -428,52 +423,6 @@ struct MetadataTimeKeyWrapper : } }; -struct MetadataContentsKeyWrapper : - MetadataValueKey<std::shared_ptr<const Contents> > , - bp::wrapper<MetadataValueKey<std::shared_ptr<const Contents> > > -{ - virtual const std::shared_ptr<const Contents> parse_value() const - PALUDIS_ATTRIBUTE((warn_unused_result)) - { - Lock l(get_mutex()); - - if (bp::override f = get_override("parse_value")) - return f(); - else - throw PythonMethodNotImplemented("MetadataContentsKey", "parse_value"); - } - - virtual const std::string raw_name() const - { - Lock l(get_mutex()); - - if (bp::override f = get_override("raw_name")) - return f(); - else - throw PythonMethodNotImplemented("MetadataContentsKey", "raw_name"); - } - - virtual const std::string human_name() const - { - Lock l(get_mutex()); - - if (bp::override f = get_override("human_name")) - return f(); - else - throw PythonMethodNotImplemented("MetadataContentsKey", "human_name"); - } - - virtual MetadataKeyType type() const - { - Lock l(get_mutex()); - - if (bp::override f = get_override("type")) - return f(); - else - throw PythonMethodNotImplemented("MetadataContentsKey", "type"); - } -}; - struct MetadataChoicesKeyWrapper : MetadataValueKey<std::shared_ptr<const Choices> > , bp::wrapper<MetadataValueKey<std::shared_ptr<const Choices> > > @@ -1137,47 +1086,6 @@ void expose_metadata_key() ; /** - * MetadataContentsKey - */ - bp::register_ptr_to_python<std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Contents> > > >(); - bp::implicitly_convertible<std::shared_ptr<MetadataContentsKeyWrapper>, - std::shared_ptr<MetadataKey> >(); - bp::class_<MetadataContentsKeyWrapper, std::shared_ptr<MetadataContentsKeyWrapper>, - bp::bases<MetadataKey>, boost::noncopyable> - ( - "MetadataContentsKey", - "A MetadataContentsKey is a MetadataKey that holds a Contents heirarchy.\n\n" - - "This class can be subclassed in Python.", - bp::init<>( - "__init__()" - ) - ) - .def("parse_value", bp::pure_virtual(&MetadataValueKey<std::shared_ptr<const Contents> > ::parse_value), - "parse_value() -> Contents\n" - "Fetch our value." - ) - - //Work around epydoc bug - .def("raw_name", bp::pure_virtual(&MetadataKey::raw_name), - "raw_name() -> string\n" - "Fetch our raw name." - ) - - //Work around epydoc bug - .def("human_name", bp::pure_virtual(&MetadataKey::human_name), - "human_name() -> string\n" - "Fetch our human name." - ) - - //Work around epydoc bug - .def("type", bp::pure_virtual(&MetadataKey::type), - "type() -> MetadataKeyType\n" - "Fetch our key type." - ) - ; - - /** * MetadataChoicesKey */ bp::register_ptr_to_python<std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Choices> > > >(); diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc index 3ae309715..b2bc74089 100644 --- a/ruby/metadata_key.cc +++ b/ruby/metadata_key.cc @@ -40,7 +40,6 @@ namespace static VALUE c_metadata_slot_key; static VALUE c_metadata_size_key; static VALUE c_metadata_time_key; - static VALUE c_metadata_contents_key; static VALUE c_metadata_choices_key; static VALUE c_metadata_keyword_name_set_key; static VALUE c_metadata_string_set_key; @@ -139,12 +138,6 @@ namespace new std::shared_ptr<const MetadataKey>(mm)); } - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > &) - { - value = Data_Wrap_Struct(c_metadata_contents_key, 0, &Common<std::shared_ptr<const MetadataKey> >::free, - new std::shared_ptr<const MetadataKey>(mm)); - } - void visit(const MetadataValueKey<std::shared_ptr<const Choices> > &) { value = Data_Wrap_Struct(c_metadata_choices_key, 0, &Common<std::shared_ptr<const MetadataKey> >::free, @@ -378,29 +371,6 @@ namespace /* * call-seq: - * parse_value -> Contents - * - * Our Value. - * */ - VALUE - metadata_contents_key_value(VALUE self) - { - try - { - std::shared_ptr<const MetadataKey> * self_ptr; - Data_Get_Struct(self, std::shared_ptr<const MetadataKey>, self_ptr); - if (std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const Contents> > >(*self_ptr)->parse_value()) - return contents_to_value(std::static_pointer_cast<const MetadataValueKey<std::shared_ptr<const Contents> > >(*self_ptr)->parse_value()); - return Qnil; - } - catch (const std::exception & e) - { - exception_to_ruby_exception(e); - } - } - - /* - * call-seq: * parse_value -> Choices * * Our Value. @@ -689,17 +659,9 @@ namespace rb_define_method(c_metadata_time_key, "parse_value", RUBY_FUNC_CAST(&metadata_time_key_value), 0); /* - * Document-class: Paludis::MetadataContentsKey - * - * Metadata class for Contents. - */ - c_metadata_contents_key = rb_define_class_under(paludis_module(), "MetadataContentsKey", c_metadata_key); - rb_define_method(c_metadata_contents_key, "parse_value", RUBY_FUNC_CAST(&metadata_contents_key_value), 0); - - /* * Document-class: Paludis::MetadataChoicesKey * - * Metadata class for Contents. + * Metadata class for Choices. */ c_metadata_choices_key = rb_define_class_under(paludis_module(), "MetadataChoicesKey", c_metadata_key); rb_define_method(c_metadata_choices_key, "parse_value", RUBY_FUNC_CAST(&metadata_choices_key_value), 0); diff --git a/ruby/package_id_TEST.rb b/ruby/package_id_TEST.rb index cdd0c5907..2ef7ab625 100644 --- a/ruby/package_id_TEST.rb +++ b/ruby/package_id_TEST.rb @@ -51,8 +51,7 @@ module Paludis include TestStuff def classes - [MetadataStringKey, MetadataContentsKey, MetadataTimeKey, MetadataKeywordNameSetKey, - MetadataStringSetKey] + [MetadataStringKey, MetadataTimeKey, MetadataKeywordNameSetKey, MetadataStringSetKey] end def all_classes diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc index 0aa4f7aa2..04fece641 100755 --- a/src/clients/cave/cmd_display_resolution.cc +++ b/src/clients/cave/cmd_display_resolution.cc @@ -928,11 +928,6 @@ namespace cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(pretty_print_time(k.parse_value().seconds()))); } - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > & k) - { - cout << fuc(fs_mask_by_valueless(), fv<'i'>(indent), fv<'k'>(k.human_name())); - } - void visit(const MetadataValueKey<FSPath> & k) { cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.parse_value()))); diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc index 94018510c..ad0e698ad 100644 --- a/src/clients/cave/cmd_info.cc +++ b/src/clients/cave/cmd_info.cc @@ -270,10 +270,6 @@ namespace cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(stringify(*k.parse_value()))); } - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > &) - { - } - void visit(const MetadataValueKey<std::shared_ptr<const Choices> > &) { } diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc index d39d83562..88b01ab04 100644 --- a/src/clients/cave/cmd_match.cc +++ b/src/clients/cave/cmd_match.cc @@ -282,10 +282,6 @@ namespace texts.push_back(stringify((*i)->name_with_prefix())); } - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > &) - { - } - void visit(const MetadataTimeKey & k) { texts.push_back(stringify(k.parse_value().seconds())); diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc index 22a2368f2..a78d9fbee 100644 --- a/src/clients/cave/cmd_show.cc +++ b/src/clients/cave/cmd_show.cc @@ -745,41 +745,6 @@ namespace ); } - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > & k) - { - auto v(k.parse_value()); - if (cmdline.a_complex_keys.specified() || important) - { - if (cmdline.a_flat.specified()) - { - ContentsDisplayer d(0); - std::for_each(indirect_iterator(v->begin()), indirect_iterator(v->end()), accept_visitor(d)); - out << fuc( - (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), - fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), - fv<'v'>(d.s.str()), - fv<'i'>(std::string(indent, ' ')), - fv<'b'>(important ? "true" : ""), - fv<'p'>("") - ); - } - else - { - ContentsDisplayer d(indent); - std::for_each(indirect_iterator(v->begin()), indirect_iterator(v->end()), accept_visitor(d)); - out << fuc( - (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()), - fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()), - fv<'v'>(""), - fv<'i'>(std::string(indent, ' ')), - fv<'b'>(important ? "true" : ""), - fv<'p'>("") - ); - out << d.s.str(); - } - } - } - void visit(const MetadataValueKey<std::shared_ptr<const Choices> > & k) { auto choices(k.parse_value()); diff --git a/src/clients/cave/format_plain_metadata_key.cc b/src/clients/cave/format_plain_metadata_key.cc index 528c00caa..a2699d697 100644 --- a/src/clients/cave/format_plain_metadata_key.cc +++ b/src/clients/cave/format_plain_metadata_key.cc @@ -45,11 +45,6 @@ namespace s << k.parse_value().seconds(); } - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > &) - { - s << "<unprintable>"; - } - void visit(const MetadataValueKey<std::shared_ptr<const Choices> > &) { s << "<unprintable>"; |