aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/unwritten/unwritten_repository_file.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories/unwritten/unwritten_repository_file.cc')
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_file.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/paludis/repositories/unwritten/unwritten_repository_file.cc b/paludis/repositories/unwritten/unwritten_repository_file.cc
index 01018f60b..b9541e8b7 100644
--- a/paludis/repositories/unwritten/unwritten_repository_file.cc
+++ b/paludis/repositories/unwritten/unwritten_repository_file.cc
@@ -36,6 +36,7 @@
#include <paludis/formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/spec_tree.hh>
+#include <paludis/pretty_printer.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
@@ -116,6 +117,34 @@ namespace
}
};
+ struct UnwrittenHomepagePrettyPrinter
+ {
+ std::stringstream s;
+ const PrettyPrinter & pretty_printer;
+
+ UnwrittenHomepagePrettyPrinter(const PrettyPrinter & p) :
+ pretty_printer(p)
+ {
+ }
+
+ void visit(const SimpleURISpecTree::NodeType<AllDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const SimpleURISpecTree::NodeType<ConditionalDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const SimpleURISpecTree::NodeType<SimpleURIDepSpec>::Type & node)
+ {
+ if (! s.str().empty())
+ s << " ";
+ s << pretty_printer.prettify(*node.spec());
+ }
+ };
+
struct UnwrittenHomepageKey :
MetadataSpecTreeKey<SimpleURISpecTree>
{
@@ -167,6 +196,15 @@ namespace
{
return _type;
}
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions &) const
+ {
+ UnwrittenHomepagePrettyPrinter p(pretty_printer);
+ value()->top()->accept(p);
+ return p.s.str();
+ }
};
}