aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-02-05 12:58:56 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-02-05 12:58:56 +0000
commit8122449d5360fa0f07f18d69adcd21c4877e1899 (patch)
tree9d510ee857dfa52070615be58cd9ab1a7c540675
parent192ffbc8a58d7de78e936dc19ae63b84da868cb3 (diff)
downloadpaludis-8122449d5360fa0f07f18d69adcd21c4877e1899.tar.gz
paludis-8122449d5360fa0f07f18d69adcd21c4877e1899.tar.xz
Let FakePackageIDs be transient
-rw-r--r--paludis/repositories/fake/fake_package_id.cc95
-rw-r--r--paludis/repositories/fake/fake_package_id.hh28
2 files changed, 121 insertions, 2 deletions
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index e2e5a67..6156deb 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -55,6 +55,84 @@ namespace paludis
template <>
#endif
template <typename C_>
+ struct Implementation<FakeMetadataValueKey<C_> >
+ {
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+ C_ value;
+
+ Implementation(const std::string & r, const std::string & h, const MetadataKeyType t, const C_ & c) :
+ raw_name(r),
+ human_name(h),
+ type(t),
+ value(c)
+ {
+ }
+ };
+}
+
+template <typename C_>
+FakeMetadataValueKey<C_>::FakeMetadataValueKey(
+ const std::string & r, const std::string & h, const MetadataKeyType t, const C_ & c) :
+ PrivateImplementationPattern<FakeMetadataValueKey<C_> >(new Implementation<FakeMetadataValueKey<C_> >(r, h, t, c)),
+ _imp(PrivateImplementationPattern<FakeMetadataValueKey<C_> >::_imp)
+{
+}
+
+template <typename C_>
+FakeMetadataValueKey<C_>::~FakeMetadataValueKey()
+{
+}
+
+template <typename C_>
+const C_
+FakeMetadataValueKey<C_>::value() const
+{
+ return this->_imp->value;
+}
+
+template <typename C_>
+const std::string
+FakeMetadataValueKey<C_>::raw_name() const
+{
+ return this->_imp->raw_name;
+}
+
+template <typename C_>
+const std::string
+FakeMetadataValueKey<C_>::human_name() const
+{
+ return this->_imp->human_name;
+}
+
+template <typename C_>
+MetadataKeyType
+FakeMetadataValueKey<C_>::type() const
+{
+ return this->_imp->type;
+}
+
+template <typename C_>
+std::string
+FakeMetadataValueKey<C_>::pretty_print() const
+{
+ return stringify(value());
+}
+
+template <typename C_>
+void
+FakeMetadataValueKey<C_>::set_value(const C_ & c)
+{
+ this->_imp->value = c;
+}
+
+namespace paludis
+{
+#ifndef PALUDIS_NO_DOUBLE_TEMPLATE
+ template <>
+#endif
+ template <typename C_>
struct Implementation<FakeMetadataCollectionKey<C_> >
{
std::tr1::shared_ptr<C_> collection;
@@ -641,6 +719,7 @@ namespace paludis
std::tr1::shared_ptr<FakeMetadataSpecTreeKey<FetchableURISpecTree> > src_uri;
std::tr1::shared_ptr<FakeMetadataSpecTreeKey<SimpleURISpecTree> > homepage;
std::tr1::shared_ptr<FakeMetadataChoicesKey> choices;
+ std::tr1::shared_ptr<FakeMetadataValueKey<bool> > transient;
std::tr1::shared_ptr<Mask> unsupported_mask;
mutable bool has_masks;
@@ -957,6 +1036,9 @@ FakePackageID::need_keys_added() const
_imp->choices.reset(new FakeMetadataChoicesKey(_imp->env, shared_from_this()));
+ _imp->transient.reset(new FakeMetadataValueKey<bool>("TRANSIENT", "Transient",
+ mkt_internal, false));
+
add_metadata_key(_imp->slot);
add_metadata_key(_imp->build_dependencies);
add_metadata_key(_imp->run_dependencies);
@@ -967,6 +1049,7 @@ FakePackageID::need_keys_added() const
add_metadata_key(_imp->provide);
add_metadata_key(_imp->license);
add_metadata_key(_imp->choices);
+ add_metadata_key(_imp->transient);
}
}
@@ -1216,7 +1299,15 @@ FakePackageID::size_of_all_distfiles_key() const
const std::tr1::shared_ptr<const MetadataValueKey<bool> >
FakePackageID::transient_key() const
{
- return std::tr1::shared_ptr<const MetadataValueKey<bool> >();
+ need_keys_added();
+ return _imp->transient;
+}
+
+const std::tr1::shared_ptr<FakeMetadataValueKey<bool> >
+FakePackageID::transient_key()
+{
+ need_keys_added();
+ return _imp->transient;
}
char
@@ -1279,3 +1370,5 @@ template class FakeMetadataSpecTreeKey<SimpleURISpecTree>;
template class FakeMetadataCollectionKey<KeywordNameSet>;
+template class FakeMetadataValueKey<bool>;
+
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 4389261..547ce7d 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 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,6 +31,31 @@ namespace paludis
class FakeRepositoryBase;
template <typename C_>
+ class PALUDIS_VISIBLE FakeMetadataValueKey :
+ public MetadataValueKey<C_>,
+ private PrivateImplementationPattern<FakeMetadataValueKey<C_> >
+ {
+ protected:
+ typename PrivateImplementationPattern<FakeMetadataValueKey<C_> >::ImpPtr & _imp;
+
+ public:
+ FakeMetadataValueKey(const std::string &, const std::string &, const MetadataKeyType,
+ const C_ &);
+
+ ~FakeMetadataValueKey();
+
+ virtual const C_ value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ void set_value(const C_ &);
+
+ virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::string pretty_print() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ template <typename C_>
class PALUDIS_VISIBLE FakeMetadataCollectionKey :
public MetadataCollectionKey<C_>,
private PrivateImplementationPattern<FakeMetadataCollectionKey<C_> >
@@ -282,6 +307,7 @@ namespace paludis
const std::tr1::shared_ptr<FakeMetadataSpecTreeKey<FetchableURISpecTree> > fetches_key();
const std::tr1::shared_ptr<FakeMetadataSpecTreeKey<SimpleURISpecTree> > homepage_key();
const std::tr1::shared_ptr<FakeMetadataChoicesKey> choices_key();
+ const std::tr1::shared_ptr<FakeMetadataValueKey<bool> > transient_key();
void set_slot(const SlotName &);