aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-08-18 15:33:41 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-08-18 15:33:41 +0100
commitd6d26953211434db2042652e227136214d81b224 (patch)
tree94c34ab8564a4688f7b378eaf2c3bde9392208c2 /paludis
parentd1bf557556c570e133df1c94269979d1c71bde5a (diff)
downloadpaludis-d6d26953211434db2042652e227136214d81b224.tar.gz
paludis-d6d26953211434db2042652e227136214d81b224.tar.xz
Add MetadataCollectionKey<Sequence<std::string> >
Diffstat (limited to 'paludis')
-rw-r--r--paludis/literal_metadata_key.cc36
-rw-r--r--paludis/literal_metadata_key.hh30
-rw-r--r--paludis/metadata_key.cc1
-rw-r--r--paludis/metadata_key.hh1
-rw-r--r--paludis/repositories/e/qa/metadata_keys.cc5
-rw-r--r--paludis/repositories/e/qa/spec_keys.cc4
6 files changed, 77 insertions, 0 deletions
diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc
index 25aa64dc2..d7eb9504b 100644
--- a/paludis/literal_metadata_key.cc
+++ b/paludis/literal_metadata_key.cc
@@ -55,6 +55,17 @@ namespace paludis
}
};
+ template <>
+ struct Implementation<LiteralMetadataStringSequenceKey>
+ {
+ const std::tr1::shared_ptr<const Sequence<std::string> > value;
+
+ Implementation(const std::tr1::shared_ptr<const Sequence<std::string> > & v) :
+ value(v)
+ {
+ }
+ };
+
#ifndef PALUDIS_NO_DOUBLE_TEMPLATE
template <>
#endif
@@ -121,6 +132,24 @@ LiteralMetadataStringSetKey::value() const
return _imp->value;
}
+LiteralMetadataStringSequenceKey::LiteralMetadataStringSequenceKey(const std::string & h, const std::string & r,
+ const MetadataKeyType t, const std::tr1::shared_ptr<const Sequence<std::string> > & v) :
+ MetadataCollectionKey<Sequence<std::string> >(h, r, t),
+ PrivateImplementationPattern<LiteralMetadataStringSequenceKey>(new Implementation<LiteralMetadataStringSequenceKey>(v)),
+ _imp(PrivateImplementationPattern<LiteralMetadataStringSequenceKey>::_imp)
+{
+}
+
+LiteralMetadataStringSequenceKey::~LiteralMetadataStringSequenceKey()
+{
+}
+
+const std::tr1::shared_ptr<const Sequence<std::string> >
+LiteralMetadataStringSequenceKey::value() const
+{
+ return _imp->value;
+}
+
namespace
{
std::string format_string(const std::string & i, const Formatter<std::string> & f)
@@ -136,6 +165,13 @@ LiteralMetadataStringSetKey::pretty_print_flat(const Formatter<std::string> & f)
return join(value()->begin(), value()->end(), " ", std::tr1::bind(&format_string, _1, f));
}
+std::string
+LiteralMetadataStringSequenceKey::pretty_print_flat(const Formatter<std::string> & f) const
+{
+ using namespace std::tr1::placeholders;
+ return join(value()->begin(), value()->end(), " ", std::tr1::bind(&format_string, _1, f));
+}
+
ExtraLiteralMetadataValueKeyMethods<long>::~ExtraLiteralMetadataValueKeyMethods()
{
}
diff --git a/paludis/literal_metadata_key.hh b/paludis/literal_metadata_key.hh
index 02285f6b3..b15477b06 100644
--- a/paludis/literal_metadata_key.hh
+++ b/paludis/literal_metadata_key.hh
@@ -172,6 +172,36 @@ namespace paludis
virtual std::string pretty_print_flat(const Formatter<std::string> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+
+ /**
+ * A LiteralMetadataStringSequenceKey is a MetadataCollectionKey<Sequence<std::string> >
+ * whose value is known at construction time.
+ *
+ * \ingroup g_literal_metadata_key
+ * \since 0.30
+ */
+ class PALUDIS_VISIBLE LiteralMetadataStringSequenceKey :
+ public MetadataCollectionKey<Sequence<std::string> >,
+ private PrivateImplementationPattern<LiteralMetadataStringSequenceKey>
+ {
+ private:
+ PrivateImplementationPattern<LiteralMetadataStringSequenceKey>::ImpPtr & _imp;
+
+ public:
+ ///\name Basic operations
+ ///\{
+
+ LiteralMetadataStringSequenceKey(const std::string &, const std::string &, const MetadataKeyType,
+ const std::tr1::shared_ptr<const Sequence<std::string> > &);
+ ~LiteralMetadataStringSequenceKey();
+
+ ///\}
+
+ virtual const std::tr1::shared_ptr<const Sequence<std::string> > value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual std::string pretty_print_flat(const Formatter<std::string> &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
}
#endif
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index 3bb8ffe76..a27571e64 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -143,6 +143,7 @@ template class MetadataCollectionKey<KeywordNameSet>;
template class MetadataCollectionKey<IUseFlagSet>;
#endif
template class MetadataCollectionKey<Set<std::string> >;
+template class MetadataCollectionKey<Sequence<std::string> >;
template class MetadataCollectionKey<UseFlagNameSet>;
template class MetadataCollectionKey<PackageIDSequence>;
template class MetadataCollectionKey<FSEntrySequence>;
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 52c7d02e8..62c9f87c2 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -66,6 +66,7 @@ namespace paludis
MetadataCollectionKey<IUseFlagSet>,
MetadataCollectionKey<KeywordNameSet>,
MetadataCollectionKey<Set<std::string> >,
+ MetadataCollectionKey<Sequence<std::string> >,
MetadataCollectionKey<PackageIDSequence>,
MetadataCollectionKey<FSEntrySequence>,
MetadataSpecTreeKey<DependencySpecTree>,
diff --git a/paludis/repositories/e/qa/metadata_keys.cc b/paludis/repositories/e/qa/metadata_keys.cc
index f50e00561..937333e08 100644
--- a/paludis/repositories/e/qa/metadata_keys.cc
+++ b/paludis/repositories/e/qa/metadata_keys.cc
@@ -116,6 +116,11 @@ namespace
const std::tr1::shared_ptr<const Set<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value());
}
+ void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
+ {
+ const std::tr1::shared_ptr<const Sequence<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ }
+
void visit(const MetadataCollectionKey<FSEntrySequence> & k)
{
const std::tr1::shared_ptr<const FSEntrySequence> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
diff --git a/paludis/repositories/e/qa/spec_keys.cc b/paludis/repositories/e/qa/spec_keys.cc
index 82965b56f..a7808e8e8 100644
--- a/paludis/repositories/e/qa/spec_keys.cc
+++ b/paludis/repositories/e/qa/spec_keys.cc
@@ -360,6 +360,10 @@ namespace
{
}
+ void visit(const MetadataCollectionKey<Sequence<std::string> > &)
+ {
+ }
+
void visit(const MetadataCollectionKey<FSEntrySequence> &)
{
}