diff options
-rw-r--r-- | paludis/files.m4 | 1 | ||||
-rw-r--r-- | paludis/repositories/unavailable/unavailable_id.cc | 5 | ||||
-rw-r--r-- | paludis/repositories/unavailable/unavailable_id.hh | 2 | ||||
-rw-r--r-- | paludis/repositories/unwritten/unwritten_id.cc | 5 | ||||
-rw-r--r-- | paludis/unchoices_key-fwd.hh | 33 | ||||
-rw-r--r-- | paludis/unchoices_key.cc | 62 | ||||
-rw-r--r-- | paludis/unchoices_key.hh | 29 |
7 files changed, 134 insertions, 3 deletions
diff --git a/paludis/files.m4 b/paludis/files.m4 index 7c74524d3..2bc5385d4 100644 --- a/paludis/files.m4 +++ b/paludis/files.m4 @@ -78,6 +78,7 @@ add(`stripper', `hh', `cc', `fwd', `test', `testscript' add(`syncer', `hh', `cc') add(`sync_task', `hh', `cc') add(`tasks_exceptions', `hh', `cc') +add(`unchoices_key', `hh', `cc', `fwd') add(`uninstall_list', `hh', `cc', `se', `sr', `test') add(`uninstall_task', `hh', `cc') add(`unmerger', `hh', `cc') diff --git a/paludis/repositories/unavailable/unavailable_id.cc b/paludis/repositories/unavailable/unavailable_id.cc index e30b39f27..60531e36f 100644 --- a/paludis/repositories/unavailable/unavailable_id.cc +++ b/paludis/repositories/unavailable/unavailable_id.cc @@ -30,6 +30,7 @@ #include <paludis/version_spec.hh> #include <paludis/metadata_key.hh> #include <paludis/action.hh> +#include <paludis/unchoices_key.hh> using namespace paludis; using namespace paludis::unavailable_repository; @@ -47,6 +48,7 @@ namespace paludis const std::tr1::shared_ptr<const MetadataValueKey<std::string> > description_key; const std::tr1::shared_ptr<const MetadataValueKey<std::string> > repository_homepage_key, repository_description_key; const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key; + const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key; const std::tr1::shared_ptr<const Mask> mask; Implementation( @@ -59,6 +61,7 @@ namespace paludis repository_homepage_key(e.repository_homepage()), repository_description_key(e.repository_description()), from_repositories_key(e.from_repositories()), + choices_key(unchoices_key()), mask(e.mask()) { } @@ -295,7 +298,7 @@ UnavailableID::from_repositories_key() const const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > UnavailableID::choices_key() const { - return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >(); + return _imp->choices_key; } template class PrivateImplementationPattern<UnavailableID>; diff --git a/paludis/repositories/unavailable/unavailable_id.hh b/paludis/repositories/unavailable/unavailable_id.hh index a89512c16..a97280a7f 100644 --- a/paludis/repositories/unavailable/unavailable_id.hh +++ b/paludis/repositories/unavailable/unavailable_id.hh @@ -101,7 +101,7 @@ namespace paludis const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > fs_location_key() const; const std::tr1::shared_ptr<const MetadataValueKey<bool> > transient_key() const; const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > from_repositories_key() const; - virtual const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const; + const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key() const; bool supports_action(const SupportsActionTestBase &) const PALUDIS_ATTRIBUTE((warn_unused_result)); diff --git a/paludis/repositories/unwritten/unwritten_id.cc b/paludis/repositories/unwritten/unwritten_id.cc index 109e300ef..253fa4835 100644 --- a/paludis/repositories/unwritten/unwritten_id.cc +++ b/paludis/repositories/unwritten/unwritten_id.cc @@ -30,6 +30,7 @@ #include <paludis/version_spec.hh> #include <paludis/metadata_key.hh> #include <paludis/action.hh> +#include <paludis/unchoices_key.hh> using namespace paludis; using namespace paludis::unwritten_repository; @@ -50,6 +51,7 @@ namespace paludis const std::tr1::shared_ptr<const MetadataSpecTreeKey<SimpleURISpecTree> > homepage_key; const std::tr1::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > bug_ids_key; const std::tr1::shared_ptr<const MetadataCollectionKey<Sequence<std::string> > > remote_ids_key; + const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > choices_key; const std::tr1::shared_ptr<const Mask> mask; Implementation( @@ -64,6 +66,7 @@ namespace paludis homepage_key(e.homepage()), bug_ids_key(e.bug_ids()), remote_ids_key(e.remote_ids()), + choices_key(unchoices_key()), mask(e.mask()) { } @@ -294,7 +297,7 @@ UnwrittenID::from_repositories_key() const const std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > UnwrittenID::choices_key() const { - return std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > >(); + return _imp->choices_key; } template class PrivateImplementationPattern<UnwrittenID>; diff --git a/paludis/unchoices_key-fwd.hh b/paludis/unchoices_key-fwd.hh new file mode 100644 index 000000000..2f1568a66 --- /dev/null +++ b/paludis/unchoices_key-fwd.hh @@ -0,0 +1,33 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 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 + * 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 + */ + +#ifndef PALUDIS_GUARD_PALUDIS_UNCHOICES_KEY_FWD_HH +#define PALUDIS_GUARD_PALUDIS_UNCHOICES_KEY_FWD_HH 1 + +#include <paludis/metadata_key-fwd.hh> +#include <paludis/util/attributes.hh> +#include <paludis/choice-fwd.hh> +#include <tr1/memory> + +namespace paludis +{ + std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > unchoices_key() PALUDIS_VISIBLE; +} + +#endif diff --git a/paludis/unchoices_key.cc b/paludis/unchoices_key.cc new file mode 100644 index 000000000..7039e760c --- /dev/null +++ b/paludis/unchoices_key.cc @@ -0,0 +1,62 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 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 + * 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 <paludis/unchoices_key.hh> +#include <paludis/metadata_key.hh> +#include <paludis/choice.hh> +#include <paludis/util/visitor-impl.hh> +#include <paludis/util/validated.hh> +#include <paludis/util/make_shared_ptr.hh> + +using namespace paludis; + +namespace +{ + class PALUDIS_VISIBLE UnChoicesKey : + public MetadataValueKey<std::tr1::shared_ptr<const Choices> > + { + private: + std::tr1::shared_ptr<Choices> _value; + + public: + UnChoicesKey() : + MetadataValueKey<std::tr1::shared_ptr<const Choices> >("PALUDIS_CHOICES", "Choices", mkt_internal), + _value(new Choices) + { + _value->add(make_shared_ptr(new Choice("Choices", "Choices", ChoicePrefixName(""), true, true, true, false))); + } + + ~UnChoicesKey() + { + } + + const std::tr1::shared_ptr<const Choices> value() const + { + return _value; + } + }; +} + +std::tr1::shared_ptr<const MetadataValueKey<std::tr1::shared_ptr<const Choices> > > +paludis::unchoices_key() +{ + static std::tr1::shared_ptr<const UnChoicesKey> result(new UnChoicesKey); + return result; +} + diff --git a/paludis/unchoices_key.hh b/paludis/unchoices_key.hh new file mode 100644 index 000000000..d2fe97791 --- /dev/null +++ b/paludis/unchoices_key.hh @@ -0,0 +1,29 @@ +/* vim: set sw=4 sts=4 et foldmethod=syntax : */ + +/* + * Copyright (c) 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 + * 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 + */ + +#ifndef PALUDIS_GUARD_PALUDIS_UNCHOICES_KEY_HH +#define PALUDIS_GUARD_PALUDIS_UNCHOICES_KEY_HH 1 + +#include <paludis/unchoices_key-fwd.hh> + +namespace paludis +{ +} + +#endif |