/* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* * Copyright (c) 2007 Piotr JaroszyƄski * * 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 * Public License version 2, as published by the Free Software Foundation. * * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include #include #include #include using namespace paludis; using namespace paludis::python; namespace bp = boost::python; class MetadataKeySptrToPythonVisitor { private: const std::shared_ptr & _m_ptr; public: boost::python::object obj; MetadataKeySptrToPythonVisitor(const std::shared_ptr & m_ptr) : _m_ptr(m_ptr) { } void visit(const MetadataValueKey > &) { obj = bp::object(std::static_pointer_cast > >(_m_ptr)); } void visit(const MetadataValueKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataValueKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataValueKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataValueKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataTimeKey &) { obj = bp::object(std::static_pointer_cast(_m_ptr)); } void visit(const MetadataValueKey > &) { obj = bp::object(std::static_pointer_cast > >(_m_ptr)); } void visit(const MetadataValueKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataCollectionKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataCollectionKey > &) { obj = bp::object(std::static_pointer_cast > >(_m_ptr)); } void visit(const MetadataCollectionKey > &) { obj = bp::object(std::static_pointer_cast > >(_m_ptr)); } void visit(const MetadataCollectionKey > &) { obj = bp::object(std::static_pointer_cast > >(_m_ptr)); } void visit(const MetadataCollectionKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataCollectionKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataSpecTreeKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataSpecTreeKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataSpecTreeKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataSpecTreeKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataSpecTreeKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataSpecTreeKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataCollectionKey &) { obj = bp::object(std::static_pointer_cast >(_m_ptr)); } void visit(const MetadataSectionKey &) { obj = bp::object(std::static_pointer_cast(_m_ptr)); } }; struct MetadataKeySptrToPython { MetadataKeySptrToPython() { bp::to_python_converter, MetadataKeySptrToPython>(); } static PyObject * convert(const std::shared_ptr & m) { MetadataKeySptrToPythonVisitor v(m); m->accept(v); return bp::incref(v.obj.ptr()); } }; struct MetadataPackageIDKeyWrapper : MetadataValueKey > , bp::wrapper > > { virtual const std::shared_ptr 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("MetadataPackageIDKey", "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("MetadataPackageIDKey", "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("MetadataPackageIDKey", "human_name"); } virtual MetadataKeyType type() const { Lock l(get_mutex()); if (bp::override f = get_override("type")) return f(); else throw PythonMethodNotImplemented("MetadataPackageIDKey", "type"); } virtual const std::string pretty_print_value( const PrettyPrinter &, const PrettyPrintOptions &) const { throw PythonMethodNotImplemented("MetadataPackageIDKey", "pretty_print_value"); } }; struct MetadataStringKeyWrapper : MetadataValueKey , bp::wrapper > { virtual const std::string 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("MetadataStringKey", "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("MetadataStringKey", "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("MetadataStringKey", "human_name"); } virtual MetadataKeyType type() const { Lock l(get_mutex()); if (bp::override f = get_override("type")) return f(); else throw PythonMethodNotImplemented("MetadataStringKey", "type"); } }; struct MetadataSlotNameKeyWrapper : MetadataValueKey , bp::wrapper > { virtual const SlotName 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("MetadataSlotNameKey", "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("MetadataSlotNameKey", "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("MetadataSlotNameKey", "human_name"); } virtual MetadataKeyType type() const { Lock l(get_mutex()); if (bp::override f = get_override("type")) return f(); else throw PythonMethodNotImplemented("MetadataSlotNameKey", "type"); } }; struct MetadataSectionKeyWrapper : MetadataSectionKey, bp::wrapper { static PyObject * find_metadata(const MetadataSectionKey & self, const std::string & key) { MetadataSectionKey::MetadataConstIterator i(self.find_metadata(key)); if (i != self.end_metadata()) return bp::incref(bp::object(*i).ptr()); else return Py_None; } virtual void need_keys_added() const { Lock l(get_mutex()); if (bp::override f = get_override("need_keys_added")) f(); else throw PythonMethodNotImplemented("MetadataSectionKey", "need_keys_added"); } virtual const std::shared_ptr > title_key() const { Lock l(get_mutex()); if (bp::override f = get_override("title_key")) return f(); else throw PythonMethodNotImplemented("MetadataSectionKey", "title_key"); } virtual const std::string raw_name() const { Lock l(get_mutex()); if (bp::override f = get_override("raw_name")) return f(); else throw PythonMethodNotImplemented("MetadataSectionKey", "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("MetadataSectionKey", "human_name"); } virtual MetadataKeyType type() const { Lock l(get_mutex()); if (bp::override f = get_override("type")) return f(); else throw PythonMethodNotImplemented("MetadataSectionKey", "type"); } }; struct MetadataTimeKeyWrapper : MetadataTimeKey, bp::wrapper { virtual Timestamp parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); if (bp::override f = get_override("parse_value")) return Timestamp(f(), 0); else throw PythonMethodNotImplemented("MetadataTimeKey", "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("MetadataTimeKey", "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("MetadataTimeKey", "human_name"); } virtual MetadataKeyType type() const { Lock l(get_mutex()); if (bp::override f = get_override("type")) return f(); else throw PythonMethodNotImplemented("MetadataTimeKey", "type"); } }; struct MetadataChoicesKeyWrapper : MetadataValueKey > , bp::wrapper > > { virtual const std::shared_ptr 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("MetadataChoicesKey", "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("MetadataChoicesKey", "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("MetadataChoicesKey", "human_name"); } virtual MetadataKeyType type() const { Lock l(get_mutex()); if (bp::override f = get_override("type")) return f(); else throw PythonMethodNotImplemented("MetadataChoicesKey", "type"); } }; struct MetadataFSPathKeyWrapper : MetadataValueKey , bp::wrapper > { virtual const FSPath 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("MetadataValueKey ", "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("MetadataFSPathKey", "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("MetadataFSPathKey", "human_name"); } virtual MetadataKeyType type() const { Lock l(get_mutex()); if (bp::override f = get_override("type")) return f(); else throw PythonMethodNotImplemented("MetadataFSPathKey", "type"); } }; template struct MetadataCollectionKeyWrapper : MetadataCollectionKey, bp::wrapper > { virtual const std::shared_ptr parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); if (bp::override f = this->get_override("parse_value")) return f(); else throw PythonMethodNotImplemented("MetadataCollectionKey", "parse_value"); } virtual const std::string raw_name() const { Lock l(get_mutex()); if (bp::override f = this->get_override("raw_name")) return f(); else throw PythonMethodNotImplemented("MetadataCollectionKey", "raw_name"); } virtual const std::string human_name() const { Lock l(get_mutex()); if (bp::override f = this->get_override("human_name")) return f(); else throw PythonMethodNotImplemented("MetadataCollectionKey", "human_name"); } virtual MetadataKeyType type() const { Lock l(get_mutex()); if (bp::override f = this->get_override("type")) return f(); else throw PythonMethodNotImplemented("MetadataCollectionKey", "type"); } virtual const std::string pretty_print_value( const PrettyPrinter &, const PrettyPrintOptions &) const { throw PythonMethodNotImplemented("MetadataCollectionKey", "pretty_print_value"); } }; template struct MetadataSpecTreeKeyWrapper : MetadataSpecTreeKey, bp::wrapper > { virtual const std::shared_ptr parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); if (bp::override f = this->get_override("parse_value")) return f(); else throw PythonMethodNotImplemented("MetadataSpecTreeKey", "parse_value"); } virtual const std::string raw_name() const { Lock l(get_mutex()); if (bp::override f = this->get_override("raw_name")) return f(); else throw PythonMethodNotImplemented("MetadataSpecTreeKey", "raw_name"); } virtual const std::string human_name() const { Lock l(get_mutex()); if (bp::override f = this->get_override("human_name")) return f(); else throw PythonMethodNotImplemented("MetadataSpecTreeKey", "human_name"); } virtual MetadataKeyType type() const { Lock l(get_mutex()); if (bp::override f = this->get_override("type")) return f(); else throw PythonMethodNotImplemented("MetadataSpecTreeKey", "type"); } virtual const std::string pretty_print_value( const PrettyPrinter &, const PrettyPrintOptions &) const { throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print_value"); } }; template <> struct MetadataSpecTreeKeyWrapper : MetadataSpecTreeKey, bp::wrapper > { virtual const std::shared_ptr parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); if (bp::override f = this->get_override("parse_value")) return f(); else throw PythonMethodNotImplemented("MetadataSpecTreeKey", "parse_value"); } virtual const std::shared_ptr initial_label() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); if (bp::override f = this->get_override("initial_label")) return f(); else throw PythonMethodNotImplemented("MetadataSpecTreeKey", "initial_label"); } virtual const std::string raw_name() const { Lock l(get_mutex()); if (bp::override f = get_override("raw_name")) return f(); else throw PythonMethodNotImplemented("MetadataSpecTreeKey", "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("MetadataSpecTreeKey", "human_name"); } virtual MetadataKeyType type() const { Lock l(get_mutex()); if (bp::override f = get_override("type")) return f(); else throw PythonMethodNotImplemented("MetadataSpecTreeKey", "type"); } virtual const std::string pretty_print_value( const PrettyPrinter &, const PrettyPrintOptions &) const { throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print_value"); } }; template <> struct MetadataSpecTreeKeyWrapper : MetadataSpecTreeKey, bp::wrapper > { virtual const std::shared_ptr parse_value() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); if (bp::override f = this->get_override("parse_value")) return f(); else throw PythonMethodNotImplemented("MetadataSpecTreeKey", "parse_value"); } virtual const std::shared_ptr initial_labels() const PALUDIS_ATTRIBUTE((warn_unused_result)) { Lock l(get_mutex()); if (bp::override f = this->get_override("initial_labels")) return f(); else throw PythonMethodNotImplemented("MetadataSpecTreeKey", "initial_labels"); } virtual const std::string raw_name() const { Lock l(get_mutex()); if (bp::override f = get_override("raw_name")) return f(); else throw PythonMethodNotImplemented("MetadataSpecTreeKey", "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("MetadataSpecTreeKey", "human_name"); } virtual MetadataKeyType type() const { Lock l(get_mutex()); if (bp::override f = get_override("type")) return f(); else throw PythonMethodNotImplemented("MetadataSpecTreeKey", "type"); } virtual const std::string pretty_print_value( const PrettyPrinter &, const PrettyPrintOptions &) const { throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print_value"); } }; template struct class_set_key : bp::class_, std::shared_ptr >, bp::bases, boost::noncopyable> { class_set_key(const std::string & set, const std::string & cn) : bp::class_, std::shared_ptr >, bp::bases, boost::noncopyable>( ("Metadata" + cn + "Key").c_str(), "A MetadataCollectionKey is a MetadataKey that holds a Set or Sequence of some kind of item\n" "as its value.\n\n" "This class can be subclassed in Python.", bp::init<>( "__init__()" ) ) { bp::register_ptr_to_python > >(); bp::implicitly_convertible >, std::shared_ptr >(); def("parse_value", bp::pure_virtual(&MetadataCollectionKey::parse_value), ("parse_value() -> " + set + "\n" "Fetch our value.").c_str() ); } }; template struct class_spec_tree_key : bp::class_, std::shared_ptr >, bp::bases, boost::noncopyable> { class_spec_tree_key(const std::string & spec_tree) : bp::class_, std::shared_ptr >, bp::bases, boost::noncopyable>( ("Metadata" + spec_tree + "Key").c_str(), "A MetadataSpecTreeKey is a MetadataKey that holds a spec tree of some\n" "kind as its value.\n\n" "This class can be subclassed in Python.", bp::init<>( "__init__()" ) ) { bp::register_ptr_to_python > >(); bp::implicitly_convertible >, std::shared_ptr >(); def("parse_value", bp::pure_virtual(&MetadataSpecTreeKey::parse_value), ("parse_value() -> " + spec_tree + "\n" "Fetch our value").c_str() ); } }; template <> struct class_spec_tree_key : bp::class_, std::shared_ptr >, bp::bases, boost::noncopyable> { class_spec_tree_key(const std::string & spec_tree) : bp::class_, std::shared_ptr >, bp::bases, boost::noncopyable>( ("Metadata" + spec_tree + "Key").c_str(), "A MetadataSpecTreeKey is a MetadataKey that holds a spec tree of some\n" "kind as its value.\n\n" "This class can be subclassed in Python.", bp::init<>( "__init__()" ) ) { bp::register_ptr_to_python > >(); bp::implicitly_convertible >, std::shared_ptr >(); def("parse_value", bp::pure_virtual(&MetadataSpecTreeKey::parse_value), ("parse_value() -> " + spec_tree + "\n" "Fetch our value").c_str() ); def("initial_label", bp::pure_virtual(&MetadataSpecTreeKey::initial_label), "initial_label() -> URILabel\n" "Return a URILabel that represents the initial label to use when\n" "deciding the behaviour of individual items in the heirarchy." ); } }; template <> struct class_spec_tree_key : bp::class_, std::shared_ptr >, bp::bases, boost::noncopyable> { class_spec_tree_key(const std::string & spec_tree) : bp::class_, std::shared_ptr >, bp::bases, boost::noncopyable>( ("Metadata" + spec_tree + "Key").c_str(), "A MetadataSpecTreeKey is a MetadataKey that holds a spec tree of some\n" "kind as its value.\n\n" "This class can be subclassed in Python.", bp::init<>( "__init__()" ) ) { bp::register_ptr_to_python > >(); bp::implicitly_convertible >, std::shared_ptr >(); def("parse_value", bp::pure_virtual(&MetadataSpecTreeKey::parse_value), ("parse_value() -> " + spec_tree + "\n" "Fetch our value").c_str() ); def("initial_labels", bp::pure_virtual(&MetadataSpecTreeKey::initial_labels), "initial_label() -> DependenciesLabelSequence\n" "Return a DependenciesLabelSequence that represents the initial labels to use when\n" "deciding the behaviour of individual items in the heirarchy." ); } }; void expose_metadata_key() { /** * Enums */ enum_auto("MetadataKeyType", last_mkt, "The significance of a MetadataKey to a user."); /** * MetadataKey */ MetadataKeySptrToPython(); register_shared_ptrs_to_python(rsp_non_const); bp::class_ ( "MetadataKey", "A MetadataKey is a generic key that contains a particular piece of\n" "information about a PackageID instance.\n\n" "A basic MetadataKey has:\n\n" "- A raw name. This is in a repository-defined format designed to closely\n" " represent the internal name. For example, ebuilds and VDB IDs use\n" " raw names like 'DESCRIPTION' and 'KEYWORDS', whereas CRAN uses names\n" " like 'Title' and 'BundleDescription'. The raw name is unique in a\n" " PackageID.\n\n" "- A human name. This is the name that should be used when outputting\n" " normally for a human to read.\n\n" "- A MetadataKeyType. This is a hint to clients as to whether the key\n" " should be displayed when outputting information about a package ID.\n\n" "Subclasses provide additional information, including the 'value' of the\n" "key.", bp::no_init ) .def("raw_name", bp::pure_virtual(&MetadataKey::raw_name), "raw_name() -> string\n" "Fetch our raw name." ) .def("human_name", bp::pure_virtual(&MetadataKey::human_name), "human_name() -> string\n" "Fetch our human name." ) .def("type", bp::pure_virtual(&MetadataKey::type), "type() -> MetadataKeyType\n" "Fetch our key type." ) ; /** * MetadataPackageIDKey */ bp::register_ptr_to_python > > >(); bp::implicitly_convertible, std::shared_ptr >(); bp::class_, bp::bases, boost::noncopyable> ( "MetadataPackageIDKey", "A MetadataPackageIDKey is a MetadataKey that has a PackageID as its\n" "value.\n\n" "This class can be subclassed in Python.", bp::init<>( "__init__()" ) ) .def("parse_value", bp::pure_virtual(&MetadataValueKey > ::parse_value), "parse_value() -> PackageID\n" "Fetch our value." ) ; /** * MetadataStringKey */ bp::register_ptr_to_python > >(); bp::implicitly_convertible, std::shared_ptr >(); bp::class_, bp::bases, boost::noncopyable> ( "MetadataStringKey", "A MetadataStringKey is a MetadataKey that has a std::string as its\n" "value.\n\n" "This class can be subclassed in Python.", bp::init<>( "__init__()" ) ) .def("parse_value", bp::pure_virtual(&MetadataValueKey ::parse_value), "parse_value() -> string\n" "Fetch our value." ) ; /** * MetadataSlotNameKey */ bp::register_ptr_to_python > >(); bp::implicitly_convertible, std::shared_ptr >(); bp::class_, bp::bases, boost::noncopyable> ( "MetadataSlotNameKey", "A MetadataStringKey is a MetadataKey that has a SlotName as its\n" "value.\n\n" "This class can be subclassed in Python.", bp::init<>( "__init__()" ) ) .def("parse_value", bp::pure_virtual(&MetadataValueKey ::parse_value), "parse_value() -> SlotName\n" "Fetch our value." ) ; /** * MetadataSectionKey */ bp::register_ptr_to_python >(); bp::implicitly_convertible, std::shared_ptr >(); bp::class_, bp::bases, boost::noncopyable> ( "MetadataSectionKey", "A MetadataSectionKey holds a number of other MetadataKey instances, and\n" "may have a title.\n\n" "This class can be subclassed in Python.", bp::init<>( "__init__()" ) ) .add_property("metadata", bp::range(&MetadataSectionKey::begin_metadata, &MetadataSectionKey::end_metadata), "[ro] Iterable of MetadataKey\n" "NEED_DOC" ) .def("find_metadata", &MetadataSectionKeyWrapper::find_metadata, "find_metadata(string) -> MetadataKey\n" "NEED_DOC" ) ; /** * MetadataTimeKey */ bp::register_ptr_to_python >(); bp::implicitly_convertible, std::shared_ptr >(); bp::class_, bp::bases, boost::noncopyable> ( "MetadataTimeKey", "A MetadataTimeKey is a MetadataKey that has a int(time_t) as its value.\n\n" "This class can be subclassed in Python.", bp::init<>( "__init__()" ) ) .def("parse_value", bp::pure_virtual(&MetadataTimeKey::parse_value), "parse_value() -> int\n" "Fetch our value." ) ; /** * MetadataFSPathKey */ bp::register_ptr_to_python > >(); bp::implicitly_convertible, std::shared_ptr >(); bp::class_, bp::bases, boost::noncopyable> ( "MetadataFSPathKey", "A MetadataFSPathKey is a MetadataKey that has an string(FSPath) as its value.\n\n" "This class can be subclassed in Python.", bp::init<>( "__init__()" ) ) .def("parse_value", bp::pure_virtual(&MetadataValueKey ::parse_value), "parse_value() -> FSPath\n" "Fetch our value." ) ; /** * MetadataChoicesKey */ bp::register_ptr_to_python > > >(); bp::implicitly_convertible, std::shared_ptr >(); bp::class_, bp::bases, boost::noncopyable> ( "MetadataChoicesKey", "A MetadataChoicesKey is a MetadataKey that holds a Choices heirarchy.\n\n" "This class can be subclassed in Python.", bp::init<>( "__init__()" ) ) .def("parse_value", bp::pure_virtual(&MetadataValueKey > ::parse_value), "parse_value() -> Choices\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." ) ; /** * MetadataCollectionKeys */ class_set_key("KeywordNameIterable", "KeywordNameIterable"); class_set_key >("StringIterable", "StringIterable"); class_set_key >("StringIterable", "StringSequence"); class_set_key("FSPathIterable", "FSPathIterable"); class_set_key("PackageIDIterable", "PackageIDIterable"); class_set_key("MaintainerIterable", "MaintainerIterable"); /** * MetadataSpecTreeKeys */ class_spec_tree_key("LicenseSpecTree"); class_spec_tree_key("DependencySpecTree"); class_spec_tree_key("PlainTextSpecTree"); class_spec_tree_key("RequiredUseSpecTree"); class_spec_tree_key("SimpleURISpecTree"); class_spec_tree_key("FetchableURISpecTree"); /** * Maintainers */ class_iterable ( "MaintainerIterable", "Iterable of Maintainer", true ); /** * Maintainer */ bp::class_ maintainer( "Maintainer", "Represents a package maintainer", bp::no_init ); maintainer .add_property("author", &named_values_getter, "[ro] String\n" ) .add_property("description", &named_values_getter, "[ro] String\n" ) .add_property("email", &named_values_getter, "[ro] String\n" ) ; }