aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-30 22:48:34 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-01 03:57:53 +0000
commit3dd53676acf85d7b3d9758f2def081d20c00b3b9 (patch)
tree7214265998b38ce234a4198a4c2b9533aeea5f4d
parentcdaf7c2138035625d99ee5be127f427943b66e09 (diff)
downloadpaludis-3dd53676acf85d7b3d9758f2def081d20c00b3b9.tar.gz
paludis-3dd53676acf85d7b3d9758f2def081d20c00b3b9.tar.xz
Better pretty printing mechanism
-rw-r--r--paludis/call_pretty_printer-fwd.hh28
-rw-r--r--paludis/call_pretty_printer.cc23
-rw-r--r--paludis/call_pretty_printer.hh50
-rw-r--r--paludis/comma_separated_dep_pretty_printer-fwd.hh28
-rw-r--r--paludis/comma_separated_dep_pretty_printer.cc130
-rw-r--r--paludis/comma_separated_dep_pretty_printer.hh54
-rw-r--r--paludis/files.m44
-rw-r--r--paludis/literal_metadata_key.cc39
-rw-r--r--paludis/literal_metadata_key.hh28
-rw-r--r--paludis/metadata_key-fwd.hh3
-rw-r--r--paludis/metadata_key.hh63
-rw-r--r--paludis/pretty_print_options-fwd.hh34
-rw-r--r--paludis/pretty_print_options.cc28
-rw-r--r--paludis/pretty_print_options.hh30
-rw-r--r--paludis/pretty_print_options.se10
-rw-r--r--paludis/pretty_printer-fwd.hh28
-rw-r--r--paludis/pretty_printer.cc27
-rw-r--r--paludis/pretty_printer.hh74
-rw-r--r--paludis/repositories/accounts/accounts_dep_key.cc20
-rw-r--r--paludis/repositories/accounts/accounts_dep_key.hh6
-rw-r--r--paludis/repositories/cran/Makefile.am2
-rw-r--r--paludis/repositories/cran/keys.cc25
-rw-r--r--paludis/repositories/cran/keys.hh12
-rw-r--r--paludis/repositories/cran/spec_tree_pretty_printer.cc134
-rw-r--r--paludis/repositories/cran/spec_tree_pretty_printer.hh61
-rw-r--r--paludis/repositories/e/Makefile.am2
-rw-r--r--paludis/repositories/e/e_key.cc95
-rw-r--r--paludis/repositories/e/e_key.hh40
-rw-r--r--paludis/repositories/e/info_metadata_key.cc11
-rw-r--r--paludis/repositories/e/info_metadata_key.hh4
-rw-r--r--paludis/repositories/e/spec_tree_pretty_printer.cc545
-rw-r--r--paludis/repositories/e/spec_tree_pretty_printer.hh72
-rw-r--r--paludis/repositories/fake/fake_package_id.cc127
-rw-r--r--paludis/repositories/fake/fake_package_id.hh46
-rw-r--r--paludis/repositories/gemcutter/gemcutter_dependencies_key.cc86
-rw-r--r--paludis/repositories/gemcutter/gemcutter_dependencies_key.hh4
-rw-r--r--paludis/repositories/gemcutter/gemcutter_uri_key.cc57
-rw-r--r--paludis/repositories/gemcutter/gemcutter_uri_key.hh4
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc11
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh4
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc19
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.cc10
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.hh6
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_file.cc38
-rw-r--r--paludis/repositories/virtuals/package_id.cc9
-rw-r--r--paludis/repositories/virtuals/package_id.hh4
-rw-r--r--python/metadata_key.cc35
47 files changed, 2048 insertions, 122 deletions
diff --git a/paludis/call_pretty_printer-fwd.hh b/paludis/call_pretty_printer-fwd.hh
new file mode 100644
index 0000000..51c1cfd
--- /dev/null
+++ b/paludis/call_pretty_printer-fwd.hh
@@ -0,0 +1,28 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_CALL_PRETTY_PRINTER_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_CALL_PRETTY_PRINTER_FWD_HH 1
+
+namespace paludis
+{
+ class CallPrettyPrinter;
+}
+
+#endif
diff --git a/paludis/call_pretty_printer.cc b/paludis/call_pretty_printer.cc
new file mode 100644
index 0000000..a133c97
--- /dev/null
+++ b/paludis/call_pretty_printer.cc
@@ -0,0 +1,23 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/call_pretty_printer.hh>
+
+using namespace paludis;
+
diff --git a/paludis/call_pretty_printer.hh b/paludis/call_pretty_printer.hh
new file mode 100644
index 0000000..f59cc80
--- /dev/null
+++ b/paludis/call_pretty_printer.hh
@@ -0,0 +1,50 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_CALL_PRETTY_PRINTER_HH
+#define PALUDIS_GUARD_PALUDIS_CALL_PRETTY_PRINTER_HH 1
+
+#include <paludis/call_pretty_printer-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/pretty_printer.hh>
+
+namespace paludis
+{
+ class PALUDIS_VISIBLE CallPrettyPrinter
+ {
+ private:
+ const PrettyPrinter & _pretty_printer;
+
+ public:
+ CallPrettyPrinter(const PrettyPrinter & p) :
+ _pretty_printer(p)
+ {
+ }
+
+ CallPrettyPrinter(const CallPrettyPrinter &) = default;
+
+ template <typename T_>
+ const std::string operator() (const T_ & v) const
+ {
+ return _pretty_printer.prettify(v);
+ }
+ };
+}
+
+#endif
diff --git a/paludis/comma_separated_dep_pretty_printer-fwd.hh b/paludis/comma_separated_dep_pretty_printer-fwd.hh
new file mode 100644
index 0000000..47fe4cd
--- /dev/null
+++ b/paludis/comma_separated_dep_pretty_printer-fwd.hh
@@ -0,0 +1,28 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_COMMA_SEPARATED_DEP_PRETTY_PRINTER_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_COMMA_SEPARATED_DEP_PRETTY_PRINTER_FWD_HH 1
+
+namespace paludis
+{
+ struct CommaSeparatedDepPrettyPrinter;
+}
+
+#endif
diff --git a/paludis/comma_separated_dep_pretty_printer.cc b/paludis/comma_separated_dep_pretty_printer.cc
new file mode 100644
index 0000000..e37c8eb
--- /dev/null
+++ b/paludis/comma_separated_dep_pretty_printer.cc
@@ -0,0 +1,130 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/comma_separated_dep_pretty_printer.hh>
+#include <paludis/util/pimp-impl.hh>
+#include <paludis/util/options.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/pretty_printer.hh>
+#include <algorithm>
+#include <sstream>
+
+using namespace paludis;
+
+namespace paludis
+{
+ template <>
+ struct Imp<CommaSeparatedDepPrettyPrinter>
+ {
+ std::stringstream s;
+
+ const PrettyPrinter & pretty_printer;
+ const PrettyPrintOptions options;
+
+ bool need_comma;
+
+ Imp(
+ const PrettyPrinter & p,
+ const PrettyPrintOptions & o) :
+ pretty_printer(p),
+ options(o),
+ need_comma(false)
+ {
+ }
+ };
+}
+
+CommaSeparatedDepPrettyPrinter::CommaSeparatedDepPrettyPrinter(
+ const PrettyPrinter & p, const PrettyPrintOptions & o) :
+ Pimp<CommaSeparatedDepPrettyPrinter>(p, o)
+{
+}
+
+CommaSeparatedDepPrettyPrinter::~CommaSeparatedDepPrettyPrinter()
+{
+}
+
+void
+CommaSeparatedDepPrettyPrinter::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
+{
+ if (_imp->options[ppo_multiline_allowed])
+ _imp->s << _imp->pretty_printer.indentify(0);
+ else if (_imp->need_comma)
+ _imp->s << ", ";
+ else
+ _imp->need_comma = true;
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec());
+
+ if (_imp->options[ppo_multiline_allowed])
+ _imp->s << _imp->pretty_printer.newline();
+}
+
+void
+CommaSeparatedDepPrettyPrinter::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
+{
+}
+
+void
+CommaSeparatedDepPrettyPrinter::visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &)
+{
+}
+
+void
+CommaSeparatedDepPrettyPrinter::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
+{
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+}
+
+void
+CommaSeparatedDepPrettyPrinter::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
+{
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+}
+
+void
+CommaSeparatedDepPrettyPrinter::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
+{
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+}
+
+void
+CommaSeparatedDepPrettyPrinter::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
+{
+ if (_imp->options[ppo_multiline_allowed])
+ _imp->s << _imp->pretty_printer.indentify(0);
+ else if (_imp->need_comma)
+ _imp->s << ", ";
+ else
+ _imp->need_comma = true;
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec());
+
+ if (_imp->options[ppo_multiline_allowed])
+ _imp->s << _imp->pretty_printer.newline();
+}
+
+const std::string
+CommaSeparatedDepPrettyPrinter::result() const
+{
+ return _imp->s.str();
+}
+
diff --git a/paludis/comma_separated_dep_pretty_printer.hh b/paludis/comma_separated_dep_pretty_printer.hh
new file mode 100644
index 0000000..e4a07fb
--- /dev/null
+++ b/paludis/comma_separated_dep_pretty_printer.hh
@@ -0,0 +1,54 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007, 2008, 2009, 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_COMMA_SEPARATED_DEP_PRETTY_PRINTER_HH
+#define PALUDIS_GUARD_PALUDIS_COMMA_SEPARATED_DEP_PRETTY_PRINTER_HH 1
+
+#include <paludis/util/pimp.hh>
+#include <paludis/spec_tree.hh>
+#include <paludis/formatter.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/pretty_printer-fwd.hh>
+#include <paludis/pretty_print_options-fwd.hh>
+
+namespace paludis
+{
+ class PALUDIS_VISIBLE CommaSeparatedDepPrettyPrinter :
+ private Pimp<CommaSeparatedDepPrettyPrinter>
+ {
+ public:
+ CommaSeparatedDepPrettyPrinter(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &);
+
+ ~CommaSeparatedDepPrettyPrinter();
+
+ const std::string result() const;
+
+ void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node);
+ };
+}
+
+#endif
diff --git a/paludis/files.m4 b/paludis/files.m4
index 0ab91b0..cfc72e8 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -17,9 +17,11 @@ add(`always_enabled_dependency_label', `hh', `cc', `fwd')
add(`broken_linkage_configuration', `hh', `cc', `test', `testscript')
add(`broken_linkage_finder', `hh', `cc')
add(`buffer_output_manager', `hh', `cc', `fwd')
+add(`call_pretty_printer', `hh', `cc', `fwd')
add(`changed_choices', `hh', `cc', `fwd')
add(`choice', `hh', `cc', `fwd')
add(`comma_separated_dep_parser', `hh', `cc', `test')
+add(`comma_separated_dep_pretty_printer', `hh', `cc', `fwd')
add(`comma_separated_dep_printer', `hh', `cc')
add(`command_output_manager', `hh', `cc', `fwd')
add(`common_sets', `hh', `cc', `fwd')
@@ -81,6 +83,8 @@ add(`package_id', `hh', `cc', `fwd', `se')
add(`paludis', `hh')
add(`paludislike_options_conf', `hh', `cc', `fwd')
add(`partially_made_package_dep_spec', `hh', `cc', `fwd', `se')
+add(`pretty_print_options', `hh', `cc', `fwd', `se')
+add(`pretty_printer', `hh', `cc', `fwd')
add(`repository', `hh', `fwd', `cc')
add(`repository_factory', `hh', `fwd', `cc')
add(`repository_name_cache', `hh', `cc', `test', `testscript')
diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc
index 51a6edf..5a64b8e 100644
--- a/paludis/literal_metadata_key.cc
+++ b/paludis/literal_metadata_key.cc
@@ -28,6 +28,8 @@
#include <paludis/action.hh>
#include <paludis/repository.hh>
#include <paludis/name.hh>
+#include <paludis/pretty_printer.hh>
+#include <paludis/call_pretty_printer.hh>
#include <functional>
using namespace paludis;
@@ -157,6 +159,13 @@ LiteralMetadataFSPathSequenceKey::pretty_print_flat(const Formatter<FSPath> & f)
}
const std::string
+LiteralMetadataFSPathSequenceKey::pretty_print_value(
+ const PrettyPrinter & p, const PrettyPrintOptions &) const
+{
+ return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p));
+}
+
+const std::string
LiteralMetadataFSPathSequenceKey::human_name() const
{
return _imp->human_name;
@@ -256,6 +265,13 @@ namespace
}
}
+const std::string
+LiteralMetadataStringSetKey::pretty_print_value(
+ const PrettyPrinter & p, const PrettyPrintOptions &) const
+{
+ return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p));
+}
+
std::string
LiteralMetadataStringSetKey::pretty_print_flat(const Formatter<std::string> & f) const
{
@@ -263,6 +279,13 @@ LiteralMetadataStringSetKey::pretty_print_flat(const Formatter<std::string> & f)
return join(value()->begin(), value()->end(), " ", std::bind(&format_string, _1, f));
}
+const std::string
+LiteralMetadataStringStringMapKey::pretty_print_value(
+ const PrettyPrinter & p, const PrettyPrintOptions &) const
+{
+ return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p));
+}
+
std::string
LiteralMetadataStringStringMapKey::pretty_print_flat(const Formatter<std::pair<const std::string, std::string> > & f) const
{
@@ -270,6 +293,13 @@ LiteralMetadataStringStringMapKey::pretty_print_flat(const Formatter<std::pair<c
return join(value()->begin(), value()->end(), " ", std::bind(&format_string_string, _1, f));
}
+const std::string
+LiteralMetadataStringSequenceKey::pretty_print_value(
+ const PrettyPrinter & p, const PrettyPrintOptions &) const
+{
+ return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p));
+}
+
std::string
LiteralMetadataStringSequenceKey::pretty_print_flat(const Formatter<std::string> & f) const
{
@@ -394,6 +424,15 @@ LiteralMetadataValueKey<T_>::value() const
return _imp->value;
}
+template <typename T_>
+const std::string
+PrettyPrintableLiteralMetadataValueKey<T_>::pretty_print_value(
+ const PrettyPrinter & printer,
+ const PrettyPrintOptions &) const
+{
+ return printer.prettify(this->value());
+}
+
namespace paludis
{
template <>
diff --git a/paludis/literal_metadata_key.hh b/paludis/literal_metadata_key.hh
index b514e1f..1f49f50 100644
--- a/paludis/literal_metadata_key.hh
+++ b/paludis/literal_metadata_key.hh
@@ -100,6 +100,16 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
};
+ template <typename T_>
+ class PALUDIS_VISIBLE PrettyPrintableLiteralMetadataValueKey :
+ public MetadataValueKey<T_>
+ {
+ public:
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
/**
* A LiteralMetadataValueKey is a MetadataValueKey whose value is a
* copyable literal that is known at construction time.
@@ -109,7 +119,7 @@ namespace paludis
*/
template <typename T_>
class PALUDIS_VISIBLE LiteralMetadataValueKey :
- public MetadataValueKey<T_>,
+ public std::conditional<MetadataValueKeyIsPrettyPrintable<T_>::value, PrettyPrintableLiteralMetadataValueKey<T_>, MetadataValueKey<T_> >::type,
private Pimp<LiteralMetadataValueKey<T_> >,
public ExtraLiteralMetadataValueKeyMethods<T_>
{
@@ -170,6 +180,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -204,6 +218,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -238,6 +256,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -303,6 +325,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/metadata_key-fwd.hh b/paludis/metadata_key-fwd.hh
index d221c68..525b0ee 100644
--- a/paludis/metadata_key-fwd.hh
+++ b/paludis/metadata_key-fwd.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
@@ -33,6 +33,7 @@
namespace paludis
{
class MetadataKey;
+ class PrettyPrintableMetadataKey;
class MetadataSectionKey;
class MetadataTimeKey;
template <typename C_> class MetadataCollectionKey;
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 3c98c1b..3b3320c 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -31,6 +31,8 @@
#include <paludis/formatter-fwd.hh>
#include <paludis/metadata_key_holder.hh>
#include <paludis/choice-fwd.hh>
+#include <paludis/pretty_printer-fwd.hh>
+#include <paludis/pretty_print_options-fwd.hh>
#include <paludis/util/fs_path-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/remove_shared_ptr.hh>
@@ -141,6 +143,26 @@ namespace paludis
};
/**
+ * A PrettyPrintableMetadataKey is a MetadataKey with a pretty printable value.
+ *
+ * \since 0.58
+ * \ingroup g_metadata_key
+ */
+ class PALUDIS_VISIBLE PrettyPrintableMetadataKey :
+ public MetadataKey
+ {
+ public:
+ /**
+ * Pretty print our value.
+ *
+ * \since 0.58
+ */
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+ };
+
+ /**
* A MetadataSectionKey is a MetadataKey that holds a number of other
* MetadataKey instances.
*
@@ -232,6 +254,37 @@ namespace paludis
};
/**
+ * Selects whether a MetadataValueKey instantiation is a
+ * PrettyPrintableMetadataKey.
+ *
+ * \since 0.58
+ * \ingroup g_metadata_key
+ */
+ template <typename C_>
+ struct MetadataValueKeyIsPrettyPrintable
+ {
+ enum { value = false };
+ };
+
+ template <>
+ struct MetadataValueKeyIsPrettyPrintable<std::shared_ptr<const PackageID> >
+ {
+ enum { value = true };
+ };
+
+ template <>
+ struct MetadataValueKeyIsPrettyPrintable<long>
+ {
+ enum { value = true };
+ };
+
+ template <>
+ struct MetadataValueKeyIsPrettyPrintable<bool>
+ {
+ enum { value = true };
+ };
+
+ /**
* A MetadataValueKey is a MetadataKey that holds some simple type
* as its value.
*
@@ -241,7 +294,7 @@ namespace paludis
*/
template <typename C_>
class PALUDIS_VISIBLE MetadataValueKey :
- public MetadataKey,
+ public std::conditional<MetadataValueKeyIsPrettyPrintable<C_>::value, PrettyPrintableMetadataKey, MetadataKey>::type,
public ImplementAcceptMethods<MetadataKey, MetadataValueKey<C_> >,
public virtual ExtraMetadataValueKeyMethods<C_>
{
@@ -289,7 +342,7 @@ namespace paludis
*/
template <typename C_>
class PALUDIS_VISIBLE MetadataCollectionKey :
- public MetadataKey,
+ public PrettyPrintableMetadataKey,
public ImplementAcceptMethods<MetadataKey, MetadataCollectionKey<C_> >
{
public:
@@ -320,7 +373,7 @@ namespace paludis
*/
template <typename C_>
class PALUDIS_VISIBLE MetadataSpecTreeKey :
- public MetadataKey,
+ public PrettyPrintableMetadataKey,
public ImplementAcceptMethods<MetadataKey, MetadataSpecTreeKey<C_> >
{
public:
@@ -360,7 +413,7 @@ namespace paludis
*/
template <>
class PALUDIS_VISIBLE MetadataSpecTreeKey<FetchableURISpecTree> :
- public MetadataKey,
+ public PrettyPrintableMetadataKey,
public ImplementAcceptMethods<MetadataKey, MetadataSpecTreeKey<FetchableURISpecTree> >
{
public:
@@ -407,7 +460,7 @@ namespace paludis
*/
template <>
class PALUDIS_VISIBLE MetadataSpecTreeKey<DependencySpecTree> :
- public MetadataKey,
+ public PrettyPrintableMetadataKey,
public ImplementAcceptMethods<MetadataKey, MetadataSpecTreeKey<DependencySpecTree> >
{
public:
diff --git a/paludis/pretty_print_options-fwd.hh b/paludis/pretty_print_options-fwd.hh
new file mode 100644
index 0000000..6f34700
--- /dev/null
+++ b/paludis/pretty_print_options-fwd.hh
@@ -0,0 +1,34 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_PRETTY_PRINT_OPTIONS_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_PRETTY_PRINT_OPTIONS_FWD_HH 1
+
+#include <iosfwd>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/options.hh>
+
+namespace paludis
+{
+#include <paludis/pretty_print_options-se.hh>
+
+ typedef Options<PrettyPrintOption> PrettyPrintOptions;
+}
+
+#endif
diff --git a/paludis/pretty_print_options.cc b/paludis/pretty_print_options.cc
new file mode 100644
index 0000000..1ea473d
--- /dev/null
+++ b/paludis/pretty_print_options.cc
@@ -0,0 +1,28 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/pretty_print_options.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/stringify.hh>
+#include <ostream>
+
+using namespace paludis;
+
+#include <paludis/pretty_print_options-se.cc>
+
diff --git a/paludis/pretty_print_options.hh b/paludis/pretty_print_options.hh
new file mode 100644
index 0000000..d65bd77
--- /dev/null
+++ b/paludis/pretty_print_options.hh
@@ -0,0 +1,30 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_PRETTY_PRINT_OPTIONS_HH
+#define PALUDIS_GUARD_PALUDIS_PRETTY_PRINT_OPTIONS_HH 1
+
+#include <paludis/pretty_print_options-fwd.hh>
+
+namespace paludis
+{
+
+}
+
+#endif
diff --git a/paludis/pretty_print_options.se b/paludis/pretty_print_options.se
new file mode 100644
index 0000000..62e0202
--- /dev/null
+++ b/paludis/pretty_print_options.se
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_PrettyPrintOption()
+{
+ prefix ppo
+
+ key ppo_multiline_allowed "Print over multiple lines if appropriate"
+}
+
diff --git a/paludis/pretty_printer-fwd.hh b/paludis/pretty_printer-fwd.hh
new file mode 100644
index 0000000..b704df3
--- /dev/null
+++ b/paludis/pretty_printer-fwd.hh
@@ -0,0 +1,28 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_PRETTY_PRINTER_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_PRETTY_PRINTER_FWD_HH 1
+
+namespace paludis
+{
+ class PrettyPrinter;
+}
+
+#endif
diff --git a/paludis/pretty_printer.cc b/paludis/pretty_printer.cc
new file mode 100644
index 0000000..54b767c
--- /dev/null
+++ b/paludis/pretty_printer.cc
@@ -0,0 +1,27 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/pretty_printer.hh>
+
+using namespace paludis;
+
+PrettyPrinter::PrettyPrinter() = default;
+
+PrettyPrinter::~PrettyPrinter() = default;
+
diff --git a/paludis/pretty_printer.hh b/paludis/pretty_printer.hh
new file mode 100644
index 0000000..9369d1b
--- /dev/null
+++ b/paludis/pretty_printer.hh
@@ -0,0 +1,74 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_PRETTY_PRINTER_HH
+#define PALUDIS_GUARD_PALUDIS_PRETTY_PRINTER_HH 1
+
+#include <paludis/pretty_printer-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/fs_path-fwd.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/name-fwd.hh>
+#include <string>
+#include <memory>
+
+namespace paludis
+{
+ class PALUDIS_VISIBLE PrettyPrinter
+ {
+ public:
+ PrettyPrinter();
+ virtual ~PrettyPrinter() = 0;
+
+ PrettyPrinter(const PrettyPrinter &) = delete;
+ PrettyPrinter & operator= (const PrettyPrinter &) = delete;
+
+ virtual const std::string indentify(const int) const = 0;
+ virtual const std::string newline() const = 0;
+
+ virtual const std::string prettify(const PackageDepSpec &) const = 0;
+ virtual const std::string prettify(const BlockDepSpec &) const = 0;
+ virtual const std::string prettify(const ConditionalDepSpec &) const = 0;
+ virtual const std::string prettify(const NamedSetDepSpec &) const = 0;
+ virtual const std::string prettify(const SimpleURIDepSpec &) const = 0;
+ virtual const std::string prettify(const PlainTextDepSpec &) const = 0;
+ virtual const std::string prettify(const LicenseDepSpec &) const = 0;
+ virtual const std::string prettify(const FetchableURIDepSpec &) const = 0;
+ virtual const std::string prettify(const URILabelsDepSpec &) const = 0;
+ virtual const std::string prettify(const DependenciesLabelsDepSpec &) const = 0;
+ virtual const std::string prettify(const PlainTextLabelDepSpec &) const = 0;
+
+ virtual const std::string prettify(const std::shared_ptr<const PackageID> &) const = 0;
+
+ virtual const std::string prettify(const bool) const = 0;
+
+ virtual const std::string prettify(const long) const = 0;
+
+ virtual const std::string prettify(const std::string &) const = 0;
+
+ virtual const std::string prettify(const std::pair<const std::string, std::string> &) const = 0;
+
+ virtual const std::string prettify(const FSPath &) const = 0;
+
+ virtual const std::string prettify(const KeywordName &) const = 0;
+ };
+}
+
+#endif
diff --git a/paludis/repositories/accounts/accounts_dep_key.cc b/paludis/repositories/accounts/accounts_dep_key.cc
index d208bee..d7d3aec 100644
--- a/paludis/repositories/accounts/accounts_dep_key.cc
+++ b/paludis/repositories/accounts/accounts_dep_key.cc
@@ -32,6 +32,7 @@
#include <paludis/util/pimp-impl.hh>
#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/always_enabled_dependency_label.hh>
+#include <paludis/pretty_printer.hh>
#include <sstream>
#include <list>
@@ -155,3 +156,22 @@ AccountsDepKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) c
return s.str();
}
+const std::string
+AccountsDepKey::pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions &) const
+{
+ std::stringstream s;
+
+ for (std::list<std::shared_ptr<PackageDepSpec> >::const_iterator i(_imp->specs->begin()),
+ i_end(_imp->specs->end()) ; i != i_end ; ++i)
+ {
+ if (! s.str().empty())
+ s << ", ";
+
+ s << pretty_printer.prettify(**i);
+ }
+
+ return s.str();
+}
+
diff --git a/paludis/repositories/accounts/accounts_dep_key.hh b/paludis/repositories/accounts/accounts_dep_key.hh
index b31cdc2..d269c00 100644
--- a/paludis/repositories/accounts/accounts_dep_key.hh
+++ b/paludis/repositories/accounts/accounts_dep_key.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009 Ciaran McCreesh
+ * Copyright (c) 2009, 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
@@ -49,6 +49,10 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/cran/Makefile.am b/paludis/repositories/cran/Makefile.am
index 63e3138..7746b53 100644
--- a/paludis/repositories/cran/Makefile.am
+++ b/paludis/repositories/cran/Makefile.am
@@ -22,6 +22,7 @@ noinst_HEADERS = \
keys.hh \
normalise.hh \
dep_spec_pretty_printer.hh \
+ spec_tree_pretty_printer.hh \
package_dep_spec.hh
libpaludiscranrepository_la_SOURCES = \
@@ -35,6 +36,7 @@ libpaludiscranrepository_la_SOURCES = \
masks.cc \
keys.cc \
dep_spec_pretty_printer.cc \
+ spec_tree_pretty_printer.cc \
package_dep_spec.cc \
$(paludis_repositories_cran_include_HEADERS)
diff --git a/paludis/repositories/cran/keys.cc b/paludis/repositories/cran/keys.cc
index 02f0e4c..de39723 100644
--- a/paludis/repositories/cran/keys.cc
+++ b/paludis/repositories/cran/keys.cc
@@ -21,6 +21,7 @@
#include <paludis/repositories/cran/cran_package_id.hh>
#include <paludis/repositories/cran/cran_dep_parser.hh>
#include <paludis/repositories/cran/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/cran/spec_tree_pretty_printer.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/join.hh>
@@ -34,6 +35,7 @@
#include <paludis/repository.hh>
#include <paludis/environment.hh>
#include <paludis/package_database.hh>
+#include <paludis/call_pretty_printer.hh>
#include <functional>
using namespace paludis;
@@ -89,6 +91,14 @@ PackageIDSequenceKey::pretty_print_flat(const Formatter<PackageID> & f) const
std::cref(f), _1, format::Plain()));
}
+const std::string
+PackageIDSequenceKey::pretty_print_value(
+ const PrettyPrinter & p, const PrettyPrintOptions &) const
+{
+ using namespace std::placeholders;
+ return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p));
+}
+
PackageIDKey::PackageIDKey(const Environment * const e, const std::string & r, const std::string & h,
const CRANPackageID * const v, const MetadataKeyType t) :
_env(e),
@@ -106,6 +116,12 @@ PackageIDKey::value() const
}
const std::string
+PackageIDKey::pretty_print_value(const PrettyPrinter & p, const PrettyPrintOptions &) const
+{
+ return p.prettify(value());
+}
+
+const std::string
PackageIDKey::raw_name() const
{
return _r;
@@ -229,6 +245,15 @@ DepKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const
return stringify(p);
}
+const std::string
+DepKey::pretty_print_value(
+ const PrettyPrinter & printer, const PrettyPrintOptions & options) const
+{
+ SpecTreePrettyPrinter p(printer, options);
+ value()->top()->accept(p);
+ return stringify(p);
+}
+
const std::shared_ptr<const DependenciesLabelSequence>
DepKey::initial_labels() const
{
diff --git a/paludis/repositories/cran/keys.hh b/paludis/repositories/cran/keys.hh
index c2b3888..4faa602 100644
--- a/paludis/repositories/cran/keys.hh
+++ b/paludis/repositories/cran/keys.hh
@@ -56,6 +56,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class PackageIDKey :
@@ -81,6 +85,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class DepKey :
@@ -112,6 +120,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/cran/spec_tree_pretty_printer.cc b/paludis/repositories/cran/spec_tree_pretty_printer.cc
new file mode 100644
index 0000000..40e4339
--- /dev/null
+++ b/paludis/repositories/cran/spec_tree_pretty_printer.cc
@@ -0,0 +1,134 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/cran/spec_tree_pretty_printer.hh>
+#include <paludis/util/pimp-impl.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/options.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <paludis/pretty_printer.hh>
+#include <algorithm>
+#include <ostream>
+#include <sstream>
+
+using namespace paludis;
+using namespace paludis::cranrepository;
+
+namespace paludis
+{
+ template <>
+ struct Imp<SpecTreePrettyPrinter>
+ {
+ std::stringstream s;
+ const PrettyPrinter & printer;
+ const PrettyPrintOptions options;
+ const unsigned indent;
+ const bool multiline;
+ bool need_comma;
+
+ Imp(
+ const PrettyPrinter & p, const PrettyPrintOptions & o) :
+ printer(p),
+ options(o),
+ indent(0),
+ multiline(o[ppo_multiline_allowed]),
+ need_comma(false)
+ {
+ }
+ };
+}
+
+SpecTreePrettyPrinter::SpecTreePrettyPrinter(
+ const PrettyPrinter & p, const PrettyPrintOptions & o) :
+ Pimp<SpecTreePrettyPrinter>(p, o)
+{
+}
+
+SpecTreePrettyPrinter::~SpecTreePrettyPrinter()
+{
+}
+
+void
+SpecTreePrettyPrinter::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
+{
+ if (_imp->multiline)
+ _imp->s << _imp->printer.indentify(_imp->indent);
+ else if (_imp->need_comma)
+ _imp->s << ", ";
+ else
+ _imp->need_comma = true;
+
+ _imp->s << _imp->printer.prettify(*node.spec());
+
+ if (_imp->multiline)
+ _imp->s << _imp->printer.newline();
+}
+
+void
+SpecTreePrettyPrinter::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
+{
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+}
+
+void
+SpecTreePrettyPrinter::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
+{
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+}
+
+void
+SpecTreePrettyPrinter::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
+{
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+}
+
+void
+SpecTreePrettyPrinter::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
+{
+}
+
+void
+SpecTreePrettyPrinter::visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &)
+{
+}
+
+void
+SpecTreePrettyPrinter::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
+{
+ if (_imp->multiline)
+ _imp->s << _imp->printer.indentify(_imp->indent);
+ else if (_imp->need_comma)
+ _imp->s << ", ";
+ else
+ _imp->need_comma = true;
+
+ _imp->s << _imp->printer.prettify(*node.spec());
+
+ if (_imp->multiline)
+ _imp->s << _imp->printer.newline();
+}
+
+std::ostream &
+paludis::cranrepository::operator<< (std::ostream & s, const SpecTreePrettyPrinter & p)
+{
+ s << p._imp->s.str();
+ return s;
+}
+
diff --git a/paludis/repositories/cran/spec_tree_pretty_printer.hh b/paludis/repositories/cran/spec_tree_pretty_printer.hh
new file mode 100644
index 0000000..78e2994
--- /dev/null
+++ b/paludis/repositories/cran/spec_tree_pretty_printer.hh
@@ -0,0 +1,61 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_CRAN_SPEC_TREE_PRETTY_PRINTER_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_CRAN_SPEC_TREE_PRETTY_PRINTER_HH 1
+
+#include <paludis/util/pimp.hh>
+#include <paludis/spec_tree.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <paludis/formatter.hh>
+#include <paludis/pretty_print_options-fwd.hh>
+#include <paludis/pretty_printer-fwd.hh>
+#include <iosfwd>
+
+namespace paludis
+{
+ namespace cranrepository
+ {
+ class PALUDIS_VISIBLE SpecTreePrettyPrinter :
+ private Pimp<SpecTreePrettyPrinter>
+ {
+ friend std::ostream & operator<< (std::ostream &, const SpecTreePrettyPrinter &);
+
+ public:
+ SpecTreePrettyPrinter(
+ const PrettyPrinter & p, const PrettyPrintOptions &);
+
+ ~SpecTreePrettyPrinter();
+
+ ///\}
+
+ void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node);
+ void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node);
+ };
+
+ std::ostream & operator<< (std::ostream & s, const SpecTreePrettyPrinter & p) PALUDIS_VISIBLE;
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index 4623584..b9f2e6e 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -83,6 +83,7 @@ noinst_HEADERS = \
profile_file.hh \
required_use_verifier.hh \
source_uri_finder.hh \
+ spec_tree_pretty_printer.hh \
traditional_layout.hh \
traditional_profile.hh \
use_desc.hh \
@@ -153,6 +154,7 @@ libpaludiserepository_la_SOURCES = \
registration.cc \
required_use_verifier.cc \
source_uri_finder.cc \
+ spec_tree_pretty_printer.cc \
traditional_layout.cc \
traditional_profile.cc \
use_desc.cc \
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 61bef82..3a7bd52 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -25,6 +25,7 @@
#include <paludis/repositories/e/vdb_contents_tokeniser.hh>
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/e/myoption.hh>
+#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/util/pretty_print.hh>
#include <paludis/util/pimp-impl.hh>
@@ -51,6 +52,7 @@
#include <paludis/stringify_formatter-impl.hh>
#include <paludis/dep_spec_flattener.hh>
#include <paludis/literal_metadata_key.hh>
+#include <paludis/call_pretty_printer.hh>
#include <algorithm>
#include <functional>
@@ -167,6 +169,16 @@ EDependenciesKey::initial_labels() const
return _imp->labels;
}
+const std::string
+EDependenciesKey::pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions & options) const
+{
+ SpecTreePrettyPrinter p(pretty_printer, options);
+ value()->top()->accept(p);
+ return stringify(p);
+}
+
std::string
EDependenciesKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
{
@@ -254,6 +266,16 @@ ELicenseKey::value() const
return _imp->value;
}
+const std::string
+ELicenseKey::pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions & options) const
+{
+ SpecTreePrettyPrinter p(pretty_printer, options);
+ value()->top()->accept(p);
+ return stringify(p);
+}
+
std::string
ELicenseKey::pretty_print(const LicenseSpecTree::ItemFormatter & f) const
{
@@ -342,6 +364,16 @@ EFetchableURIKey::value() const
return _imp->value;
}
+const std::string
+EFetchableURIKey::pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions & options) const
+{
+ SpecTreePrettyPrinter p(pretty_printer, options);
+ value()->top()->accept(p);
+ return stringify(p);
+}
+
std::string
EFetchableURIKey::pretty_print(const FetchableURISpecTree::ItemFormatter & f) const
{
@@ -467,6 +499,16 @@ ESimpleURIKey::value() const
return _imp->value;
}
+const std::string
+ESimpleURIKey::pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions & options) const
+{
+ SpecTreePrettyPrinter p(pretty_printer, options);
+ value()->top()->accept(p);
+ return stringify(p);
+}
+
std::string
ESimpleURIKey::pretty_print(const SimpleURISpecTree::ItemFormatter & f) const
{
@@ -554,6 +596,16 @@ EPlainTextSpecKey::value() const
return _imp->value;
}
+const std::string
+EPlainTextSpecKey::pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions & options) const
+{
+ SpecTreePrettyPrinter p(pretty_printer, options);
+ value()->top()->accept(p);
+ return stringify(p);
+}
+
std::string
EPlainTextSpecKey::pretty_print(const PlainTextSpecTree::ItemFormatter & f) const
{
@@ -642,6 +694,16 @@ EMyOptionsKey::value() const
return _imp->value;
}
+const std::string
+EMyOptionsKey::pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions & options) const
+{
+ SpecTreePrettyPrinter p(pretty_printer, options);
+ value()->top()->accept(p);
+ return stringify(p);
+}
+
std::string
EMyOptionsKey::pretty_print(const PlainTextSpecTree::ItemFormatter & f) const
{
@@ -730,6 +792,16 @@ ERequiredUseKey::value() const
return _imp->value;
}
+const std::string
+ERequiredUseKey::pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions & options) const
+{
+ SpecTreePrettyPrinter p(pretty_printer, options);
+ value()->top()->accept(p);
+ return stringify(p);
+}
+
std::string
ERequiredUseKey::pretty_print(const RequiredUseSpecTree::ItemFormatter & f) const
{
@@ -817,6 +889,16 @@ EProvideKey::value() const
return _imp->value;
}
+const std::string
+EProvideKey::pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions & options) const
+{
+ SpecTreePrettyPrinter p(pretty_printer, options);
+ value()->top()->accept(p);
+ return stringify(p);
+}
+
std::string
EProvideKey::pretty_print(const ProvideSpecTree::ItemFormatter & f) const
{
@@ -904,6 +986,12 @@ EKeywordsKey::value() const
return _imp->value;
}
+const std::string
+EKeywordsKey::pretty_print_value(const PrettyPrinter & p, const PrettyPrintOptions &) const
+{
+ return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p));
+}
+
std::string
EKeywordsKey::pretty_print_flat(const Formatter<KeywordName> & f) const
{
@@ -1026,6 +1114,13 @@ EStringSetKey::pretty_print_flat(const Formatter<std::string> & f) const
return join(value()->begin(), value()->end(), " ", std::bind(&format_string, _1, f));
}
+const std::string
+EStringSetKey::pretty_print_value(
+ const PrettyPrinter & p, const PrettyPrintOptions &) const
+{
+ return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p));
+}
+
namespace paludis
{
template <>
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index 62f344d..6589da8 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -85,6 +85,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EFetchableURIKey :
@@ -114,6 +118,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class ESimpleURIKey :
@@ -138,6 +146,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EPlainTextSpecKey :
@@ -163,6 +175,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EMyOptionsKey :
@@ -187,6 +203,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class ERequiredUseKey :
@@ -211,6 +231,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EProvideKey :
@@ -235,6 +259,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class ELicenseKey :
@@ -261,6 +289,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EKeywordsKey :
@@ -283,6 +315,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EStringSetKey :
@@ -303,6 +339,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class EContentsKey :
diff --git a/paludis/repositories/e/info_metadata_key.cc b/paludis/repositories/e/info_metadata_key.cc
index 1e78bc5..1174449 100644
--- a/paludis/repositories/e/info_metadata_key.cc
+++ b/paludis/repositories/e/info_metadata_key.cc
@@ -42,6 +42,8 @@
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
#include <paludis/formatter.hh>
+#include <paludis/pretty_printer.hh>
+#include <paludis/call_pretty_printer.hh>
#include <map>
#include <algorithm>
@@ -225,6 +227,15 @@ InfoVarsMetadataKey::pretty_print_flat(const Formatter<std::string> & f) const
}
const std::string
+InfoVarsMetadataKey::pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions &) const
+{
+ using namespace std::placeholders;
+ return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(pretty_printer));
+}
+
+const std::string
InfoPkgsMetadataKey::raw_name() const
{
return "info_pkgs";
diff --git a/paludis/repositories/e/info_metadata_key.hh b/paludis/repositories/e/info_metadata_key.hh
index e4db751..ea3dc9f 100644
--- a/paludis/repositories/e/info_metadata_key.hh
+++ b/paludis/repositories/e/info_metadata_key.hh
@@ -50,6 +50,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/repositories/e/spec_tree_pretty_printer.cc b/paludis/repositories/e/spec_tree_pretty_printer.cc
new file mode 100644
index 0000000..363d5e0
--- /dev/null
+++ b/paludis/repositories/e/spec_tree_pretty_printer.cc
@@ -0,0 +1,545 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/save.hh>
+#include <paludis/util/accept_visitor.hh>
+#include <paludis/util/pimp-impl.hh>
+#include <paludis/pretty_printer.hh>
+#include <paludis/dep_spec_annotations.hh>
+#include <algorithm>
+#include <sstream>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace paludis
+{
+ template<>
+ struct Imp<SpecTreePrettyPrinter>
+ {
+ std::stringstream s;
+ const PrettyPrinter & pretty_printer;
+ const PrettyPrintOptions options;
+
+ unsigned indent;
+ bool extra_label_indent;
+ bool use_newlines;
+ bool outer_block;
+ bool all_needs_parens;
+ bool need_space;
+
+ Imp(const PrettyPrinter & p, const PrettyPrintOptions & o) :
+ pretty_printer(p),
+ options(o),
+ indent(0),
+ extra_label_indent(false),
+ use_newlines(options[ppo_multiline_allowed]),
+ outer_block(true),
+ all_needs_parens(false),
+ need_space(false)
+ {
+ }
+ };
+}
+
+SpecTreePrettyPrinter::SpecTreePrettyPrinter(
+ const PrettyPrinter & p,
+ const PrettyPrintOptions & o) :
+ Pimp<SpecTreePrettyPrinter>(p, o)
+{
+}
+
+SpecTreePrettyPrinter::~SpecTreePrettyPrinter() = default;
+
+std::ostream &
+paludis::erepository::operator<< (std::ostream & s, const SpecTreePrettyPrinter & p)
+{
+ s << p._imp->s.str();
+ return s;
+}
+
+namespace
+{
+ struct IsLabelVisitor
+ {
+ bool result;
+
+ IsLabelVisitor() :
+ result(false)
+ {
+ }
+
+ void visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type &)
+ {
+ }
+
+ void visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type &)
+ {
+ }
+
+ void visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type &)
+ {
+ }
+
+ void visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type &)
+ {
+ }
+
+ void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type &)
+ {
+ }
+
+ void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type &)
+ {
+ }
+
+ void visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type &)
+ {
+ result = true;
+ }
+
+ void visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type &)
+ {
+ result = true;
+ }
+
+ void visit(const GenericSpecTree::NodeType<DependenciesLabelsDepSpec>::Type &)
+ {
+ result = true;
+ }
+
+ void visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type &)
+ {
+ }
+
+ void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type &)
+ {
+ }
+
+ void visit(const GenericSpecTree::NodeType<ExactlyOneDepSpec>::Type &)
+ {
+ }
+
+ void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type &)
+ {
+ }
+
+ void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type &)
+ {
+ }
+ };
+
+ bool is_label(const GenericSpecTree::BasicNode & i)
+ {
+ IsLabelVisitor v;
+ i.accept(v);
+ return v.result;
+ }
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node)
+{
+ bool need_parens(_imp->all_needs_parens || node.spec()->maybe_annotations() ||
+ (! _imp->outer_block && indirect_iterator(node.end()) != std::find_if(indirect_iterator(node.begin()),
+ indirect_iterator(node.end()),
+ is_label)));
+ Save<bool> old_outer(&_imp->outer_block, false);
+ Save<bool> old_needs_parens(&_imp->all_needs_parens, false);
+
+ if (need_parens)
+ {
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+ _imp->s << "(";
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+ }
+
+ {
+ Save<unsigned> old_indent(&_imp->indent, need_parens ? _imp->indent +1 : _imp->indent);
+ Save<bool> extra_label_indent(&_imp->extra_label_indent, need_parens ? false : _imp->extra_label_indent);
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ if (need_parens)
+ {
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+ _imp->s << ")";
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+ }
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & node)
+{
+ Save<bool> old_outer(&_imp->outer_block, false);
+ Save<bool> old_needs_parens(&_imp->all_needs_parens, true);
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+ _imp->s << "|| (";
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+
+ {
+ Save<unsigned> old_indent(&_imp->indent, _imp->indent + 1);
+ Save<bool> extra_label_indent(&_imp->extra_label_indent, false);
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+ _imp->s << ")";
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<ExactlyOneDepSpec>::Type & node)
+{
+ Save<bool> old_outer(&_imp->outer_block, false);
+ Save<bool> old_needs_parens(&_imp->all_needs_parens, true);
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+ _imp->s << "^^ (";
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+
+ {
+ Save<unsigned> old_indent(&_imp->indent, _imp->indent + 1);
+ Save<bool> extra_label_indent(&_imp->extra_label_indent, false);
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+ _imp->s << ")";
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node)
+{
+ Save<bool> old_outer(&_imp->outer_block, false);
+ Save<bool> old_needs_parens(&_imp->all_needs_parens, false);
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec()) << " (";
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+
+ {
+ Save<unsigned> old_indent(&_imp->indent, _imp->indent + 1);
+ Save<bool> extra_label_indent(&_imp->extra_label_indent, false);
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+ _imp->s << ")";
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node)
+{
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec());
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type & node)
+{
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec());
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type & node)
+{
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec());
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type & node)
+{
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec());
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & node)
+{
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec());
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type & node)
+{
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec());
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type & node)
+{
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec());
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type & node)
+{
+ if (_imp->extra_label_indent)
+ {
+ _imp->extra_label_indent = false;
+ _imp->indent -= 1;
+ }
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec());
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+
+ if (! _imp->extra_label_indent)
+ {
+ _imp->extra_label_indent = true;
+ _imp->indent += 1;
+ }
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type & node)
+{
+ if (_imp->extra_label_indent)
+ {
+ _imp->extra_label_indent = false;
+ _imp->indent -= 1;
+ }
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec());
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+
+ if (! _imp->extra_label_indent)
+ {
+ _imp->extra_label_indent = true;
+ _imp->indent += 1;
+ }
+}
+
+void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node)
+{
+ if (_imp->extra_label_indent)
+ {
+ _imp->extra_label_indent = false;
+ _imp->indent -= 1;
+ }
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+
+ _imp->s << _imp->pretty_printer.prettify(*node.spec());
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+
+ if (!_imp->extra_label_indent)
+ {
+ _imp->extra_label_indent = true;
+ _imp->indent += 1;
+ }
+}
+
+void
+SpecTreePrettyPrinter::do_annotations(const DepSpec & p)
+{
+ if (p.maybe_annotations() && (p.maybe_annotations()->begin() != p.maybe_annotations()->end()))
+ {
+ _imp->s << " [[ ";
+
+ for (auto m(p.maybe_annotations()->begin()), m_end(p.maybe_annotations()->end()) ;
+ m != m_end ; ++m)
+ {
+ _imp->s << m->key() << " = [" << (m->value().empty() ? " " : " " + m->value() + " ") << "] ";
+ }
+ _imp->s << "]]";
+ }
+}
+
diff --git a/paludis/repositories/e/spec_tree_pretty_printer.hh b/paludis/repositories/e/spec_tree_pretty_printer.hh
new file mode 100644
index 0000000..a44ecfc
--- /dev/null
+++ b/paludis/repositories/e/spec_tree_pretty_printer.hh
@@ -0,0 +1,72 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_SPEC_TREE_PRETTY_PRINTER_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_SPEC_TREE_PRETTY_PRINTER_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <paludis/dep_spec.hh>
+#include <paludis/spec_tree.hh>
+#include <paludis/metadata_key-fwd.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/pretty_print_options-fwd.hh>
+#include <paludis/pretty_printer-fwd.hh>
+
+namespace paludis
+{
+ namespace erepository
+ {
+ class PALUDIS_VISIBLE SpecTreePrettyPrinter :
+ private Pimp<SpecTreePrettyPrinter>
+ {
+ friend std::ostream & operator<< (std::ostream &, const SpecTreePrettyPrinter &);
+
+ private:
+ void do_annotations(const DepSpec &);
+
+ public:
+ SpecTreePrettyPrinter(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &
+ );
+
+ ~SpecTreePrettyPrinter();
+
+ void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<ExactlyOneDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type & node);
+ };
+
+ std::ostream & operator<< (std::ostream & s, const SpecTreePrettyPrinter & p) PALUDIS_VISIBLE;
+ }
+}
+
+#endif
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index d77c795..7338d2b 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -31,6 +31,8 @@
#include <paludis/user_dep_spec.hh>
#include <paludis/package_database.hh>
#include <paludis/always_enabled_dependency_label.hh>
+#include <paludis/pretty_printer.hh>
+#include <paludis/call_pretty_printer.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/pimp-impl.hh>
@@ -58,81 +60,6 @@ using namespace paludis::fakerepository;
namespace paludis
{
template <typename C_>
- struct Imp<FakeMetadataValueKey<C_> >
- {
- const std::string raw_name;
- const std::string human_name;
- const MetadataKeyType type;
- C_ value;
-
- Imp(const std::string & r, const std::string & h, const MetadataKeyType t, const C_ & c) :
- raw_name(r),
- human_name(h),
- type(t),
- value(c)
- {
- }
- };
-}
-
-template <typename C_>
-FakeMetadataValueKey<C_>::FakeMetadataValueKey(
- const std::string & r, const std::string & h, const MetadataKeyType t, const C_ & c) :
- Pimp<FakeMetadataValueKey<C_> >(r, h, t, c),
- _imp(Pimp<FakeMetadataValueKey<C_> >::_imp)
-{
-}
-
-template <typename C_>
-FakeMetadataValueKey<C_>::~FakeMetadataValueKey()
-{
-}
-
-template <typename C_>
-const C_
-FakeMetadataValueKey<C_>::value() const
-{
- return this->_imp->value;
-}
-
-template <typename C_>
-const std::string
-FakeMetadataValueKey<C_>::raw_name() const
-{
- return this->_imp->raw_name;
-}
-
-template <typename C_>
-const std::string
-FakeMetadataValueKey<C_>::human_name() const
-{
- return this->_imp->human_name;
-}
-
-template <typename C_>
-MetadataKeyType
-FakeMetadataValueKey<C_>::type() const
-{
- return this->_imp->type;
-}
-
-template <typename C_>
-std::string
-FakeMetadataValueKey<C_>::pretty_print() const
-{
- return stringify(value());
-}
-
-template <typename C_>
-void
-FakeMetadataValueKey<C_>::set_value(const C_ & c)
-{
- this->_imp->value = c;
-}
-
-namespace paludis
-{
- template <typename C_>
struct Imp<FakeMetadataCollectionKey<C_> >
{
std::shared_ptr<C_> collection;
@@ -197,6 +124,15 @@ FakeMetadataCollectionKey<C_>::type() const
return this->_imp->type;
}
+template <typename C_>
+const std::string
+FakeMetadataCollectionKey<C_>::pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions &) const
+{
+ return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(pretty_printer));
+}
+
FakeMetadataKeywordSetKey::FakeMetadataKeywordSetKey(const std::string & r,
const std::string & h, const std::string & v, const MetadataKeyType t,
const std::shared_ptr<const PackageID> & i, const Environment * const e) :
@@ -347,6 +283,14 @@ FakeMetadataSpecTreeKey<C_>::pretty_print_flat(const typename C_::ItemFormatter
return _imp->string_value;
}
+template <typename C_>
+const std::string
+FakeMetadataSpecTreeKey<C_>::pretty_print_value(
+ const PrettyPrinter &, const PrettyPrintOptions &) const
+{
+ return _imp->string_value;
+}
+
FakeMetadataSpecTreeKey<FetchableURISpecTree>::FakeMetadataSpecTreeKey(const std::string & r, const std::string & h, const std::string & v,
const std::function<const std::shared_ptr<const FetchableURISpecTree> (const std::string &)> & f, const MetadataKeyType t) :
Pimp<FakeMetadataSpecTreeKey<FetchableURISpecTree> >(f, r, h, t),
@@ -390,6 +334,12 @@ FakeMetadataSpecTreeKey<FetchableURISpecTree>::value() const
return _imp->value;
}
+const std::string
+FakeMetadataSpecTreeKey<FetchableURISpecTree>::pretty_print_value(const PrettyPrinter &, const PrettyPrintOptions &) const
+{
+ return _imp->string_value;
+}
+
std::string
FakeMetadataSpecTreeKey<FetchableURISpecTree>::pretty_print(const FetchableURISpecTree::ItemFormatter &) const
{
@@ -434,6 +384,12 @@ FakeMetadataSpecTreeKey<DependencySpecTree>::value() const
return _imp->value;
}
+const std::string
+FakeMetadataSpecTreeKey<DependencySpecTree>::pretty_print_value(const PrettyPrinter &, const PrettyPrintOptions &) const
+{
+ return _imp->string_value;
+}
+
std::string
FakeMetadataSpecTreeKey<DependencySpecTree>::pretty_print(const DependencySpecTree::ItemFormatter &) const
{
@@ -731,7 +687,7 @@ namespace paludis
std::shared_ptr<FakeMetadataSpecTreeKey<FetchableURISpecTree> > src_uri;
std::shared_ptr<FakeMetadataSpecTreeKey<SimpleURISpecTree> > homepage;
std::shared_ptr<FakeMetadataChoicesKey> choices;
- std::shared_ptr<FakeMetadataValueKey<long> > hitchhiker;
+ std::shared_ptr<LiteralMetadataValueKey<long> > hitchhiker;
std::shared_ptr<LiteralMetadataStringSetKey> behaviours;
std::shared_ptr<Set<std::string> > behaviours_set;
@@ -1044,7 +1000,7 @@ FakePackageID::need_keys_added() const
_imp->behaviours = std::make_shared<LiteralMetadataStringSetKey>("BEHAVIOURS", "Behaviours",
mkt_internal, _imp->behaviours_set);
- _imp->hitchhiker = std::make_shared<FakeMetadataValueKey<long>>("HITCHHIKER", "Hitchhiker",
+ _imp->hitchhiker = std::make_shared<LiteralMetadataValueKey<long>>("HITCHHIKER", "Hitchhiker",
mkt_internal, 42);
_imp->keywords = std::make_shared<FakeMetadataKeywordSetKey>("KEYWORDS", "Keywords", "test", mkt_normal, shared_from_this(), _imp->env);
@@ -1312,19 +1268,19 @@ FakePackageID::size_of_all_distfiles_key() const
return std::shared_ptr<const MetadataValueKey<long> >();
}
-const std::shared_ptr<FakeMetadataValueKey<long> >
-FakePackageID::hitchhiker_key()
-{
- need_keys_added();
- return _imp->hitchhiker;
-}
-
char
FakePackageID::use_expand_separator() const
{
return '_';
}
+const std::string
+FakeMetadataKeywordSetKey::pretty_print_value(
+ const PrettyPrinter & pretty_printer, const PrettyPrintOptions &) const
+{
+ return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(pretty_printer));
+}
+
std::string
FakeMetadataKeywordSetKey::pretty_print_flat(const Formatter<KeywordName> & f) const
{
@@ -1392,6 +1348,3 @@ template class FakeMetadataSpecTreeKey<SimpleURISpecTree>;
template class FakeMetadataCollectionKey<KeywordNameSet>;
-template class FakeMetadataValueKey<bool>;
-template class FakeMetadataValueKey<long>;
-
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index ad2ecb3..fe27a43 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -31,31 +31,6 @@ namespace paludis
class FakeRepositoryBase;
template <typename C_>
- class PALUDIS_VISIBLE FakeMetadataValueKey :
- public MetadataValueKey<C_>,
- private Pimp<FakeMetadataValueKey<C_> >
- {
- protected:
- typename Pimp<FakeMetadataValueKey<C_> >::ImpPtr & _imp;
-
- public:
- FakeMetadataValueKey(const std::string &, const std::string &, const MetadataKeyType,
- const C_ &);
-
- ~FakeMetadataValueKey();
-
- virtual const C_ value() const PALUDIS_ATTRIBUTE((warn_unused_result));
- void set_value(const C_ &);
-
- virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print() const
- PALUDIS_ATTRIBUTE((warn_unused_result));
- };
-
- template <typename C_>
class PALUDIS_VISIBLE FakeMetadataCollectionKey :
public MetadataCollectionKey<C_>,
private Pimp<FakeMetadataCollectionKey<C_> >
@@ -74,6 +49,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class PALUDIS_VISIBLE FakeMetadataKeywordSetKey :
@@ -87,6 +66,10 @@ namespace paludis
virtual std::string pretty_print_flat(const Formatter<KeywordName> &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
template <typename C_>
@@ -116,6 +99,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
template <>
@@ -149,6 +136,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
template <>
@@ -183,6 +174,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class PALUDIS_VISIBLE FakeMetadataChoicesKey :
@@ -307,7 +302,6 @@ namespace paludis
const std::shared_ptr<FakeMetadataSpecTreeKey<FetchableURISpecTree> > fetches_key();
const std::shared_ptr<FakeMetadataSpecTreeKey<SimpleURISpecTree> > homepage_key();
const std::shared_ptr<FakeMetadataChoicesKey> choices_key();
- const std::shared_ptr<FakeMetadataValueKey<long> > hitchhiker_key();
const std::shared_ptr<Set<std::string> > behaviours_set();
diff --git a/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc b/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc
index f53b70a..76cb717 100644
--- a/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc
+++ b/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc
@@ -39,6 +39,7 @@
#include <paludis/version_requirements.hh>
#include <paludis/version_operator.hh>
#include <paludis/version_spec.hh>
+#include <paludis/pretty_printer.hh>
#include <sstream>
#include <algorithm>
#include <vector>
@@ -140,6 +141,81 @@ namespace
}
};
+ struct ValuePrinter
+ {
+ std::stringstream s;
+ const PrettyPrinter & printer;
+ const PrettyPrintOptions options;
+
+ const unsigned indent;
+ const bool flat;
+ bool need_space;
+
+ ValuePrinter(
+ const PrettyPrinter & p,
+ const PrettyPrintOptions & o) :
+ printer(p),
+ options(o),
+ indent(0),
+ flat(! options[ppo_multiline_allowed]),
+ need_space(false)
+ {
+ }
+
+ void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
+ {
+ if (! flat)
+ s << printer.indentify(indent + 1);
+ else if (need_space)
+ s << " ";
+ else
+ need_space = true;
+
+ s << printer.prettify(*node.spec());
+
+ if (! flat)
+ s << printer.newline();
+ }
+
+ void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
+ {
+ }
+
+ void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node)
+ {
+ if (! flat)
+ s << printer.indentify(indent);
+ else if (need_space)
+ s << " ";
+ else
+ need_space = true;
+
+ s << printer.prettify(*node.spec());
+
+ if (! flat)
+ s << printer.newline();
+ }
+
+ void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type &)
+ {
+ }
+
+ void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
+ {
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+ };
+
struct GemcutterDependenciesKeyData :
Singleton<GemcutterDependenciesKeyData>
{
@@ -302,5 +378,15 @@ GemcutterDependenciesKey::pretty_print_flat(const DependencySpecTree::ItemFormat
return p.s.str();
}
+const std::string
+GemcutterDependenciesKey::pretty_print_value(
+ const PrettyPrinter & printer,
+ const PrettyPrintOptions & options) const
+{
+ ValuePrinter p{printer, options};
+ _imp->value->top()->accept(p);
+ return p.s.str();
+}
+
template class Pimp<GemcutterDependenciesKey>;
diff --git a/paludis/repositories/gemcutter/gemcutter_dependencies_key.hh b/paludis/repositories/gemcutter/gemcutter_dependencies_key.hh
index b1e973e..09f9d7e 100644
--- a/paludis/repositories/gemcutter/gemcutter_dependencies_key.hh
+++ b/paludis/repositories/gemcutter/gemcutter_dependencies_key.hh
@@ -70,6 +70,10 @@ namespace paludis
virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/gemcutter/gemcutter_uri_key.cc b/paludis/repositories/gemcutter/gemcutter_uri_key.cc
index c17ee50..27ecfe4 100644
--- a/paludis/repositories/gemcutter/gemcutter_uri_key.cc
+++ b/paludis/repositories/gemcutter/gemcutter_uri_key.cc
@@ -23,6 +23,7 @@
#include <paludis/util/pimp-impl.hh>
#include <paludis/spec_tree.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/pretty_printer.hh>
#include <sstream>
#include <algorithm>
@@ -79,6 +80,53 @@ namespace
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
}
};
+
+ struct ValuePrinter
+ {
+ std::stringstream s;
+ const PrettyPrinter & printer;
+ const PrettyPrintOptions options;
+
+ const unsigned indent;
+ const bool flat;
+ bool need_space;
+
+ ValuePrinter(
+ const PrettyPrinter & p,
+ const PrettyPrintOptions & o) :
+ printer(p),
+ options(o),
+ indent(0),
+ flat(! options[ppo_multiline_allowed]),
+ need_space(false)
+ {
+ }
+
+ void visit(const SimpleURISpecTree::NodeType<SimpleURIDepSpec>::Type & node)
+ {
+ if (! flat)
+ s << printer.indentify(indent + 1);
+ else if (need_space)
+ s << " ";
+ else
+ need_space = true;
+
+ s << printer.prettify(*node.spec());
+
+ if (! flat)
+ s << printer.newline();
+ }
+
+ 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));
+ }
+ };
}
namespace paludis
@@ -140,6 +188,15 @@ GemcutterURIKey::type() const
return _imp->type;
}
+const std::string
+GemcutterURIKey::pretty_print_value(
+ const PrettyPrinter & printer, const PrettyPrintOptions & options) const
+{
+ ValuePrinter p{printer, options};
+ _imp->value->top()->accept(p);
+ return p.s.str();
+}
+
std::string
GemcutterURIKey::pretty_print(const SimpleURISpecTree::ItemFormatter & f) const
{
diff --git a/paludis/repositories/gemcutter/gemcutter_uri_key.hh b/paludis/repositories/gemcutter/gemcutter_uri_key.hh
index 7d4a555..6aa0e6d 100644
--- a/paludis/repositories/gemcutter/gemcutter_uri_key.hh
+++ b/paludis/repositories/gemcutter/gemcutter_uri_key.hh
@@ -64,6 +64,10 @@ namespace paludis
*/
virtual std::string pretty_print_flat(const SimpleURISpecTree::ItemFormatter &) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc
index cf563ef..bc2df96 100644
--- a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc
@@ -26,6 +26,7 @@
#include <paludis/dep_label.hh>
#include <paludis/comma_separated_dep_parser.hh>
#include <paludis/comma_separated_dep_printer.hh>
+#include <paludis/comma_separated_dep_pretty_printer.hh>
#include <paludis/always_enabled_dependency_label.hh>
#include <memory>
@@ -107,6 +108,16 @@ UnavailableRepositoryDependenciesKey::type() const
return _imp->type;
}
+const std::string
+UnavailableRepositoryDependenciesKey::pretty_print_value(
+ const PrettyPrinter & printer,
+ const PrettyPrintOptions & options) const
+{
+ CommaSeparatedDepPrettyPrinter p(printer, options);
+ _imp->value->top()->accept(p);
+ return p.result();
+}
+
std::string
UnavailableRepositoryDependenciesKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
{
diff --git a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh
index 02e33a3..e7de985 100644
--- a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh
+++ b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh
@@ -50,6 +50,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
}
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 69b236d..7e9a20e 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -47,8 +47,11 @@
#include <paludis/user_dep_spec.hh>
#include <paludis/comma_separated_dep_parser.hh>
#include <paludis/comma_separated_dep_printer.hh>
+#include <paludis/comma_separated_dep_pretty_printer.hh>
#include <paludis/formatter.hh>
#include <paludis/always_enabled_dependency_label.hh>
+#include <paludis/pretty_printer.hh>
+#include <paludis/call_pretty_printer.hh>
#include <functional>
using namespace paludis;
@@ -309,6 +312,13 @@ namespace
{
return _type;
}
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions &) const
+ {
+ return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(pretty_printer));
+ }
};
class InstalledUnpackagedDependencyKey :
@@ -387,6 +397,15 @@ namespace
{
return _type;
}
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter & printer,
+ const PrettyPrintOptions & options) const
+ {
+ CommaSeparatedDepPrettyPrinter p(printer, options);
+ value()->top()->accept(p);
+ return p.result();
+ }
};
}
diff --git a/paludis/repositories/unpackaged/unpackaged_key.cc b/paludis/repositories/unpackaged/unpackaged_key.cc
index d66a0a6..cbd7fd7 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.cc
+++ b/paludis/repositories/unpackaged/unpackaged_key.cc
@@ -27,6 +27,7 @@
#include <paludis/elike_choices.hh>
#include <paludis/comma_separated_dep_printer.hh>
#include <paludis/comma_separated_dep_parser.hh>
+#include <paludis/comma_separated_dep_pretty_printer.hh>
#include <memory>
using namespace paludis;
@@ -95,6 +96,15 @@ UnpackagedDependencyKey::type() const
return _imp->type;
}
+const std::string
+UnpackagedDependencyKey::pretty_print_value(
+ const PrettyPrinter & printer, const PrettyPrintOptions & options) const
+{
+ CommaSeparatedDepPrettyPrinter p(printer, options);
+ _imp->value->top()->accept(p);
+ return p.result();
+}
+
std::string
UnpackagedDependencyKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
{
diff --git a/paludis/repositories/unpackaged/unpackaged_key.hh b/paludis/repositories/unpackaged/unpackaged_key.hh
index ffcb076..c6053a0 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.hh
+++ b/paludis/repositories/unpackaged/unpackaged_key.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009, 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
@@ -52,6 +52,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class UnpackagedChoicesKey :
diff --git a/paludis/repositories/unwritten/unwritten_repository_file.cc b/paludis/repositories/unwritten/unwritten_repository_file.cc
index 01018f6..b9541e8 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();
+ }
};
}
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index 30f780a..9028500 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -46,6 +46,7 @@
#include <paludis/filtered_generator.hh>
#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/always_enabled_dependency_label.hh>
+#include <paludis/pretty_printer.hh>
using namespace paludis;
using namespace paludis::virtuals;
@@ -154,6 +155,14 @@ VirtualsDepKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) c
return pretty_print(f);
}
+const std::string
+VirtualsDepKey::pretty_print_value(
+ const PrettyPrinter & pretty_printer,
+ const PrettyPrintOptions &) const
+{
+ return pretty_printer.prettify(*_imp->spec);
+}
+
const std::shared_ptr<const DependenciesLabelSequence>
VirtualsDepKey::initial_labels() const
{
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index 30513f5..bd4e984 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -57,6 +57,10 @@ namespace paludis
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const PALUDIS_ATTRIBUTE((warn_unused_result));
};
class VirtualsPackageID :
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index c480d4e..9fa8828 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -237,6 +237,13 @@ struct MetadataPackageIDKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataPackageIDKey", "type");
}
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const
+ {
+ throw PythonMethodNotImplemented("MetadataPackageIDKey", "pretty_print_value");
+ }
};
struct MetadataStringKeyWrapper :
@@ -684,6 +691,13 @@ struct MetadataCollectionKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataCollectionKey", "type");
}
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const
+ {
+ throw PythonMethodNotImplemented("MetadataCollectionKey", "pretty_print_value");
+ }
};
template <typename C_>
@@ -753,6 +767,13 @@ struct MetadataSpecTreeKeyWrapper :
else
throw PythonMethodNotImplemented("MetadataSpecTreeKey", "type");
}
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const
+ {
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print_value");
+ }
};
template <>
@@ -833,6 +854,13 @@ struct MetadataSpecTreeKeyWrapper<FetchableURISpecTree> :
else
throw PythonMethodNotImplemented("MetadataSpecTreeKey", "type");
}
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const
+ {
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print_value");
+ }
};
template <>
@@ -913,6 +941,13 @@ struct MetadataSpecTreeKeyWrapper<DependencySpecTree> :
else
throw PythonMethodNotImplemented("MetadataSpecTreeKey", "type");
}
+
+ virtual const std::string pretty_print_value(
+ const PrettyPrinter &,
+ const PrettyPrintOptions &) const
+ {
+ throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print_value");
+ }
};
template <typename C_>