aboutsummaryrefslogtreecommitdiff
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
parentd1bf557556c570e133df1c94269979d1c71bde5a (diff)
downloadpaludis-d6d26953211434db2042652e227136214d81b224.tar.gz
paludis-d6d26953211434db2042652e227136214d81b224.tar.xz
Add MetadataCollectionKey<Sequence<std::string> >
-rw-r--r--doc/api/cplusplus/examples/example_metadata_key.cc6
-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
-rw-r--r--python/metadata_key.cc5
-rw-r--r--ruby/metadata_key.cc15
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc5
-rw-r--r--src/clients/inquisitio/key_extractor.cc11
-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/clients/qualudis/qualudis.cc5
-rw-r--r--src/output/console_query_task.cc18
-rw-r--r--src/output/mask_displayer.cc6
17 files changed, 165 insertions, 0 deletions
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc
index d68d4d7..adaea1c 100644
--- a/doc/api/cplusplus/examples/example_metadata_key.cc
+++ b/doc/api/cplusplus/examples/example_metadata_key.cc
@@ -191,6 +191,12 @@ namespace
cout << indent << left << setw(30) << " Value:" << " " << join(key.value()->begin(), key.value()->end(), " ") << endl;
}
+ void visit(const MetadataCollectionKey<Sequence<std::string> > & key)
+ {
+ cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<Sequence<std::string> >" << endl;
+ cout << indent << left << setw(30) << " Value:" << " " << join(key.value()->begin(), key.value()->end(), " ") << endl;
+ }
+
void visit(const MetadataCollectionKey<FSEntrySequence> & key)
{
cout << indent << left << setw(30) << " Class:" << " " << "MetadataCollectionKey<FSEntrySequence>" << endl;
diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc
index 25aa64d..d7eb950 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 02285f6..b15477b 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 3bb8ffe..a27571e 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 52c7d02..62c9f87 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 f50e005..937333e 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 82965b5..a7808e8 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> &)
{
}
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index 849365f..42cc4d2 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -109,6 +109,11 @@ class MetadataKeySptrToPythonVisitor :
obj = bp::object(std::tr1::static_pointer_cast<const MetadataCollectionKey<Set<std::string> > >(_m_ptr));
}
+ void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
+ {
+ obj = bp::object(std::tr1::static_pointer_cast<const MetadataCollectionKey<Sequence<std::string> > >(_m_ptr));
+ }
+
void visit(const MetadataCollectionKey<FSEntrySequence> & k)
{
obj = bp::object(std::tr1::static_pointer_cast<const MetadataCollectionKey<FSEntrySequence> >(_m_ptr));
diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc
index d70336e..c634d86 100644
--- a/ruby/metadata_key.cc
+++ b/ruby/metadata_key.cc
@@ -45,6 +45,7 @@ namespace
static VALUE c_metadata_use_flag_name_set_key;
static VALUE c_metadata_iuse_flag_set_key;
static VALUE c_metadata_string_set_key;
+ static VALUE c_metadata_string_sequence_key;
static VALUE c_metadata_package_id_sequence_key;
static VALUE c_metadata_fsentry_key;
static VALUE c_metadata_fsentry_sequence_key;
@@ -182,6 +183,12 @@ namespace
new std::tr1::shared_ptr<const MetadataKey>(mm));
}
+ void visit(const MetadataCollectionKey<Sequence<std::string> > &)
+ {
+ value = Data_Wrap_Struct(c_metadata_string_sequence_key, 0, &Common<std::tr1::shared_ptr<const MetadataKey> >::free,
+ new std::tr1::shared_ptr<const MetadataKey>(mm));
+ }
+
void visit(const MetadataCollectionKey<FSEntrySequence> &)
{
value = Data_Wrap_Struct(c_metadata_fsentry_sequence_key, 0, &Common<std::tr1::shared_ptr<const MetadataKey> >::free,
@@ -693,6 +700,14 @@ namespace
rb_define_method(c_metadata_string_set_key, "value", RUBY_FUNC_CAST((&SetValue<Set<std::string> >::fetch)), 0);
/*
+ * Document-class: Paludis::MetadataStringSequenceKey
+ *
+ * Metadata class for String sequences.
+ */
+ c_metadata_string_sequence_key = rb_define_class_under(paludis_module(), "MetadataStringSequenceKey", c_metadata_key);
+ rb_define_method(c_metadata_string_sequence_key, "value", RUBY_FUNC_CAST((&SetValue<Sequence<std::string> >::fetch)), 0);
+
+ /*
* Document-class: Paludis::MetadataLicenseSpecTreeKey
*
* Metadata class for license specs.
diff --git a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
index 2696ac5..fca16ce 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
@@ -113,6 +113,11 @@ namespace gtkpaludis
got_key(k, k.pretty_print_flat(formatter));
}
+ void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
+ {
+ got_key(k, k.pretty_print_flat(formatter));
+ }
+
void visit(const MetadataCollectionKey<FSEntrySequence> & k)
{
got_key(k, k.pretty_print_flat(formatter));
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index d2fd488..de34313 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -279,6 +279,17 @@ namespace
std::tr1::bind(&Matcher::operator(), std::tr1::cref(_m), _1));
}
+ void visit(const MetadataCollectionKey<Sequence<std::string> > & s)
+ {
+ using namespace std::tr1::placeholders;
+
+ if (_flatten)
+ result = _m(join(s.value()->begin(), s.value()->end(), " "));
+ else
+ result = s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(),
+ std::tr1::bind(&Matcher::operator(), std::tr1::cref(_m), _1));
+ }
+
void visit(const MetadataCollectionKey<FSEntrySequence> & s)
{
using namespace std::tr1::placeholders;
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index d4fae3a..19cd3c9 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -134,6 +134,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/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index d784233..acdc8d5 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -161,6 +161,12 @@ namespace
std::cout << k.pretty_print_flat(f) << std::endl;
}
+ void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
void visit(const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > & k)
{
std::cout << *k.value() << std::endl;
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index a2402c5..5199064 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -201,6 +201,12 @@ namespace
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;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
};
}
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index 25103b3..bdf4722 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -87,6 +87,11 @@ namespace
stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n";
}
+ void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
+ {
+ stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n";
+ }
+
void visit(const MetadataCollectionKey<FSEntrySequence> & k)
{
stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n";
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 06ed785..4fda5e1 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -336,6 +336,24 @@ namespace
}
}
+ void visit(const MetadataCollectionKey<Sequence<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<UseFlagNameSet> & k)
{
if (k.type() == type)
diff --git a/src/output/mask_displayer.cc b/src/output/mask_displayer.cc
index ff4755d..231ca98 100644
--- a/src/output/mask_displayer.cc
+++ b/src/output/mask_displayer.cc
@@ -142,6 +142,12 @@ namespace
s << k.pretty_print_flat(formatter);
}
+ void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
+ {
+ ColourFormatter formatter;
+ s << k.pretty_print_flat(formatter);
+ }
+
void visit(const MetadataCollectionKey<FSEntrySequence> & k)
{
ColourFormatter formatter;