aboutsummaryrefslogtreecommitdiff
path: root/paludis/literal_metadata_key.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/literal_metadata_key.cc')
-rw-r--r--paludis/literal_metadata_key.cc65
1 files changed, 65 insertions, 0 deletions
diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc
index 9fbc23457..6ccc62572 100644
--- a/paludis/literal_metadata_key.cc
+++ b/paludis/literal_metadata_key.cc
@@ -71,6 +71,24 @@ namespace paludis
};
template <>
+ struct Imp<LiteralMetadataStringStringMapKey>
+ {
+ const std::string raw_name;
+ const std::string human_name;
+ const MetadataKeyType type;
+ const std::shared_ptr<const Map<std::string, std::string> > value;
+
+ Imp(const std::string & r, const std::string & h, const MetadataKeyType t,
+ const std::shared_ptr<const Map<std::string, std::string> > & v) :
+ raw_name(r),
+ human_name(h),
+ type(t),
+ value(v)
+ {
+ }
+ };
+
+ template <>
struct Imp<LiteralMetadataStringSequenceKey>
{
const std::string raw_name;
@@ -173,6 +191,23 @@ LiteralMetadataStringSetKey::value() const
return _imp->value;
}
+LiteralMetadataStringStringMapKey::LiteralMetadataStringStringMapKey(const std::string & r, const std::string & h,
+ const MetadataKeyType t, const std::shared_ptr<const Map<std::string, std::string> > & v) :
+ Pimp<LiteralMetadataStringStringMapKey>(r, h, t, v),
+ _imp(Pimp<LiteralMetadataStringStringMapKey>::_imp)
+{
+}
+
+LiteralMetadataStringStringMapKey::~LiteralMetadataStringStringMapKey()
+{
+}
+
+const std::shared_ptr<const Map<std::string, std::string> >
+LiteralMetadataStringStringMapKey::value() const
+{
+ return _imp->value;
+}
+
LiteralMetadataStringSequenceKey::LiteralMetadataStringSequenceKey(const std::string & r, const std::string & h,
const MetadataKeyType t, const std::shared_ptr<const Sequence<std::string> > & v) :
Pimp<LiteralMetadataStringSequenceKey>(r, h, t, v),
@@ -214,6 +249,11 @@ namespace
{
return f.format(i, format::Plain());
}
+
+ std::string format_string_string(const std::pair<const std::string, std::string> & i, const Formatter<std::pair<const std::string, std::string> > & f)
+ {
+ return f.format(i, format::Plain());
+ }
}
std::string
@@ -224,6 +264,13 @@ LiteralMetadataStringSetKey::pretty_print_flat(const Formatter<std::string> & f)
}
std::string
+LiteralMetadataStringStringMapKey::pretty_print_flat(const Formatter<std::pair<const std::string, std::string> > & f) const
+{
+ using namespace std::placeholders;
+ return join(value()->begin(), value()->end(), " ", std::bind(&format_string_string, _1, f));
+}
+
+std::string
LiteralMetadataStringSequenceKey::pretty_print_flat(const Formatter<std::string> & f) const
{
using namespace std::placeholders;
@@ -248,6 +295,24 @@ LiteralMetadataStringSetKey::type() const
return _imp->type;
}
+const std::string
+LiteralMetadataStringStringMapKey::human_name() const
+{
+ return _imp->human_name;
+}
+
+const std::string
+LiteralMetadataStringStringMapKey::raw_name() const
+{
+ return _imp->raw_name;
+}
+
+MetadataKeyType
+LiteralMetadataStringStringMapKey::type() const
+{
+ return _imp->type;
+}
+
template <typename T_>
const std::string
LiteralMetadataValueKey<T_>::human_name() const