aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/fake
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-09-26 22:16:54 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-09-26 22:16:54 +0000
commitb2c5636d0262ac180ce5319f464de5bb5ee3f420 (patch)
tree7c7e22467d87e1cfc327aa411e6695b9400d3a95 /paludis/repositories/fake
parent6b5af5a100ccbdadbd2bda2ae1f5d0c82fd88b78 (diff)
downloadpaludis-b2c5636d0262ac180ce5319f464de5bb5ee3f420.tar.gz
paludis-b2c5636d0262ac180ce5319f464de5bb5ee3f420.tar.xz
Carry around default labels with src_uri_key.
Diffstat (limited to 'paludis/repositories/fake')
-rw-r--r--paludis/repositories/fake/fake_package_id.cc59
-rw-r--r--paludis/repositories/fake/fake_package_id.hh28
2 files changed, 87 insertions, 0 deletions
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 3dd6bd9b9..054241741 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -135,6 +135,21 @@ namespace paludis
{
}
};
+
+ template <>
+ struct Implementation<FakeMetadataSpecTreeKey<URISpecTree> >
+ {
+ tr1::shared_ptr<const URISpecTree::ConstItem> value;
+ std::string string_value;
+ const tr1::function<const tr1::shared_ptr<const URISpecTree::ConstItem> (const std::string &)> func;
+ tr1::shared_ptr<const URILabel> initial_label;
+
+ Implementation(const tr1::function<const tr1::shared_ptr<const URISpecTree::ConstItem> (const std::string &)> & f) :
+ func(f),
+ initial_label(new URIListedThenMirrorsLabel("listed-then-mirrors"))
+ {
+ }
+ };
}
template <typename C_>
@@ -181,6 +196,50 @@ FakeMetadataSpecTreeKey<C_>::pretty_print_flat(const typename C_::Formatter &) c
return _imp->string_value;
}
+FakeMetadataSpecTreeKey<URISpecTree>::FakeMetadataSpecTreeKey(const std::string & r, const std::string & h, const std::string & v,
+ const tr1::function<const tr1::shared_ptr<const URISpecTree::ConstItem> (const std::string &)> & f, const MetadataKeyType t) :
+ MetadataSpecTreeKey<URISpecTree>(r, h, t),
+ PrivateImplementationPattern<FakeMetadataSpecTreeKey<URISpecTree> >(new Implementation<FakeMetadataSpecTreeKey<URISpecTree> >(f)),
+ _imp(PrivateImplementationPattern<FakeMetadataSpecTreeKey<URISpecTree> >::_imp.get())
+{
+ set_from_string(v);
+}
+
+FakeMetadataSpecTreeKey<URISpecTree>::~FakeMetadataSpecTreeKey()
+{
+}
+
+void
+FakeMetadataSpecTreeKey<URISpecTree>::set_from_string(const std::string & s)
+{
+ _imp->string_value = s;
+ _imp->value = _imp->func(s);
+}
+
+const tr1::shared_ptr<const URISpecTree::ConstItem>
+FakeMetadataSpecTreeKey<URISpecTree>::value() const
+{
+ return _imp->value;
+}
+
+std::string
+FakeMetadataSpecTreeKey<URISpecTree>::pretty_print(const URISpecTree::Formatter &) const
+{
+ return _imp->string_value;
+}
+
+std::string
+FakeMetadataSpecTreeKey<URISpecTree>::pretty_print_flat(const URISpecTree::Formatter &) const
+{
+ return _imp->string_value;
+}
+
+const tr1::shared_ptr<const URILabel>
+FakeMetadataSpecTreeKey<URISpecTree>::initial_label() const
+{
+ return _imp->initial_label;
+}
+
namespace paludis
{
template <>
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 20739ce9c..152d12f95 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -105,6 +105,34 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ template <>
+ class PALUDIS_VISIBLE FakeMetadataSpecTreeKey<URISpecTree> :
+ public MetadataSpecTreeKey<URISpecTree>,
+ private PrivateImplementationPattern<FakeMetadataSpecTreeKey<URISpecTree> >
+ {
+ private:
+ Implementation<FakeMetadataSpecTreeKey<URISpecTree> > * const _imp;
+
+ public:
+ FakeMetadataSpecTreeKey(const std::string &, const std::string &, const std::string &,
+ const tr1::function<const tr1::shared_ptr<const URISpecTree::ConstItem> (const std::string &)> &, const MetadataKeyType);
+ ~FakeMetadataSpecTreeKey();
+
+ virtual const tr1::shared_ptr<const URISpecTree::ConstItem> value() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void set_from_string(const std::string &);
+
+ virtual std::string pretty_print(const URISpecTree::Formatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::string pretty_print_flat(const URISpecTree::Formatter &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const tr1::shared_ptr<const URILabel> initial_label() const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
class PALUDIS_VISIBLE FakeMetadataPackageIDKey :
public MetadataPackageIDKey,
private PrivateImplementationPattern<FakeMetadataPackageIDKey>