aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-11-07 21:28:26 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-11-07 21:28:26 +0000
commite15f518956383d4dc22bee5c13939f8de247a46d (patch)
treed1760116d2e5e29a7f47c3504319d13bd3e8f48a
parent8294cd0acad913897cb79aba7d94144254fdb4f3 (diff)
downloadpaludis-e15f518956383d4dc22bee5c13939f8de247a46d.tar.gz
paludis-e15f518956383d4dc22bee5c13939f8de247a46d.tar.xz
Add Map<string, string> keys
-rw-r--r--doc/api/cplusplus/examples/example_metadata_key.cc12
-rw-r--r--paludis/formatter-fwd.hh9
-rw-r--r--paludis/formatter.hh29
-rw-r--r--paludis/metadata_key.cc1
-rw-r--r--paludis/metadata_key.hh4
-rw-r--r--paludis/stringify_formatter-impl.hh4
-rw-r--r--paludis/stringify_formatter.cc9
-rw-r--r--paludis/stringify_formatter.hh3
-rw-r--r--paludis/user_dep_spec.cc5
-rw-r--r--python/metadata_key.cc5
-rw-r--r--ruby/metadata_key.cc14
-rwxr-xr-xsrc/clients/cave/cmd_display_resolution.cc6
-rw-r--r--src/clients/cave/cmd_info.cc6
-rw-r--r--src/clients/cave/cmd_match.cc10
-rw-r--r--src/clients/cave/cmd_show.cc12
-rw-r--r--src/clients/cave/colour_formatter-fmt.hh3
-rw-r--r--src/clients/cave/colour_formatter.cc6
-rw-r--r--src/clients/cave/colour_formatter.hh3
-rw-r--r--src/clients/cave/format_plain_metadata_key.cc6
-rw-r--r--src/clients/inquisitio/key_extractor.cc16
-rw-r--r--src/clients/instruo/instruo.cc5
-rw-r--r--src/clients/paludis/applets.cc6
-rw-r--r--src/clients/paludis/info.cc6
-rw-r--r--src/output/colour_formatter.cc6
-rw-r--r--src/output/colour_formatter.hh3
-rw-r--r--src/output/console_query_task.cc18
-rw-r--r--src/output/mask_displayer.cc6
27 files changed, 208 insertions, 5 deletions
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc
index a75944a..f61d5f3 100644
--- a/doc/api/cplusplus/examples/example_metadata_key.cc
+++ b/doc/api/cplusplus/examples/example_metadata_key.cc
@@ -32,6 +32,11 @@ namespace
{
void show_key(const MetadataKey & key, const std::string & indent = "");
+ std::string stringify_string_pair(const std::pair<const std::string, std::string> & s)
+ {
+ return s.first + "=" + s.second;
+ }
+
/* We use this visitor to display extra information about a MetadataKey,
* depending upon its type. */
class MetadataKeyInformationVisitor
@@ -187,6 +192,13 @@ namespace
cout << indent << left << setw(30) << " Value:" << " " << join(key.value()->begin(), key.value()->end(), " ") << endl;
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & key)
+ {
+ cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<Map<std::string, std::string> >" << endl;
+ cout << indent << left << setw(30) << " Value:" << " " << join(
+ key.value()->begin(), key.value()->end(), " ", stringify_string_pair) << endl;
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & key)
{
cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<Sequence<std::string> >" << endl;
diff --git a/paludis/formatter-fwd.hh b/paludis/formatter-fwd.hh
index a9120d9..2554e9a 100644
--- a/paludis/formatter-fwd.hh
+++ b/paludis/formatter-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 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
@@ -45,7 +45,12 @@ namespace paludis
typename T12_ = NoType<12u>,
typename T13_ = NoType<13u>,
typename T14_ = NoType<14u>,
- typename T15_ = NoType<15u>
+ typename T15_ = NoType<15u>,
+ typename T16_ = NoType<16u>,
+ typename T17_ = NoType<17u>,
+ typename T18_ = NoType<18u>,
+ typename T19_ = NoType<19u>,
+ typename T20_ = NoType<20u>
>
class Formatter;
}
diff --git a/paludis/formatter.hh b/paludis/formatter.hh
index 987cbdb..2d7d2cd 100644
--- a/paludis/formatter.hh
+++ b/paludis/formatter.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 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
@@ -901,7 +901,12 @@ namespace paludis
typename T12_,
typename T13_,
typename T14_,
- typename T15_
+ typename T15_,
+ typename T16_,
+ typename T17_,
+ typename T18_,
+ typename T19_,
+ typename T20_
>
class PALUDIS_VISIBLE Formatter :
public FormatFunctionsByProxy<T1_, typename format::CategorySelector<T1_>::Category, 1>,
@@ -919,6 +924,11 @@ namespace paludis
public FormatFunctionsByProxy<T13_, typename format::CategorySelector<T13_>::Category, 13>,
public FormatFunctionsByProxy<T14_, typename format::CategorySelector<T14_>::Category, 14>,
public FormatFunctionsByProxy<T15_, typename format::CategorySelector<T15_>::Category, 15>,
+ public FormatFunctionsByProxy<T16_, typename format::CategorySelector<T16_>::Category, 16>,
+ public FormatFunctionsByProxy<T17_, typename format::CategorySelector<T17_>::Category, 17>,
+ public FormatFunctionsByProxy<T18_, typename format::CategorySelector<T18_>::Category, 18>,
+ public FormatFunctionsByProxy<T19_, typename format::CategorySelector<T19_>::Category, 19>,
+ public FormatFunctionsByProxy<T20_, typename format::CategorySelector<T20_>::Category, 20>,
public CanSpace
{
private:
@@ -950,6 +960,11 @@ namespace paludis
FormatFunctionsByProxy<T13_, typename format::CategorySelector<T13_>::Category, 13>(&t),
FormatFunctionsByProxy<T14_, typename format::CategorySelector<T14_>::Category, 14>(&t),
FormatFunctionsByProxy<T15_, typename format::CategorySelector<T15_>::Category, 15>(&t),
+ FormatFunctionsByProxy<T16_, typename format::CategorySelector<T16_>::Category, 16>(&t),
+ FormatFunctionsByProxy<T17_, typename format::CategorySelector<T17_>::Category, 17>(&t),
+ FormatFunctionsByProxy<T18_, typename format::CategorySelector<T18_>::Category, 18>(&t),
+ FormatFunctionsByProxy<T19_, typename format::CategorySelector<T19_>::Category, 19>(&t),
+ FormatFunctionsByProxy<T20_, typename format::CategorySelector<T20_>::Category, 20>(&t),
CanSpace(),
_proxy(&t)
{
@@ -971,6 +986,11 @@ namespace paludis
FormatFunctionsByProxy<T13_, typename format::CategorySelector<T13_>::Category, 13>(other),
FormatFunctionsByProxy<T14_, typename format::CategorySelector<T14_>::Category, 14>(other),
FormatFunctionsByProxy<T15_, typename format::CategorySelector<T15_>::Category, 15>(other),
+ FormatFunctionsByProxy<T16_, typename format::CategorySelector<T16_>::Category, 16>(other),
+ FormatFunctionsByProxy<T17_, typename format::CategorySelector<T17_>::Category, 17>(other),
+ FormatFunctionsByProxy<T18_, typename format::CategorySelector<T18_>::Category, 18>(other),
+ FormatFunctionsByProxy<T19_, typename format::CategorySelector<T19_>::Category, 19>(other),
+ FormatFunctionsByProxy<T20_, typename format::CategorySelector<T20_>::Category, 20>(other),
CanSpace(other),
_proxy(other._proxy)
{
@@ -993,6 +1013,11 @@ namespace paludis
using FormatFunctionsByProxy<T13_, typename format::CategorySelector<T13_>::Category, 13>::format;
using FormatFunctionsByProxy<T14_, typename format::CategorySelector<T14_>::Category, 14>::format;
using FormatFunctionsByProxy<T15_, typename format::CategorySelector<T15_>::Category, 15>::format;
+ using FormatFunctionsByProxy<T16_, typename format::CategorySelector<T16_>::Category, 16>::format;
+ using FormatFunctionsByProxy<T17_, typename format::CategorySelector<T17_>::Category, 17>::format;
+ using FormatFunctionsByProxy<T18_, typename format::CategorySelector<T18_>::Category, 18>::format;
+ using FormatFunctionsByProxy<T19_, typename format::CategorySelector<T19_>::Category, 19>::format;
+ using FormatFunctionsByProxy<T20_, typename format::CategorySelector<T20_>::Category, 20>::format;
virtual std::string newline() const
{
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index e294ba9..2ea3f08 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -101,6 +101,7 @@ MetadataSpecTreeKey<DependencySpecTree>::~MetadataSpecTreeKey()
template class MetadataCollectionKey<KeywordNameSet>;
template class MetadataCollectionKey<Set<std::string> >;
template class MetadataCollectionKey<Sequence<std::string> >;
+template class MetadataCollectionKey<Map<std::string, std::string> >;
template class MetadataCollectionKey<PackageIDSequence>;
template class MetadataCollectionKey<FSPathSequence>;
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 798b616..102cde8 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -38,6 +38,7 @@
#include <paludis/util/type_list.hh>
#include <paludis/util/timestamp-fwd.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/map.hh>
#include <type_traits>
#include <string>
@@ -90,6 +91,7 @@ namespace paludis
MetadataCollectionKey<Sequence<std::string> >,
MetadataCollectionKey<PackageIDSequence>,
MetadataCollectionKey<FSPathSequence>,
+ MetadataCollectionKey<Map<std::string, std::string> >,
MetadataSpecTreeKey<DependencySpecTree>,
MetadataSpecTreeKey<LicenseSpecTree>,
MetadataSpecTreeKey<FetchableURISpecTree>,
@@ -277,7 +279,7 @@ namespace paludis
};
/**
- * A MetadataCollectionKey is a MetadataKey that holds a Set of some kind of item
+ * A MetadataCollectionKey is a MetadataKey that holds a container of some kind of item
* as its value.
*
* \ingroup g_metadata_key
diff --git a/paludis/stringify_formatter-impl.hh b/paludis/stringify_formatter-impl.hh
index ecdcc27..7983a35 100644
--- a/paludis/stringify_formatter-impl.hh
+++ b/paludis/stringify_formatter-impl.hh
@@ -43,6 +43,7 @@ namespace paludis
struct Imp<StringifyFormatter>
{
const CanFormat<std::string> * const f_str;
+ const CanFormat<std::pair<const std::string, std::string> > * const f_str_str;
const CanFormat<ChoiceValue> * const f_conf;
const CanFormat<KeywordName> * const f_keyword;
const CanFormat<PackageDepSpec> * const f_package;
@@ -62,6 +63,7 @@ namespace paludis
Imp(
const CanFormat<std::string> * const f_str_v,
+ const CanFormat<std::pair<const std::string, std::string> > * const f_str_str_v,
const CanFormat<ChoiceValue> * const f_conf_v,
const CanFormat<KeywordName> * const f_keyword_v,
const CanFormat<PackageDepSpec> * const f_package_v,
@@ -80,6 +82,7 @@ namespace paludis
const CanSpace * const f_space_v
) :
f_str(f_str_v),
+ f_str_str(f_str_str_v),
f_conf(f_conf_v),
f_keyword(f_keyword_v),
f_package(f_package_v),
@@ -184,6 +187,7 @@ namespace paludis
StringifyFormatter::StringifyFormatter(const T_ & t) :
Pimp<StringifyFormatter>(
StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<std::string> *>::value, std::string>::get(&t),
+ StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<std::pair<const std::string, std::string> > *>::value, std::pair<const std::string, std::string> >::get(&t),
StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<ChoiceValue> *>::value, ChoiceValue>::get(&t),
StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<KeywordName> *>::value, KeywordName>::get(&t),
StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<PackageDepSpec> *>::value, PackageDepSpec>::get(&t),
diff --git a/paludis/stringify_formatter.cc b/paludis/stringify_formatter.cc
index ab6061f..beb0fdf 100644
--- a/paludis/stringify_formatter.cc
+++ b/paludis/stringify_formatter.cc
@@ -30,6 +30,7 @@ using namespace paludis;
StringifyFormatter::StringifyFormatter() :
Pimp<StringifyFormatter>(
static_cast<const CanFormat<std::string> *>(0),
+ static_cast<const CanFormat<std::pair<const std::string, std::string> > *>(0),
static_cast<const CanFormat<ChoiceValue> *>(0),
static_cast<const CanFormat<KeywordName> *>(0),
static_cast<const CanFormat<PackageDepSpec> *>(0),
@@ -63,6 +64,14 @@ StringifyFormatter::format(const std::string & s, const format::Plain & k) const
}
std::string
+StringifyFormatter::format(const std::pair<const std::string, std::string> & s, const format::Plain & k) const
+{
+ if (_imp->f_str)
+ return _imp->f_str_str->format(s, k);
+ return s.first + "=" + s.second;
+}
+
+std::string
StringifyFormatter::format(const KeywordName & s, const format::Accepted & k) const
{
if (_imp->f_keyword)
diff --git a/paludis/stringify_formatter.hh b/paludis/stringify_formatter.hh
index a18c1c6..c223516 100644
--- a/paludis/stringify_formatter.hh
+++ b/paludis/stringify_formatter.hh
@@ -60,6 +60,7 @@ namespace paludis
class PALUDIS_VISIBLE StringifyFormatter :
private Pimp<StringifyFormatter>,
public CanFormat<std::string>,
+ public CanFormat<std::pair<const std::string, std::string> >,
public CanFormat<ChoiceValue>,
public CanFormat<KeywordName>,
public CanFormat<PackageDepSpec>,
@@ -98,6 +99,8 @@ namespace paludis
virtual std::string format(const std::string &, const format::Plain &) const;
+ virtual std::string format(const std::pair<const std::string, std::string> &, const format::Plain &) const;
+
virtual std::string format(const ChoiceValue &, const format::Enabled &) const;
virtual std::string format(const ChoiceValue &, const format::Disabled &) const;
virtual std::string format(const ChoiceValue &, const format::Forced &) const;
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index f3c72ec..ce4b7a2 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -738,6 +738,11 @@ namespace
return false;
}
+ bool visit(const MetadataCollectionKey<Map<std::string, std::string> > &) const
+ {
+ return false;
+ }
+
bool visit(const MetadataCollectionKey<KeywordNameSet> & s) const
{
switch (op)
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index 60a33df..7579955 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -106,6 +106,11 @@ class MetadataKeySptrToPythonVisitor
obj = bp::object(std::static_pointer_cast<const MetadataCollectionKey<Set<std::string> > >(_m_ptr));
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ obj = bp::object(std::static_pointer_cast<const MetadataCollectionKey<Map<std::string, std::string> > >(_m_ptr));
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
obj = bp::object(std::static_pointer_cast<const MetadataCollectionKey<Sequence<std::string> > >(_m_ptr));
diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc
index 313bde6..c956928 100644
--- a/ruby/metadata_key.cc
+++ b/ruby/metadata_key.cc
@@ -45,6 +45,7 @@ namespace
static VALUE c_metadata_repository_mask_info_key;
static VALUE c_metadata_keyword_name_set_key;
static VALUE c_metadata_string_set_key;
+ static VALUE c_metadata_string_string_map_key;
static VALUE c_metadata_string_sequence_key;
static VALUE c_metadata_package_id_sequence_key;
static VALUE c_metadata_fsentry_key;
@@ -182,6 +183,12 @@ namespace
new std::shared_ptr<const MetadataKey>(mm));
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > &)
+ {
+ value = Data_Wrap_Struct(c_metadata_string_string_map_key, 0, &Common<std::shared_ptr<const MetadataKey> >::free,
+ new std::shared_ptr<const MetadataKey>(mm));
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > &)
{
value = Data_Wrap_Struct(c_metadata_string_sequence_key, 0, &Common<std::shared_ptr<const MetadataKey> >::free,
@@ -772,6 +779,13 @@ namespace
rb_define_method(c_metadata_string_set_key, "value", RUBY_FUNC_CAST((&SetValue<Set<std::string> >::fetch)), 0);
/*
+ * Document-class: Paludis::MetadataStringStringMapKey
+ *
+ * Metadata class for String to String maps.
+ */
+ c_metadata_string_string_map_key = rb_define_class_under(paludis_module(), "MetadataStringStringMapKey", c_metadata_key);
+
+ /*
* Document-class: Paludis::MetadataStringSequenceKey
*
* Metadata class for String sequences.
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index d55fdbc..5a29bec 100755
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -907,6 +907,12 @@ namespace
cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.pretty_print_flat(formatter))));
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ ColourFormatter formatter(0);
+ cout << fuc(fs_mask_by(), fv<'i'>(indent), fv<'k'>(k.human_name()), fv<'v'>(stringify(k.pretty_print_flat(formatter))));
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
ColourFormatter formatter(0);
diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc
index 6d84f39..0a5e2bf 100644
--- a/src/clients/cave/cmd_info.cc
+++ b/src/clients/cave/cmd_info.cc
@@ -167,6 +167,12 @@ namespace
cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(k.pretty_print_flat(f)));
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ ColourFormatter f(indent);
+ cout << fuc(fs_metadata(), fv<'h'>(k.human_name()), fv<'i'>(std::string(indent, ' ')), fv<'s'>(k.pretty_print_flat(f)));
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
ColourFormatter f(indent);
diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc
index 1abf074..220f150 100644
--- a/src/clients/cave/cmd_match.cc
+++ b/src/clients/cave/cmd_match.cc
@@ -146,6 +146,11 @@ namespace
throw args::DoHelp("Unknown algoritm '" + algorithm + "'");
}
+ std::string stringify_string_pair(const std::pair<const std::string, std::string> & s)
+ {
+ return s.first + "=" + s.second;
+ }
+
struct SpecTreeAsString
{
std::list<std::string> & texts;
@@ -332,6 +337,11 @@ namespace
std::transform(k.value()->begin(), k.value()->end(), std::back_inserter(texts), &stringify<std::string>);
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ std::transform(k.value()->begin(), k.value()->end(), std::back_inserter(texts), stringify_string_pair);
+ }
+
void visit(const MetadataCollectionKey<Set<KeywordName> > & k)
{
std::transform(k.value()->begin(), k.value()->end(), std::back_inserter(texts), &stringify<KeywordName>);
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index 4d43318..796e56c 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -407,6 +407,18 @@ namespace
);
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ ColourFormatter f(indent);
+ out << fuc(
+ (cmdline.a_raw_names.specified() ? fs_metadata_value_raw() : fs_metadata_value_human()),
+ fv<'s'>(cmdline.a_raw_names.specified() ? k.raw_name() : k.human_name()),
+ fv<'v'>(k.pretty_print_flat(f)),
+ fv<'i'>(std::string(indent, ' ')),
+ fv<'b'>(important ? "true" : "")
+ );
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
ColourFormatter f(indent);
diff --git a/src/clients/cave/colour_formatter-fmt.hh b/src/clients/cave/colour_formatter-fmt.hh
index 1ecaf90..5877729 100644
--- a/src/clients/cave/colour_formatter-fmt.hh
+++ b/src/clients/cave/colour_formatter-fmt.hh
@@ -12,6 +12,9 @@ const auto fs_format_keyword_name_unaccepted = make_format_string_fetcher("forma
const auto fs_format_string_plain = make_format_string_fetcher("format-string/plain", 1)
<< param<'s'>();
+const auto fs_format_string_string_plain = make_format_string_fetcher("format-string-string/plain", 1)
+ << param<'k'>() << "=" << param<'v'>();
+
const auto fs_format_package_id_plain = make_format_string_fetcher("format-package-id/plain", 1)
<< param<'s'>();
diff --git a/src/clients/cave/colour_formatter.cc b/src/clients/cave/colour_formatter.cc
index 75992c5..ed0c14a 100644
--- a/src/clients/cave/colour_formatter.cc
+++ b/src/clients/cave/colour_formatter.cc
@@ -108,6 +108,12 @@ ColourFormatter::format(const std::string & s, const format::Plain &) const
}
std::string
+ColourFormatter::format(const std::pair<const std::string, std::string> & s, const format::Plain &) const
+{
+ return fuc(fs_format_string_string_plain(), fv<'k'>(stringify(s.first)), fv<'v'>(stringify(s.second)));
+}
+
+std::string
ColourFormatter::format(const PackageID & s, const format::Plain &) const
{
return fuc(fs_format_package_id_plain(), fv<'s'>(stringify(s)));
diff --git a/src/clients/cave/colour_formatter.hh b/src/clients/cave/colour_formatter.hh
index ef3037c..17b548a 100644
--- a/src/clients/cave/colour_formatter.hh
+++ b/src/clients/cave/colour_formatter.hh
@@ -31,6 +31,7 @@ namespace paludis
class PALUDIS_VISIBLE ColourFormatter :
public CanFormat<KeywordName>,
public CanFormat<std::string>,
+ public CanFormat<std::pair<const std::string, std::string> >,
public CanFormat<PackageID>,
public CanFormat<LicenseDepSpec>,
public CanFormat<ConditionalDepSpec>,
@@ -67,6 +68,8 @@ namespace paludis
std::string format(const std::string &, const format::Plain &) const;
+ std::string format(const std::pair<const std::string, std::string> &, const format::Plain &) const;
+
std::string format(const PackageID &, const format::Plain &) const;
std::string format(const PackageID &, const format::Installed &) const;
std::string format(const PackageID &, const format::Installable &) const;
diff --git a/src/clients/cave/format_plain_metadata_key.cc b/src/clients/cave/format_plain_metadata_key.cc
index 253c19c..e469f93 100644
--- a/src/clients/cave/format_plain_metadata_key.cc
+++ b/src/clients/cave/format_plain_metadata_key.cc
@@ -153,6 +153,12 @@ namespace
s << k.pretty_print_flat(f);
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ StringifyFormatter f;
+ s << k.pretty_print_flat(f);
+ }
+
void visit(const MetadataCollectionKey<KeywordNameSet> & k)
{
StringifyFormatter f;
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index 36e2738..c850193 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -181,6 +181,11 @@ namespace
}
};
+ std::string stringify_string_pair(const std::pair<const std::string, std::string> & s)
+ {
+ return s.first + "=" + s.second;
+ }
+
class KeyVisitor
{
private:
@@ -298,6 +303,17 @@ namespace
std::bind(&Matcher::operator(), std::cref(_m), _1));
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & s)
+ {
+ using namespace std::placeholders;
+
+ if (_flatten)
+ result = _m(join(s.value()->begin(), s.value()->end(), " ", stringify_string_pair));
+ else
+ result = s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(),
+ std::bind(&Matcher::operator(), std::cref(_m), std::bind(&stringify_string_pair, _1)));
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & s)
{
using namespace std::placeholders;
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index d0cda27..0ac0b7f 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -147,6 +147,11 @@ namespace
const std::shared_ptr<const Set<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value());
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ const std::shared_ptr<const Map<std::string, std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
const std::shared_ptr<const Sequence<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value());
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index 8d962dc..74e5b03 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -160,6 +160,12 @@ namespace
std::cout << k.pretty_print_flat(f) << std::endl;
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
StringifyFormatter f;
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index 7d26791..23bb93c 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -201,6 +201,12 @@ namespace
cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
ColourFormatter f;
diff --git a/src/output/colour_formatter.cc b/src/output/colour_formatter.cc
index 6c36f3f..0f0aa3e 100644
--- a/src/output/colour_formatter.cc
+++ b/src/output/colour_formatter.cc
@@ -183,6 +183,12 @@ ColourFormatter::format(const std::string & f, const format::Plain &) const
}
std::string
+ColourFormatter::format(const std::pair<const std::string, std::string> & f, const format::Plain &) const
+{
+ return stringify(f.first) + "=" + stringify(f.second);
+}
+
+std::string
ColourFormatter::format(const PlainTextLabelDepSpec & f, const format::Plain &) const
{
return stringify(f);
diff --git a/src/output/colour_formatter.hh b/src/output/colour_formatter.hh
index 75c6fab..5de2b6d 100644
--- a/src/output/colour_formatter.hh
+++ b/src/output/colour_formatter.hh
@@ -42,6 +42,7 @@ class ColourFormatter :
public paludis::CanFormat<paludis::FSPath>,
public paludis::CanFormat<paludis::PackageID>,
public paludis::CanFormat<std::string>,
+ public paludis::CanFormat<std::pair<const std::string, std::string> >,
public paludis::CanSpace
{
public:
@@ -77,6 +78,8 @@ class ColourFormatter :
std::string format(const std::string &, const paludis::format::Plain &) const;
+ std::string format(const std::pair<const std::string, std::string> &, const paludis::format::Plain &) const;
+
std::string format(const paludis::PlainTextLabelDepSpec &, const paludis::format::Plain &) const;
std::string format(const paludis::URILabelsDepSpec &, const paludis::format::Plain &) const;
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 94bf3c5..3fee156 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -365,6 +365,24 @@ namespace
}
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ if (k.type() == type)
+ {
+ ColourFormatter formatter;
+ if (task->want_raw())
+ {
+ task->output_left_column(k.raw_name() + ":", in);
+ task->output_right_column(k.pretty_print_flat(formatter));
+ }
+ else
+ {
+ task->output_left_column(k.human_name() + ":", in);
+ task->output_right_column(k.pretty_print_flat(formatter));
+ }
+ }
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
if (k.type() == type)
diff --git a/src/output/mask_displayer.cc b/src/output/mask_displayer.cc
index dd0fb1d..3b7e9fa 100644
--- a/src/output/mask_displayer.cc
+++ b/src/output/mask_displayer.cc
@@ -132,6 +132,12 @@ namespace
s << k.pretty_print_flat(formatter);
}
+ void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k)
+ {
+ ColourFormatter formatter;
+ s << k.pretty_print_flat(formatter);
+ }
+
void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
{
ColourFormatter formatter;