aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-04 23:25:05 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-04 23:25:05 +0000
commit8a2209af5322271d8741d8add2f9f965b30a6455 (patch)
treec1ca8dcf2c152223d610b43f19d6925d69d2f920
parentcd3a942035f61f0d42b743698209236c83747e78 (diff)
downloadpaludis-8a2209af5322271d8741d8add2f9f965b30a6455.tar.gz
paludis-8a2209af5322271d8741d8add2f9f965b30a6455.tar.xz
MetadataSpecTreeKey<RequiredUseSpecTree>
-rw-r--r--doc/api/cplusplus/examples/example_metadata_key.cc6
-rw-r--r--paludis/metadata_key.cc1
-rw-r--r--paludis/metadata_key.hh1
-rw-r--r--paludis/user_dep_spec.cc13
-rw-r--r--python/metadata_key.cc6
-rw-r--r--ruby/metadata_key.cc15
-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.cc6
-rw-r--r--src/clients/cave/cmd_show.cc27
-rw-r--r--src/clients/cave/format_plain_metadata_key.cc6
-rw-r--r--src/clients/inquisitio/key_extractor.cc15
-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/console_query_task.cc19
-rw-r--r--src/output/mask_displayer.cc6
17 files changed, 150 insertions, 0 deletions
diff --git a/doc/api/cplusplus/examples/example_metadata_key.cc b/doc/api/cplusplus/examples/example_metadata_key.cc
index 2f80339..b55dfb8 100644
--- a/doc/api/cplusplus/examples/example_metadata_key.cc
+++ b/doc/api/cplusplus/examples/example_metadata_key.cc
@@ -152,6 +152,12 @@ namespace
cout << indent << left << setw(30) << " Value:" << " " << key.pretty_print_flat(formatter) << endl;
}
+ void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & key)
+ {
+ cout << indent << left << setw(30) << " Class:" << " " << "MetadataSpecTreeKey<RequiredUseSpecTree>" << endl;
+ cout << indent << left << setw(30) << " Value:" << " " << key.pretty_print_flat(formatter) << endl;
+ }
+
void visit(const MetadataSpecTreeKey<ProvideSpecTree> & key)
{
cout << indent << left << setw(30) << " Class:" << " " << "MetadataSpecTreeKey<ProvideSpecTree>" << endl;
diff --git a/paludis/metadata_key.cc b/paludis/metadata_key.cc
index 2ea3f08..8ba1edf 100644
--- a/paludis/metadata_key.cc
+++ b/paludis/metadata_key.cc
@@ -108,6 +108,7 @@ template class MetadataCollectionKey<FSPathSequence>;
template class MetadataSpecTreeKey<LicenseSpecTree>;
template class MetadataSpecTreeKey<ProvideSpecTree>;
template class MetadataSpecTreeKey<PlainTextSpecTree>;
+template class MetadataSpecTreeKey<RequiredUseSpecTree>;
#ifndef PALUDIS_NO_EXPLICIT_FULLY_SPECIALISED
template class MetadataSpecTreeKey<FetchableURISpecTree>;
template class MetadataSpecTreeKey<DependencySpecTree>;
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 102cde8..3c98c1b 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -98,6 +98,7 @@ namespace paludis
MetadataSpecTreeKey<SimpleURISpecTree>,
MetadataSpecTreeKey<ProvideSpecTree>,
MetadataSpecTreeKey<PlainTextSpecTree>,
+ MetadataSpecTreeKey<RequiredUseSpecTree>,
MetadataValueKey<std::string>,
MetadataValueKey<long>,
MetadataValueKey<bool>,
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index cdc2274..905d0e2 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -634,6 +634,19 @@ namespace
return false;
}
+ bool visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & s) const
+ {
+ switch (op)
+ {
+ case '=':
+ return false;
+ case '<':
+ return s.value()->top()->accept_returning<bool>(SpecTreeSearcher(pattern));
+ }
+
+ return false;
+ }
+
bool visit(const MetadataSpecTreeKey<ProvideSpecTree> & s) const
{
switch (op)
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index 7579955..c480d4e 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -141,6 +141,11 @@ class MetadataKeySptrToPythonVisitor
obj = bp::object(std::static_pointer_cast<const MetadataSpecTreeKey<PlainTextSpecTree> >(_m_ptr));
}
+ void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k)
+ {
+ obj = bp::object(std::static_pointer_cast<const MetadataSpecTreeKey<RequiredUseSpecTree> >(_m_ptr));
+ }
+
void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
{
obj = bp::object(std::static_pointer_cast<const MetadataSpecTreeKey<FetchableURISpecTree> >(_m_ptr));
@@ -1406,6 +1411,7 @@ void expose_metadata_key()
class_spec_tree_key<ProvideSpecTree>("ProvideSpecTree");
class_spec_tree_key<DependencySpecTree>("DependencySpecTree");
class_spec_tree_key<PlainTextSpecTree>("PlainTextSpecTree");
+ class_spec_tree_key<RequiredUseSpecTree>("RequiredUseSpecTree");
class_spec_tree_key<SimpleURISpecTree>("SimpleURISpecTree");
class_spec_tree_key<FetchableURISpecTree>("FetchableURISpecTree");
}
diff --git a/ruby/metadata_key.cc b/ruby/metadata_key.cc
index ed80d36..8745212 100644
--- a/ruby/metadata_key.cc
+++ b/ruby/metadata_key.cc
@@ -57,6 +57,7 @@ namespace
static VALUE c_metadata_simple_uri_spec_tree_key;
static VALUE c_metadata_dependency_spec_tree_key;
static VALUE c_metadata_plain_text_spec_tree_key;
+ static VALUE c_metadata_required_use_spec_tree_key;
static VALUE c_repository_mask_info;
static VALUE c_metadata_section_key;
@@ -231,6 +232,12 @@ namespace
new std::shared_ptr<const MetadataKey>(mm));
}
+ void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> &)
+ {
+ value = Data_Wrap_Struct(c_metadata_required_use_spec_tree_key, 0, &Common<std::shared_ptr<const MetadataKey> >::free,
+ new std::shared_ptr<const MetadataKey>(mm));
+ }
+
void visit(const MetadataSpecTreeKey<FetchableURISpecTree> &)
{
value = Data_Wrap_Struct(c_metadata_fetchable_uri_spec_tree_key, 0, &Common<std::shared_ptr<const MetadataKey> >::free,
@@ -848,6 +855,14 @@ namespace
rb_define_method(c_metadata_plain_text_spec_tree_key, "value", RUBY_FUNC_CAST((&SpecTreeValue<PlainTextSpecTree>::fetch)), 0);
/*
+ * Document-class: Paludis::MetadataRequiredUseSpecTreeKey
+ *
+ * Metadata class for restrict specs.
+ */
+ c_metadata_required_use_spec_tree_key = rb_define_class_under(paludis_module(), "MetadataRequiredUseSpecTreeKey", c_metadata_key);
+ rb_define_method(c_metadata_required_use_spec_tree_key, "value", RUBY_FUNC_CAST((&SpecTreeValue<RequiredUseSpecTree>::fetch)), 0);
+
+ /*
* Document-class: Paludis::MetadataDependencySpecTreeKey
*
* Metadata class for dependency specs.
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index d6b4884..7993d5e 100755
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -973,6 +973,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 MetadataSpecTreeKey<RequiredUseSpecTree> & 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 MetadataValueKey<std::shared_ptr<const Choices> > & k)
{
ColourFormatter formatter(0);
diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc
index 0a5e2bf..66e56d9 100644
--- a/src/clients/cave/cmd_info.cc
+++ b/src/clients/cave/cmd_info.cc
@@ -209,6 +209,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 MetadataSpecTreeKey<RequiredUseSpecTree> & 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 MetadataSpecTreeKey<FetchableURISpecTree> & k)
{
ColourFormatter f(indent);
diff --git a/src/clients/cave/cmd_match.cc b/src/clients/cave/cmd_match.cc
index 18c2f9b..907d362 100644
--- a/src/clients/cave/cmd_match.cc
+++ b/src/clients/cave/cmd_match.cc
@@ -300,6 +300,12 @@ namespace
k.value()->top()->accept(m);
}
+ void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k)
+ {
+ SpecTreeAsString m = { texts, match_options };
+ k.value()->top()->accept(m);
+ }
+
void visit(const MetadataSpecTreeKey<DependencySpecTree> & k)
{
SpecTreeAsString m = { texts, match_options };
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index e56024e..555e566 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -508,6 +508,33 @@ namespace
}
}
+ void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k)
+ {
+ if (cmdline.a_complex_keys.specified() || important)
+ {
+ ColourFormatter f(indent);
+ if (cmdline.a_flat.specified())
+ 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" : "")
+ );
+ else
+ {
+ 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'>(""),
+ fv<'i'>(std::string(indent, ' ')),
+ fv<'b'>(important ? "true" : "")
+ );
+ out << k.pretty_print(f);
+ }
+ }
+ }
+
void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
{
if (cmdline.a_complex_keys.specified() || important)
diff --git a/src/clients/cave/format_plain_metadata_key.cc b/src/clients/cave/format_plain_metadata_key.cc
index e469f93..8394b13 100644
--- a/src/clients/cave/format_plain_metadata_key.cc
+++ b/src/clients/cave/format_plain_metadata_key.cc
@@ -117,6 +117,12 @@ namespace
s << k.pretty_print_flat(f);
}
+ void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k)
+ {
+ StringifyFormatter f;
+ s << k.pretty_print_flat(f);
+ }
+
void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
{
StringifyFormatter f;
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index 186a4aa..7ed90b4 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -371,6 +371,21 @@ namespace
}
}
+ void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & s)
+ {
+ if (_flatten)
+ {
+ StringifyFormatter f;
+ result = _m(s.pretty_print_flat(f));
+ }
+ else
+ {
+ TreeVisitor v(_key, _visible_only, _env, _id, _m);
+ s.value()->top()->accept(v);
+ result = v.result;
+ }
+ }
+
void visit(const MetadataSpecTreeKey<DependencySpecTree> & s)
{
if (_flatten)
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index 0ac0b7f..6c74b95 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -112,6 +112,11 @@ namespace
const std::shared_ptr<const PlainTextSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
}
+ void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k)
+ {
+ const std::shared_ptr<const RequiredUseSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ }
+
void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k)
{
const std::shared_ptr<const ProvideSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index 74e5b03..746b5a7 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -106,6 +106,12 @@ namespace
std::cout << k.pretty_print_flat(f) << std::endl;
}
+ void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k)
{
StringifyFormatter f;
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index 23bb93c..35defcf 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -147,6 +147,12 @@ namespace
cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
}
+ void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k)
{
ColourFormatter f;
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 3fee156..7b2cbf1 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -540,6 +540,25 @@ namespace
}
}
+ void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & 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("");
+ task->output_stream() << k.pretty_print(formatter);
+ }
+ }
+ }
+
void visit(const MetadataCollectionKey<PackageIDSequence> & k)
{
if (k.type() == type)
diff --git a/src/output/mask_displayer.cc b/src/output/mask_displayer.cc
index 3b7e9fa..cc1c1a7 100644
--- a/src/output/mask_displayer.cc
+++ b/src/output/mask_displayer.cc
@@ -198,6 +198,12 @@ namespace
s << k.pretty_print_flat(formatter);
}
+ void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k)
+ {
+ ColourFormatter formatter;
+ s << k.pretty_print_flat(formatter);
+ }
+
void visit(const MetadataValueKey<std::shared_ptr<const Choices> > & k)
{
s << k.human_name();