diff options
author | 2010-12-28 22:19:20 +0000 | |
---|---|---|
committer | 2011-01-01 03:57:52 +0000 | |
commit | 92f0a95d1854442e744f707eaae9add7fd92ff67 (patch) | |
tree | 9d403328a07f89c1598b4d3cb0079b292d82729e /src/clients/inquisitio | |
parent | 092228a814cd6700b97112b5dcf931c80b6b9431 (diff) | |
download | paludis-92f0a95d1854442e744f707eaae9add7fd92ff67.tar.gz paludis-92f0a95d1854442e744f707eaae9add7fd92ff67.tar.xz |
Pass env, id to ConditionalDepSpec members
Diffstat (limited to 'src/clients/inquisitio')
-rw-r--r-- | src/clients/inquisitio/do_search.cc | 22 | ||||
-rw-r--r-- | src/clients/inquisitio/extractor.hh | 3 | ||||
-rw-r--r-- | src/clients/inquisitio/key_extractor.cc | 16 | ||||
-rw-r--r-- | src/clients/inquisitio/key_extractor.hh | 4 | ||||
-rw-r--r-- | src/clients/inquisitio/name_description_extractor.cc | 14 | ||||
-rw-r--r-- | src/clients/inquisitio/name_description_extractor.hh | 4 |
6 files changed, 32 insertions, 31 deletions
diff --git a/src/clients/inquisitio/do_search.cc b/src/clients/inquisitio/do_search.cc index 996e7e500..f140ddb15 100644 --- a/src/clients/inquisitio/do_search.cc +++ b/src/clients/inquisitio/do_search.cc @@ -187,17 +187,17 @@ namespace throw InternalError(PALUDIS_HERE, "Bad --kind '" + k + "'"); } - bool operator() (const PackageID & id) const + bool operator() (const std::shared_ptr<const PackageID> & id) const { - auto repo(env->package_database()->fetch_repository(id.repository_name())); + auto repo(env->package_database()->fetch_repository(id->repository_name())); if ((! installed) && repo->installed_root_key()) return false; - if ((! installable) && id.supports_action(SupportsActionTest<InstallAction>())) + if ((! installable) && id->supports_action(SupportsActionTest<InstallAction>())) return false; if (visible_only) - return ! id.masked(); + return ! id->masked(); else return true; } @@ -218,7 +218,7 @@ namespace { } - bool operator() (const PackageID & id) const + bool operator() (const std::shared_ptr<const PackageID> & id) const { for (std::list<std::shared_ptr<Extractor> >::const_iterator e(extractors.begin()), e_end(extractors.end()) ; e != e_end ; ++e) @@ -235,8 +235,8 @@ namespace const Environment & env, const std::shared_ptr<const Repository> & r, const QualifiedPackageName & q, - const std::function<bool (const PackageID &)> & e, - const std::function<bool (const PackageID &)> & m, + const std::function<bool (const std::shared_ptr<const PackageID> &)> & e, + const std::function<bool (const std::shared_ptr<const PackageID> &)> & m, const bool all_versions, const bool invert_match, const DisplayCallback & display_callback) @@ -256,9 +256,9 @@ namespace try { display_callback.visit(Searched()); - if (e(**i)) + if (e(*i)) { - if (invert_match ^ m(**i)) + if (invert_match ^ m(*i)) return *i; else { @@ -289,8 +289,8 @@ namespace const Environment & env, const std::list<std::shared_ptr<const Repository> > & repos, std::pair<const QualifiedPackageName, std::shared_ptr<const PackageID> > & q, - const std::function<bool (const PackageID &)> & e, - const std::function<bool (const PackageID &)> & m, + const std::function<bool (const std::shared_ptr<const PackageID> &)> & e, + const std::function<bool (const std::shared_ptr<const PackageID> &)> & m, const bool all_versions, const bool invert_match, const DisplayCallback & display_callback) diff --git a/src/clients/inquisitio/extractor.hh b/src/clients/inquisitio/extractor.hh index 7264784a3..6b139c5d4 100644 --- a/src/clients/inquisitio/extractor.hh +++ b/src/clients/inquisitio/extractor.hh @@ -21,6 +21,7 @@ #define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_EXTRACTOR_HH 1 #include <string> +#include <memory> #include <paludis/package_id-fwd.hh> namespace inquisitio @@ -35,7 +36,7 @@ namespace inquisitio public: virtual ~Extractor(); - virtual bool operator() (const Matcher &, const paludis::PackageID &) const = 0; + virtual bool operator() (const Matcher &, const std::shared_ptr<const paludis::PackageID> &) const = 0; }; } diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc index 7ed90b4ce..ff5c597d0 100644 --- a/src/clients/inquisitio/key_extractor.cc +++ b/src/clients/inquisitio/key_extractor.cc @@ -77,14 +77,14 @@ namespace const std::string _key; const bool _visible_only; const Environment & _env; - const PackageID & _id; + const std::shared_ptr<const PackageID> _id; const Matcher & _m; public: bool result; TreeVisitor(const std::string & k, const bool v, const Environment & e, - const PackageID & i, const Matcher & m) : + const std::shared_ptr<const PackageID> & i, const Matcher & m) : _key(k), _visible_only(v), _env(e), @@ -119,7 +119,7 @@ namespace { if (! _visible_only) std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - else if (node.spec()->condition_met()) + else if (node.spec()->condition_met(&_env, _id)) std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); } } @@ -201,14 +201,14 @@ namespace const bool _flatten; const bool _visible_only; const Environment & _env; - const PackageID & _id; + const std::shared_ptr<const PackageID> _id; const Matcher & _m; public: bool result; KeyVisitor(const std::string & k, const bool f, const bool v, const Environment & e, - const PackageID & i, const Matcher & m) : + const std::shared_ptr<const PackageID> & i, const Matcher & m) : _key(k), _flatten(f), _visible_only(v), @@ -485,10 +485,10 @@ namespace } bool -KeyExtractor::operator() (const Matcher & m, const PackageID & id) const +KeyExtractor::operator() (const Matcher & m, const std::shared_ptr<const PackageID> & id) const { - PackageID::MetadataConstIterator mi(id.find_metadata(_imp->key)); - if (id.end_metadata() == mi) + PackageID::MetadataConstIterator mi(id->find_metadata(_imp->key)); + if (id->end_metadata() == mi) return false; KeyVisitor v(_imp->key, _imp->flatten, _imp->visible_only, _imp->env, id, m); diff --git a/src/clients/inquisitio/key_extractor.hh b/src/clients/inquisitio/key_extractor.hh index 0c7522030..d9aa9377c 100644 --- a/src/clients/inquisitio/key_extractor.hh +++ b/src/clients/inquisitio/key_extractor.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007 Ciaran McCreesh + * Copyright (c) 2007, 2010 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 @@ -35,7 +35,7 @@ namespace inquisitio const paludis::Environment &); ~KeyExtractor(); - bool operator() (const Matcher &, const paludis::PackageID &) const; + bool operator() (const Matcher &, const std::shared_ptr<const paludis::PackageID> &) const; }; } diff --git a/src/clients/inquisitio/name_description_extractor.cc b/src/clients/inquisitio/name_description_extractor.cc index 88defada0..3772ccbdc 100644 --- a/src/clients/inquisitio/name_description_extractor.cc +++ b/src/clients/inquisitio/name_description_extractor.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007 Ciaran McCreesh + * Copyright (c) 2007, 2010 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 @@ -36,17 +36,17 @@ NameDescriptionExtractor::~NameDescriptionExtractor() } bool -NameDescriptionExtractor::operator() (const Matcher & m, const PackageID & id) const +NameDescriptionExtractor::operator() (const Matcher & m, const std::shared_ptr<const PackageID> & id) const { - if (m(stringify(id.name()))) + if (m(stringify(id->name()))) return true; - if (id.short_description_key()) - if (m(id.short_description_key()->value())) + if (id->short_description_key()) + if (m(id->short_description_key()->value())) return true; - if (id.long_description_key()) - if (m(id.long_description_key()->value())) + if (id->long_description_key()) + if (m(id->long_description_key()->value())) return true; return false; diff --git a/src/clients/inquisitio/name_description_extractor.hh b/src/clients/inquisitio/name_description_extractor.hh index ee005bec6..b6f8c8a3b 100644 --- a/src/clients/inquisitio/name_description_extractor.hh +++ b/src/clients/inquisitio/name_description_extractor.hh @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007 Ciaran McCreesh + * Copyright (c) 2007, 2010 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 @@ -31,7 +31,7 @@ namespace inquisitio NameDescriptionExtractor(); ~NameDescriptionExtractor(); - bool operator() (const Matcher &, const paludis::PackageID &) const; + bool operator() (const Matcher &, const std::shared_ptr<const paludis::PackageID> &) const; }; } |