aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-31 03:21:02 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-01 03:57:53 +0000
commit4a4c5ce98b186a8dc3e3d683b1889a7f724c93c3 (patch)
treeb3daed1da5be1fdae3bd27e5b38a8d3b538731da
parent79da6018d6c02a099af83ecd62e8858ead5f27db (diff)
downloadpaludis-4a4c5ce98b186a8dc3e3d683b1889a7f724c93c3.tar.gz
paludis-4a4c5ce98b186a8dc3e3d683b1889a7f724c93c3.tar.xz
Kill formatters
-rw-r--r--paludis/comma_separated_dep_parser_TEST.cc8
-rw-r--r--paludis/comma_separated_dep_pretty_printer.hh1
-rw-r--r--paludis/comma_separated_dep_printer.cc151
-rw-r--r--paludis/comma_separated_dep_printer.hh49
-rw-r--r--paludis/files.m43
-rw-r--r--paludis/formatter-fwd.hh58
-rw-r--r--paludis/formatter.cc23
-rw-r--r--paludis/formatter.hh1034
-rw-r--r--paludis/legacy/dep_list_TEST.cc2
-rw-r--r--paludis/literal_metadata_key.cc50
-rw-r--r--paludis/literal_metadata_key.hh12
-rw-r--r--paludis/metadata_key.hh1
-rw-r--r--paludis/repositories/accounts/accounts_dep_key.cc36
-rw-r--r--paludis/repositories/accounts/accounts_dep_key.hh4
-rw-r--r--paludis/repositories/cran/Makefile.am2
-rw-r--r--paludis/repositories/cran/cran_dep_parser_TEST.cc10
-rw-r--r--paludis/repositories/cran/dep_spec_pretty_printer.cc155
-rw-r--r--paludis/repositories/cran/dep_spec_pretty_printer.hh86
-rw-r--r--paludis/repositories/cran/keys.cc49
-rw-r--r--paludis/repositories/cran/keys.hh12
-rw-r--r--paludis/repositories/cran/spec_tree_pretty_printer.hh1
-rw-r--r--paludis/repositories/e/Makefile.am15
-rw-r--r--paludis/repositories/e/dep_parser_TEST.cc78
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.cc603
-rw-r--r--paludis/repositories/e/dep_spec_pretty_printer.hh121
-rw-r--r--paludis/repositories/e/depend_rdepend_TEST.cc1
-rw-r--r--paludis/repositories/e/e_choices_key.cc2
-rw-r--r--paludis/repositories/e/e_key.cc182
-rw-r--r--paludis/repositories/e/e_key.hh54
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc14
-rw-r--r--paludis/repositories/e/e_repository_TEST_0.cc2
-rw-r--r--paludis/repositories/e/e_repository_TEST_1.cc2
-rw-r--r--paludis/repositories/e/e_repository_TEST_2.cc2
-rw-r--r--paludis/repositories/e/e_repository_TEST_3.cc2
-rw-r--r--paludis/repositories/e/e_repository_TEST_4.cc3
-rw-r--r--paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc12
-rw-r--r--paludis/repositories/e/e_repository_TEST_ever.cc2
-rw-r--r--paludis/repositories/e/e_repository_TEST_exheres_0.cc2
-rw-r--r--paludis/repositories/e/e_repository_TEST_exlibs.cc2
-rw-r--r--paludis/repositories/e/e_repository_TEST_pbin.cc2
-rw-r--r--paludis/repositories/e/e_repository_TEST_phases.cc2
-rw-r--r--paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc2
-rw-r--r--paludis/repositories/e/e_repository_sets_TEST.cc16
-rw-r--r--paludis/repositories/e/ebuild_flat_metadata_cache.cc8
-rw-r--r--paludis/repositories/e/fix_locked_dependencies_TEST.cc18
-rw-r--r--paludis/repositories/e/info_metadata_key.cc16
-rw-r--r--paludis/repositories/e/info_metadata_key.hh2
-rw-r--r--paludis/repositories/e/pipe_command_handler.cc17
-rw-r--r--paludis/repositories/e/required_use_verifier.cc1
-rw-r--r--paludis/repositories/e/vdb_repository.cc20
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc12
-rw-r--r--paludis/repositories/fake/fake_package_id.cc60
-rw-r--r--paludis/repositories/fake/fake_package_id.hh21
-rw-r--r--paludis/repositories/gemcutter/gemcutter_dependencies_key.cc103
-rw-r--r--paludis/repositories/gemcutter/gemcutter_dependencies_key.hh6
-rw-r--r--paludis/repositories/gemcutter/gemcutter_uri_key.cc58
-rw-r--r--paludis/repositories/gemcutter/gemcutter_uri_key.hh14
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc17
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh4
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc29
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc1
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.cc17
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.hh4
-rw-r--r--paludis/repositories/unwritten/unwritten_repository_file.cc43
-rw-r--r--paludis/repositories/virtuals/package_id.cc25
-rw-r--r--paludis/repositories/virtuals/package_id.hh6
-rw-r--r--paludis/spec_tree.hh26
-rw-r--r--paludis/stringify_formatter-fwd.hh34
-rw-r--r--paludis/stringify_formatter-impl.hh225
-rw-r--r--paludis/stringify_formatter.cc373
-rw-r--r--paludis/stringify_formatter.hh159
-rw-r--r--paludis/stringify_formatter_TEST.cc129
-rw-r--r--python/Makefile.am2
-rw-r--r--python/additional_tests.cc89
-rw-r--r--python/formatter.cc689
-rwxr-xr-xpython/formatter_TEST.py150
-rw-r--r--python/metadata_key.cc12
-rw-r--r--python/nice_names.nn14
-rw-r--r--python/paludis_python.hh1
-rw-r--r--python/paludis_python_so.cc1
-rw-r--r--src/clients/cave/Makefile.am1
-rwxr-xr-xsrc/clients/cave/cmd_display_resolution.cc1
-rw-r--r--src/clients/cave/cmd_dump_cave_formats_conf.cc2
-rw-r--r--src/clients/cave/cmd_execute_resolution.cc1
-rw-r--r--src/clients/cave/cmd_import.cc1
-rw-r--r--src/clients/cave/cmd_info.cc1
-rw-r--r--src/clients/cave/cmd_report.cc1
-rw-r--r--src/clients/cave/cmd_resume.cc1
-rw-r--r--src/clients/cave/cmd_show.cc1
-rw-r--r--src/clients/cave/colour_formatter-fmt.hh101
-rw-r--r--src/clients/cave/colour_formatter.cc279
-rw-r--r--src/clients/cave/colour_formatter.hh117
-rw-r--r--src/clients/cave/format_plain_metadata_key.cc2
-rw-r--r--src/clients/importare/importare.cc1
-rw-r--r--src/clients/inquisitio/key_extractor.cc1
-rw-r--r--src/clients/paludis/info.cc1
-rw-r--r--src/output/Makefile.am1
-rw-r--r--src/output/colour_formatter.cc268
-rw-r--r--src/output/colour_formatter.hh107
-rw-r--r--src/output/console_install_task.cc25
-rw-r--r--src/output/console_query_task.cc1
101 files changed, 115 insertions, 6073 deletions
diff --git a/paludis/comma_separated_dep_parser_TEST.cc b/paludis/comma_separated_dep_parser_TEST.cc
index 79817c8..e87e95a 100644
--- a/paludis/comma_separated_dep_parser_TEST.cc
+++ b/paludis/comma_separated_dep_parser_TEST.cc
@@ -18,9 +18,9 @@
*/
#include <paludis/comma_separated_dep_parser.hh>
-#include <paludis/comma_separated_dep_printer.hh>
+#include <paludis/comma_separated_dep_pretty_printer.hh>
#include <paludis/environments/test/test_environment.hh>
-#include <paludis/stringify_formatter.hh>
+#include <paludis/unformatted_pretty_printer.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -38,8 +38,8 @@ namespace test_cases
TestEnvironment env;
std::shared_ptr<const DependencySpecTree> spec(
CommaSeparatedDepParser::parse(&env, "cat/one , cat/two, cat/three\n"));
- StringifyFormatter f;
- CommaSeparatedDepPrinter p(&env, f, true);
+ UnformattedPrettyPrinter f;
+ CommaSeparatedDepPrettyPrinter p(f, { });
spec->top()->accept(p);
TEST_CHECK_EQUAL(p.result(), "cat/one, cat/two, cat/three");
}
diff --git a/paludis/comma_separated_dep_pretty_printer.hh b/paludis/comma_separated_dep_pretty_printer.hh
index e4a07fb..44e7515 100644
--- a/paludis/comma_separated_dep_pretty_printer.hh
+++ b/paludis/comma_separated_dep_pretty_printer.hh
@@ -22,7 +22,6 @@
#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>
diff --git a/paludis/comma_separated_dep_printer.cc b/paludis/comma_separated_dep_printer.cc
deleted file mode 100644
index 33db0b8..0000000
--- a/paludis/comma_separated_dep_printer.cc
+++ /dev/null
@@ -1,151 +0,0 @@
-/* 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
- */
-
-#include <paludis/comma_separated_dep_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/environment.hh>
-#include <paludis/selection.hh>
-#include <paludis/generator.hh>
-#include <paludis/filter.hh>
-#include <paludis/filtered_generator.hh>
-#include <paludis/action.hh>
-#include <paludis/metadata_key.hh>
-#include <algorithm>
-#include <sstream>
-
-using namespace paludis;
-
-namespace paludis
-{
- template <>
- struct Imp<CommaSeparatedDepPrinter>
- {
- std::stringstream s;
- const Environment * const env;
- DependencySpecTree::ItemFormatter formatter;
- const unsigned indent;
- const bool flat;
- bool need_comma;
-
- Imp(
- const Environment * const e,
- const DependencySpecTree::ItemFormatter & f,
- const unsigned u,
- const bool b) :
- env(e),
- formatter(f),
- indent(u),
- flat(b),
- need_comma(false)
- {
- }
- };
-}
-
-CommaSeparatedDepPrinter::CommaSeparatedDepPrinter(const Environment * const e,
- const DependencySpecTree::ItemFormatter & f, const bool flat) :
- Pimp<CommaSeparatedDepPrinter>(e, f, 0, flat)
-{
-}
-
-CommaSeparatedDepPrinter::~CommaSeparatedDepPrinter()
-{
-}
-
-void
-CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
-{
- if (! _imp->flat)
- _imp->s << _imp->formatter.indent(_imp->indent);
- else if (_imp->need_comma)
- _imp->s << ", ";
- else
- _imp->need_comma = true;
-
- if (_imp->env)
- {
- if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
- filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]->empty())
- _imp->s << _imp->formatter.format(*node.spec(), format::Installed());
- else if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
- filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty())
- _imp->s << _imp->formatter.format(*node.spec(), format::Installable());
- else
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- }
- else
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- if (! _imp->flat)
- _imp->s << _imp->formatter.newline();
-}
-
-void
-CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
-{
-}
-
-void
-CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &)
-{
-}
-
-void
-CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
-{
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
-}
-
-void
-CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
-{
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
-}
-
-void
-CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
-{
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
-}
-
-void
-CommaSeparatedDepPrinter::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
-{
- if (! _imp->flat)
- _imp->s << _imp->formatter.indent(_imp->indent);
- else if (_imp->need_comma)
- _imp->s << ", ";
- else
- _imp->need_comma = true;
-
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- if (! _imp->flat)
- _imp->s << _imp->formatter.newline();
-}
-
-const std::string
-CommaSeparatedDepPrinter::result() const
-{
- return _imp->s.str();
-}
-
diff --git a/paludis/comma_separated_dep_printer.hh b/paludis/comma_separated_dep_printer.hh
deleted file mode 100644
index c787936..0000000
--- a/paludis/comma_separated_dep_printer.hh
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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_REPOSITORIES_UNPACKAGED_DEP_PRINTER_HH
-#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_UNPACKAGED_DEP_PRINTER_HH 1
-
-#include <paludis/util/pimp.hh>
-#include <paludis/spec_tree.hh>
-#include <paludis/formatter.hh>
-#include <paludis/environment-fwd.hh>
-
-namespace paludis
-{
- class PALUDIS_VISIBLE CommaSeparatedDepPrinter :
- private Pimp<CommaSeparatedDepPrinter>
- {
- public:
- CommaSeparatedDepPrinter(const Environment * const, const DependencySpecTree::ItemFormatter &, const bool);
- ~CommaSeparatedDepPrinter();
-
- 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 41a393d..4b1c112 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -22,7 +22,6 @@ 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')
add(`contents', `hh', `cc', `fwd')
@@ -50,7 +49,6 @@ add(`filter_handler', `hh', `cc', `fwd')
add(`filtered_generator', `hh', `cc', `fwd', `test')
add(`format_messages_output_manager', `hh', `fwd', `cc')
add(`formatted_pretty_printer', `hh', `fwd', `cc')
-add(`formatter', `hh', `fwd', `cc')
add(`forward_at_finish_output_manager', `hh', `fwd', `cc')
add(`fs_merger', `hh', `cc', `fwd', `se', `test', `testscript')
add(`fuzzy_finder', `hh', `cc', `test')
@@ -97,7 +95,6 @@ add(`set_file', `hh', `cc', `se', `test', `te
add(`slot_requirement', `hh', `fwd', `cc')
add(`spec_tree', `hh', `fwd', `cc')
add(`standard_output_manager', `hh', `cc', `fwd')
-add(`stringify_formatter', `hh', `cc', `fwd', `impl', `test')
add(`stripper', `hh', `cc', `fwd', `test', `testscript')
add(`syncer', `hh', `cc')
add(`tar_merger', `hh', `cc', `fwd', `test', `testscript', `se')
diff --git a/paludis/formatter-fwd.hh b/paludis/formatter-fwd.hh
deleted file mode 100644
index 2554e9a..0000000
--- a/paludis/formatter-fwd.hh
+++ /dev/null
@@ -1,58 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007, 2010 Ciaran McCreesh
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * 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_FORMATTER_FWD_HH
-#define PALUDIS_GUARD_PALUDIS_FORMATTER_FWD_HH 1
-
-#include <paludis/util/no_type.hh>
-
-/** \file
- * Forward declarations for paludis/formatter.hh .
- *
- * \ingroup g_formatters
- */
-
-namespace paludis
-{
- template <
- typename T1_,
- typename T2_ = NoType<2u>,
- typename T3_ = NoType<3u>,
- typename T4_ = NoType<4u>,
- typename T5_ = NoType<5u>,
- typename T6_ = NoType<6u>,
- typename T7_ = NoType<7u>,
- typename T8_ = NoType<8u>,
- typename T9_ = NoType<9u>,
- typename T10_ = NoType<10u>,
- typename T11_ = NoType<11u>,
- typename T12_ = NoType<12u>,
- typename T13_ = NoType<13u>,
- typename T14_ = NoType<14u>,
- typename T15_ = NoType<15u>,
- typename T16_ = NoType<16u>,
- typename T17_ = NoType<17u>,
- typename T18_ = NoType<18u>,
- typename T19_ = NoType<19u>,
- typename T20_ = NoType<20u>
- >
- class Formatter;
-}
-
-#endif
diff --git a/paludis/formatter.cc b/paludis/formatter.cc
deleted file mode 100644
index 6cc13d3..0000000
--- a/paludis/formatter.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 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/formatter.hh>
-
-using namespace paludis;
-
diff --git a/paludis/formatter.hh b/paludis/formatter.hh
deleted file mode 100644
index 2d7d2cd..0000000
--- a/paludis/formatter.hh
+++ /dev/null
@@ -1,1034 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * 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
- * 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_FORMATTER_HH
-#define PALUDIS_GUARD_PALUDIS_FORMATTER_HH 1
-
-#include <paludis/formatter-fwd.hh>
-#include <paludis/name-fwd.hh>
-#include <paludis/package_id-fwd.hh>
-#include <paludis/choice-fwd.hh>
-#include <paludis/dep_spec-fwd.hh>
-#include <paludis/util/attributes.hh>
-#include <string>
-
-/** \file
- * Declarations for the Formatter class.
- *
- * \ingroup g_formatters
- *
- * \section Examples
- *
- * - \ref example_formatter.cc "example_formatter.cc"
- * - \ref example_stringify_formatter.cc "example_stringify_formatter.cc"
- */
-
-namespace paludis
-{
- /** \namespace paludis::format
- *
- * The paludis::format:: namespace contains various Formatter related
- * utilities.
- *
- * \ingroup g_formatters
- * \since 0.26
- */
- namespace format
- {
- /**
- * Tag to indicate that an item should be formatted as 'plain'.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct Plain
- {
- };
-
- /**
- * Tag to indicate that an item should be formatted as 'enabled'.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct Enabled
- {
- };
-
- /**
- * Tag to indicate that an item should be formatted as 'disabled'.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct Disabled
- {
- };
-
- /**
- * Tag to indicate that an item should be formatted as 'masked'
- * (and disabled -- see format::Forced for masked and enabled).
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct Masked
- {
- };
-
- /**
- * Tag to indicate that an item should be formatted as 'forced'.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct Forced
- {
- };
-
- /**
- * Tag to indicate that an item should be decorated as 'changed'.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct Changed
- {
- };
-
- /**
- * Tag to indicate that an item should be decorated as 'added'.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct Added
- {
- };
-
- /**
- * Tag to indicate that an item should be formatted as 'accepted'.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct Accepted
- {
- };
-
- /**
- * Tag to indicate that an item should be formatted as 'unaccepted'.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct Unaccepted
- {
- };
-
- /**
- * Tag to indicate that an item should be formatted as 'installed'.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct Installed
- {
- };
-
- /**
- * Tag to indicate that an item should be formatted as 'installable'
- * (but not installed).
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct Installable
- {
- };
-
- /**
- * Used by CategorySelector<> to declare that format::Plain is the only
- * role supported by a particular class.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct PlainRoles;
-
- /**
- * Used by CategorySelector<> to declare that format::Plain,
- * format::Enabled, format::Disabled, format::Forced, format::Masked,
- * format::Added and format::Changed are the roles supported by a
- * particular class.
- *
- * \ingroup g_formatters
- * \since 0.32
- * \nosubgrouping
- */
- struct ChoiceRoles;
-
- /**
- * Used by CategorySelector<> to declare that format::Plain,
- * format::Accepted and format::Unaccepted are the roles supported by a
- * particular class.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct AcceptableRoles;
-
- /**
- * Used by CategorySelector<> to declare that format::Plain,
- * format::Installed and format::Installable are the roles supported by
- * a particular class.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct PackageRoles;
-
- /**
- * Used by CategorySelector<> to declare that no roles at all are
- * supported by a particular class.
- *
- * This category is not used by any 'real' class. It is used for
- * NoType<> to work around the lack of variadic templates in the current
- * C++ standard.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- struct NoRoles;
-
- /**
- * By default, a type supports format::PlainRoles.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_>
- struct CategorySelector
- {
- /// The roles this type supports.
- typedef PlainRoles Category;
- };
-
- /**
- * ChoiceValue supports ChoiceRoles.
- *
- * \ingroup g_formatters
- * \since 0.32
- * \nosubgrouping
- */
- template <>
- struct CategorySelector<ChoiceValue>
- {
- /// The roles this type supports.
- typedef ChoiceRoles Category;
- };
-
- /**
- * ConditionalDepSpec supports ChoiceRoles.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <>
- struct CategorySelector<ConditionalDepSpec>
- {
- /// The roles this type supports.
- typedef ChoiceRoles Category;
- };
-
- /**
- * LicenseDepSpec supports AcceptableRoles.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <>
- struct CategorySelector<LicenseDepSpec>
- {
- /// The roles this type supports.
- typedef AcceptableRoles Category;
- };
-
- /**
- * KeywordName supports AcceptableRoles.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <>
- struct CategorySelector<KeywordName>
- {
- /// The roles this type supports.
- typedef AcceptableRoles Category;
- };
-
- /**
- * PackageDepSpec supports PackageRoles.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <>
- struct CategorySelector<PackageDepSpec>
- {
- /// The roles this type supports.
- typedef PackageRoles Category;
- };
-
- /**
- * PackageID supports PackageRoles.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <>
- struct CategorySelector<PackageID>
- {
- /// The roles this type supports.
- typedef PackageRoles Category;
- };
-
- /**
- * A std::shared_ptr<T_> shouldn't be specified.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_>
- struct CategorySelector<std::shared_ptr<T_> >
- {
- /// This role is wrong.
- typedef typename CategorySelector<T_>::ThisRoleIsWrong ThisRoleIsWrong;
- };
-
- /**
- * A std::shared_ptr<const T_> shouldn't be specified.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_>
- struct CategorySelector<std::shared_ptr<const T_> >
- {
- /// This role is wrong.
- typedef typename CategorySelector<T_>::ThisRoleIsWrong ThisRoleIsWrong;
- };
-
- /**
- * A const T_ supports the same roles as T_.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_>
- struct CategorySelector<const T_>
- {
- /// The roles this type supports.
- typedef typename CategorySelector<T_>::Category Category;
- };
-
- /**
- * NoType<> doesn't support any format roles.
- *
- * Used to work around the lack of variadic templates in the current C++
- * standard.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <unsigned u_>
- struct CategorySelector<NoType<u_> >
- {
- /// The roles this type supports.
- typedef NoRoles Category;
- };
-
- ///\}
- }
-
- template <typename T_, typename C_>
- struct CanFormatBase;
-
- /**
- * Base class for anything that implements the format functions for
- * format::PlainRoles on type T_.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_>
- class PALUDIS_VISIBLE CanFormatBase<T_, format::PlainRoles>
- {
- public:
- ///\name Basic operations
- ///\{
-
- CanFormatBase()
- {
- }
-
- virtual ~CanFormatBase()
- {
- }
-
- ///\}
-
- /**
- * Format this item as 'Plain'.
- */
- virtual std::string format(const T_ &, const format::Plain &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- };
-
- /**
- * Base class for anything that implements the format functions for
- * format::AcceptableRoles on type T_.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_>
- class PALUDIS_VISIBLE CanFormatBase<T_, format::AcceptableRoles>
- {
- public:
- ///\name Basic operations
- ///\{
-
- CanFormatBase()
- {
- }
-
- virtual ~CanFormatBase()
- {
- }
-
- ///\}
-
- /**
- * Format this item as 'Plain'.
- */
- virtual std::string format(const T_ &, const format::Plain &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Format this item as 'Accepted'.
- */
- virtual std::string format(const T_ &, const format::Accepted &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Format this item as 'Unaccepted'.
- */
- virtual std::string format(const T_ &, const format::Unaccepted &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- };
-
- /**
- * Base class for anything that implements the format functions for
- * format::ChoiceRoles on type T_.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_>
- class PALUDIS_VISIBLE CanFormatBase<T_, format::ChoiceRoles>
- {
- public:
- ///\name Basic operations
- ///\{
-
- CanFormatBase()
- {
- }
-
- virtual ~CanFormatBase()
- {
- }
-
- ///\}
-
- /**
- * Format this item as 'Plain'.
- */
- virtual std::string format(const T_ &, const format::Plain &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Format this item as 'Enabled'.
- */
- virtual std::string format(const T_ &, const format::Enabled &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Format this item as 'Disabled'.
- */
- virtual std::string format(const T_ &, const format::Disabled &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Format this item as 'Forced'.
- */
- virtual std::string format(const T_ &, const format::Forced &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Format this item as 'Masked'.
- */
- virtual std::string format(const T_ &, const format::Masked &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Decorate this item as 'Added'.
- */
- virtual std::string decorate(const T_ &, const std::string &, const format::Added &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Decorate this item as 'Changed'.
- */
- virtual std::string decorate(const T_ &, const std::string &, const format::Changed &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- };
-
- /**
- * Base class for anything that implements the format functions for
- * format::PackageRoles on type T_.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_>
- class PALUDIS_VISIBLE CanFormatBase<T_, format::PackageRoles>
- {
- public:
- ///\name Basic operations
- ///\{
-
- CanFormatBase()
- {
- }
-
- virtual ~CanFormatBase()
- {
- }
-
- ///\}
-
- /**
- * Format this item as 'Plain'.
- */
- virtual std::string format(const T_ &, const format::Plain &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Format this item as 'Installed'.
- */
- virtual std::string format(const T_ &, const format::Installed &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
-
- /**
- * Format this item as 'Installable'.
- */
- virtual std::string format(const T_ &, const format::Installable &) const
- PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
- };
-
- /**
- * Base class for anything that implements the format functions for
- * format::NoRoles on type NoType<T_>.
- *
- * Used to work around the lack of variadic templates in the current C++
- * standard.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <unsigned u_>
- class PALUDIS_VISIBLE CanFormatBase<NoType<u_>, format::NoRoles>
- {
- public:
- ///\name Basic operations
- ///\{
-
- CanFormatBase()
- {
- }
-
- ///\}
- };
-
- /**
- * Descendents of this class implement the necessary methods to format an
- * item of type T_.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_>
- class PALUDIS_VISIBLE CanFormat :
- public CanFormatBase<T_, typename format::CategorySelector<T_>::Category>
- {
- public:
- ///\name Basic operations
- ///\{
-
- CanFormat()
- {
- }
-
- ///\}
- };
-
- /**
- * Descendents of this class implement the necessary methods to format
- * whitespace.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE CanSpace
- {
- public:
- ///\name Basic operations
- ///\{
-
- CanSpace()
- {
- }
-
- virtual ~CanSpace()
- {
- }
-
- ///\}
-
- /**
- * Output a newline.
- */
- virtual std::string newline() const = 0;
-
- /**
- * Output an indent marker of the specified indent level.
- */
- virtual std::string indent(const int) const = 0;
- };
-
- template <typename T_, typename C_, unsigned u_>
- class FormatFunctionsByProxy;
-
- /**
- * Used by Formatter to implement the CanFormat<T_> interface.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_, unsigned u_>
- class PALUDIS_VISIBLE FormatFunctionsByProxy<T_, format::PlainRoles, u_> :
- public CanFormat<T_>
- {
- private:
- const CanFormat<T_> * const _proxy;
-
- public:
- ///\name Basic operations
- ///\{
-
- FormatFunctionsByProxy(const CanFormat<T_> * const p) :
- _proxy(p)
- {
- }
-
- ///\}
-
- virtual std::string format(const T_ & s, const format::Plain & p) const
- {
- return _proxy->format(s, p);
- }
- };
-
- /**
- * Used by Formatter to implement the CanFormat<T_> interface.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_, unsigned u_>
- class PALUDIS_VISIBLE FormatFunctionsByProxy<T_, format::AcceptableRoles, u_> :
- public CanFormat<T_>
- {
- private:
- const CanFormat<T_> * const _proxy;
-
- public:
- ///\name Basic operations
- ///\{
-
- FormatFunctionsByProxy(const CanFormat<T_> * const p) :
- _proxy(p)
- {
- }
-
- ///\}
-
- virtual std::string format(const T_ & s, const format::Plain & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string format(const T_ & s, const format::Accepted & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string format(const T_ & s, const format::Unaccepted & p) const
- {
- return _proxy->format(s, p);
- }
- };
-
- /**
- * Used by Formatter to implement the CanFormat<T_> interface.
- *
- * \ingroup g_formatters
- * \since 0.32
- * \nosubgrouping
- */
- template <typename T_, unsigned u_>
- class PALUDIS_VISIBLE FormatFunctionsByProxy<T_, format::ChoiceRoles, u_> :
- public CanFormat<T_>
- {
- private:
- const CanFormat<T_> * const _proxy;
-
- public:
- ///\name Basic operations
- ///\{
-
- FormatFunctionsByProxy(const CanFormat<T_> * const p) :
- _proxy(p)
- {
- }
-
- ///\}
-
- virtual std::string format(const T_ & s, const format::Plain & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string format(const T_ & s, const format::Enabled & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string format(const T_ & s, const format::Disabled & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string format(const T_ & s, const format::Forced & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string format(const T_ & s, const format::Masked & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string decorate(const T_ & t, const std::string & s, const format::Changed & p) const
- {
- return _proxy->decorate(t, s, p);
- }
-
- virtual std::string decorate(const T_ & t, const std::string & s, const format::Added & p) const
- {
- return _proxy->decorate(t, s, p);
- }
- };
-
- /**
- * Used by Formatter to implement the CanFormat<T_> interface.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <typename T_, unsigned u_>
- class PALUDIS_VISIBLE FormatFunctionsByProxy<T_, format::PackageRoles, u_> :
- public CanFormat<T_>
- {
- private:
- const CanFormat<T_> * const _proxy;
-
- public:
- ///\name Basic operations
- ///\{
-
- FormatFunctionsByProxy(const CanFormat<T_> * const p) :
- _proxy(p)
- {
- }
-
- ///\}
-
- virtual std::string format(const T_ & s, const format::Plain & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string format(const T_ & s, const format::Installed & p) const
- {
- return _proxy->format(s, p);
- }
-
- virtual std::string format(const T_ & s, const format::Installable & p) const
- {
- return _proxy->format(s, p);
- }
- };
-
- /**
- * Used by Formatter to implement the CanFormat<T_> interface.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <unsigned u_>
- class PALUDIS_VISIBLE FormatFunctionsByProxy<NoType<u_>, format::NoRoles, u_>
- {
- public:
- ///\name Basic operations
- ///\{
-
- FormatFunctionsByProxy(const void * const)
- {
- }
-
- ///\}
-
- void format(const NoType<u_> &) const;
- };
-
- /**
- * A Formatter is a class that implements all the format routines for each
- * of its template parameters.
- *
- * A Formatter is required by most MetadataKey pretty_print methods. Instead
- * of requiring that formatters support every format method with every
- * possible role for every class, scary template voodoo is used to ensure that
- * only the format methods appropriate for the classes passed as template
- * parameters with roles appropriate for those classes are required.
- *
- * A Formatter can be implicitly constructed from any type that implements
- * CanFormat<> for every requested type, as well as the CanSpace interface.
- *
- * For a basic formatter that uses paludis::stringify() to do all
- * formatting, see StringifyFormatter.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <
- typename T1_,
- typename T2_,
- typename T3_,
- typename T4_,
- typename T5_,
- typename T6_,
- typename T7_,
- typename T8_,
- typename T9_,
- typename T10_,
- typename T11_,
- typename T12_,
- typename T13_,
- typename T14_,
- typename T15_,
- typename T16_,
- typename T17_,
- typename T18_,
- typename T19_,
- typename T20_
- >
- class PALUDIS_VISIBLE Formatter :
- public FormatFunctionsByProxy<T1_, typename format::CategorySelector<T1_>::Category, 1>,
- public FormatFunctionsByProxy<T2_, typename format::CategorySelector<T2_>::Category, 2>,
- public FormatFunctionsByProxy<T3_, typename format::CategorySelector<T3_>::Category, 3>,
- public FormatFunctionsByProxy<T4_, typename format::CategorySelector<T4_>::Category, 4>,
- public FormatFunctionsByProxy<T5_, typename format::CategorySelector<T5_>::Category, 5>,
- public FormatFunctionsByProxy<T6_, typename format::CategorySelector<T6_>::Category, 6>,
- public FormatFunctionsByProxy<T7_, typename format::CategorySelector<T7_>::Category, 7>,
- public FormatFunctionsByProxy<T8_, typename format::CategorySelector<T8_>::Category, 8>,
- public FormatFunctionsByProxy<T9_, typename format::CategorySelector<T9_>::Category, 9>,
- public FormatFunctionsByProxy<T10_, typename format::CategorySelector<T10_>::Category, 10>,
- public FormatFunctionsByProxy<T11_, typename format::CategorySelector<T11_>::Category, 11>,
- public FormatFunctionsByProxy<T12_, typename format::CategorySelector<T12_>::Category, 12>,
- public FormatFunctionsByProxy<T13_, typename format::CategorySelector<T13_>::Category, 13>,
- public FormatFunctionsByProxy<T14_, typename format::CategorySelector<T14_>::Category, 14>,
- public FormatFunctionsByProxy<T15_, typename format::CategorySelector<T15_>::Category, 15>,
- public FormatFunctionsByProxy<T16_, typename format::CategorySelector<T16_>::Category, 16>,
- public FormatFunctionsByProxy<T17_, typename format::CategorySelector<T17_>::Category, 17>,
- public FormatFunctionsByProxy<T18_, typename format::CategorySelector<T18_>::Category, 18>,
- public FormatFunctionsByProxy<T19_, typename format::CategorySelector<T19_>::Category, 19>,
- public FormatFunctionsByProxy<T20_, typename format::CategorySelector<T20_>::Category, 20>,
- public CanSpace
- {
- private:
- const CanSpace * const _proxy;
-
- public:
- ///\name Basic operations
- ///\{
-
- /**
- * A Formatter is implicitly constructible from any type that
- * supports all the relevant CanFormat<> interfaces, as well as the
- * CanSpace interface.
- */
- template <typename T_>
- Formatter(const T_ & t) :
- FormatFunctionsByProxy<T1_, typename format::CategorySelector<T1_>::Category, 1>(&t),
- FormatFunctionsByProxy<T2_, typename format::CategorySelector<T2_>::Category, 2>(&t),
- FormatFunctionsByProxy<T3_, typename format::CategorySelector<T3_>::Category, 3>(&t),
- FormatFunctionsByProxy<T4_, typename format::CategorySelector<T4_>::Category, 4>(&t),
- FormatFunctionsByProxy<T5_, typename format::CategorySelector<T5_>::Category, 5>(&t),
- FormatFunctionsByProxy<T6_, typename format::CategorySelector<T6_>::Category, 6>(&t),
- FormatFunctionsByProxy<T7_, typename format::CategorySelector<T7_>::Category, 7>(&t),
- FormatFunctionsByProxy<T8_, typename format::CategorySelector<T8_>::Category, 8>(&t),
- FormatFunctionsByProxy<T9_, typename format::CategorySelector<T9_>::Category, 9>(&t),
- FormatFunctionsByProxy<T10_, typename format::CategorySelector<T10_>::Category, 10>(&t),
- FormatFunctionsByProxy<T11_, typename format::CategorySelector<T11_>::Category, 11>(&t),
- FormatFunctionsByProxy<T12_, typename format::CategorySelector<T12_>::Category, 12>(&t),
- FormatFunctionsByProxy<T13_, typename format::CategorySelector<T13_>::Category, 13>(&t),
- FormatFunctionsByProxy<T14_, typename format::CategorySelector<T14_>::Category, 14>(&t),
- FormatFunctionsByProxy<T15_, typename format::CategorySelector<T15_>::Category, 15>(&t),
- FormatFunctionsByProxy<T16_, typename format::CategorySelector<T16_>::Category, 16>(&t),
- FormatFunctionsByProxy<T17_, typename format::CategorySelector<T17_>::Category, 17>(&t),
- FormatFunctionsByProxy<T18_, typename format::CategorySelector<T18_>::Category, 18>(&t),
- FormatFunctionsByProxy<T19_, typename format::CategorySelector<T19_>::Category, 19>(&t),
- FormatFunctionsByProxy<T20_, typename format::CategorySelector<T20_>::Category, 20>(&t),
- CanSpace(),
- _proxy(&t)
- {
- }
-
- Formatter(const Formatter & other) :
- FormatFunctionsByProxy<T1_, typename format::CategorySelector<T1_>::Category, 1>(other),
- FormatFunctionsByProxy<T2_, typename format::CategorySelector<T2_>::Category, 2>(other),
- FormatFunctionsByProxy<T3_, typename format::CategorySelector<T3_>::Category, 3>(other),
- FormatFunctionsByProxy<T4_, typename format::CategorySelector<T4_>::Category, 4>(other),
- FormatFunctionsByProxy<T5_, typename format::CategorySelector<T5_>::Category, 5>(other),
- FormatFunctionsByProxy<T6_, typename format::CategorySelector<T6_>::Category, 6>(other),
- FormatFunctionsByProxy<T7_, typename format::CategorySelector<T7_>::Category, 7>(other),
- FormatFunctionsByProxy<T8_, typename format::CategorySelector<T8_>::Category, 8>(other),
- FormatFunctionsByProxy<T9_, typename format::CategorySelector<T9_>::Category, 9>(other),
- FormatFunctionsByProxy<T10_, typename format::CategorySelector<T10_>::Category, 10>(other),
- FormatFunctionsByProxy<T11_, typename format::CategorySelector<T11_>::Category, 11>(other),
- FormatFunctionsByProxy<T12_, typename format::CategorySelector<T12_>::Category, 12>(other),
- FormatFunctionsByProxy<T13_, typename format::CategorySelector<T13_>::Category, 13>(other),
- FormatFunctionsByProxy<T14_, typename format::CategorySelector<T14_>::Category, 14>(other),
- FormatFunctionsByProxy<T15_, typename format::CategorySelector<T15_>::Category, 15>(other),
- FormatFunctionsByProxy<T16_, typename format::CategorySelector<T16_>::Category, 16>(other),
- FormatFunctionsByProxy<T17_, typename format::CategorySelector<T17_>::Category, 17>(other),
- FormatFunctionsByProxy<T18_, typename format::CategorySelector<T18_>::Category, 18>(other),
- FormatFunctionsByProxy<T19_, typename format::CategorySelector<T19_>::Category, 19>(other),
- FormatFunctionsByProxy<T20_, typename format::CategorySelector<T20_>::Category, 20>(other),
- CanSpace(other),
- _proxy(other._proxy)
- {
- }
-
- ///\}
-
- using FormatFunctionsByProxy<T1_, typename format::CategorySelector<T1_>::Category, 1>::format;
- using FormatFunctionsByProxy<T2_, typename format::CategorySelector<T2_>::Category, 2>::format;
- using FormatFunctionsByProxy<T3_, typename format::CategorySelector<T3_>::Category, 3>::format;
- using FormatFunctionsByProxy<T4_, typename format::CategorySelector<T4_>::Category, 4>::format;
- using FormatFunctionsByProxy<T5_, typename format::CategorySelector<T5_>::Category, 5>::format;
- using FormatFunctionsByProxy<T6_, typename format::CategorySelector<T6_>::Category, 6>::format;
- using FormatFunctionsByProxy<T7_, typename format::CategorySelector<T7_>::Category, 7>::format;
- using FormatFunctionsByProxy<T8_, typename format::CategorySelector<T8_>::Category, 8>::format;
- using FormatFunctionsByProxy<T9_, typename format::CategorySelector<T9_>::Category, 9>::format;
- using FormatFunctionsByProxy<T10_, typename format::CategorySelector<T10_>::Category, 10>::format;
- using FormatFunctionsByProxy<T11_, typename format::CategorySelector<T11_>::Category, 11>::format;
- using FormatFunctionsByProxy<T12_, typename format::CategorySelector<T12_>::Category, 12>::format;
- using FormatFunctionsByProxy<T13_, typename format::CategorySelector<T13_>::Category, 13>::format;
- using FormatFunctionsByProxy<T14_, typename format::CategorySelector<T14_>::Category, 14>::format;
- using FormatFunctionsByProxy<T15_, typename format::CategorySelector<T15_>::Category, 15>::format;
- using FormatFunctionsByProxy<T16_, typename format::CategorySelector<T16_>::Category, 16>::format;
- using FormatFunctionsByProxy<T17_, typename format::CategorySelector<T17_>::Category, 17>::format;
- using FormatFunctionsByProxy<T18_, typename format::CategorySelector<T18_>::Category, 18>::format;
- using FormatFunctionsByProxy<T19_, typename format::CategorySelector<T19_>::Category, 19>::format;
- using FormatFunctionsByProxy<T20_, typename format::CategorySelector<T20_>::Category, 20>::format;
-
- virtual std::string newline() const
- {
- return _proxy->newline();
- }
-
- virtual std::string indent(const int i) const
- {
- return _proxy->indent(i);
- }
- };
-}
-
-#endif
diff --git a/paludis/legacy/dep_list_TEST.cc b/paludis/legacy/dep_list_TEST.cc
index 8ea8599..bfc2a1b 100644
--- a/paludis/legacy/dep_list_TEST.cc
+++ b/paludis/legacy/dep_list_TEST.cc
@@ -21,10 +21,8 @@
#include <paludis/util/set.hh>
#include <paludis/package_id.hh>
#include <paludis/mask.hh>
-#include <paludis/stringify_formatter-impl.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/legacy/override_functions.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/choice.hh>
using namespace paludis;
diff --git a/paludis/literal_metadata_key.cc b/paludis/literal_metadata_key.cc
index 79895fc..da11fa7 100644
--- a/paludis/literal_metadata_key.cc
+++ b/paludis/literal_metadata_key.cc
@@ -23,7 +23,6 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/join.hh>
#include <paludis/util/timestamp.hh>
-#include <paludis/formatter.hh>
#include <paludis/package_id.hh>
#include <paludis/action.hh>
#include <paludis/repository.hh>
@@ -143,21 +142,6 @@ LiteralMetadataFSPathSequenceKey::value() const
return _imp->value;
}
-namespace
-{
- std::string format_fsentry(const FSPath & i, const Formatter<FSPath> & f)
- {
- return f.format(i, format::Plain());
- }
-}
-
-std::string
-LiteralMetadataFSPathSequenceKey::pretty_print_flat(const Formatter<FSPath> & f) const
-{
- using namespace std::placeholders;
- return join(value()->begin(), value()->end(), " ", std::bind(&format_fsentry, _1, f));
-}
-
const std::string
LiteralMetadataFSPathSequenceKey::pretty_print_value(
const PrettyPrinter & p, const PrettyPrintOptions &) const
@@ -252,19 +236,6 @@ LiteralMetadataStringSequenceKey::type() const
return _imp->type;
}
-namespace
-{
- std::string format_string(const std::string & i, const Formatter<std::string> & f)
- {
- return f.format(i, format::Plain());
- }
-
- std::string format_string_string(const std::pair<const std::string, std::string> & i, const Formatter<std::pair<const std::string, std::string> > & f)
- {
- return f.format(i, format::Plain());
- }
-}
-
const std::string
LiteralMetadataStringSetKey::pretty_print_value(
const PrettyPrinter & p, const PrettyPrintOptions &) const
@@ -272,13 +243,6 @@ LiteralMetadataStringSetKey::pretty_print_value(
return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p));
}
-std::string
-LiteralMetadataStringSetKey::pretty_print_flat(const Formatter<std::string> & f) const
-{
- using namespace std::placeholders;
- 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
@@ -286,13 +250,6 @@ LiteralMetadataStringStringMapKey::pretty_print_value(
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
-{
- using namespace std::placeholders;
- 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
@@ -300,13 +257,6 @@ LiteralMetadataStringSequenceKey::pretty_print_value(
return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p));
}
-std::string
-LiteralMetadataStringSequenceKey::pretty_print_flat(const Formatter<std::string> & f) const
-{
- using namespace std::placeholders;
- return join(value()->begin(), value()->end(), " ", std::bind(&format_string, _1, f));
-}
-
const std::string
LiteralMetadataStringSetKey::human_name() const
{
diff --git a/paludis/literal_metadata_key.hh b/paludis/literal_metadata_key.hh
index 9a4bb03..a8b55d4 100644
--- a/paludis/literal_metadata_key.hh
+++ b/paludis/literal_metadata_key.hh
@@ -111,9 +111,6 @@ namespace paludis
virtual const std::shared_ptr<const FSPathSequence> value() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print_flat(const Formatter<FSPath> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -149,9 +146,6 @@ namespace paludis
virtual const std::shared_ptr<const Set<std::string> > value() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print_flat(const Formatter<std::string> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -187,9 +181,6 @@ namespace paludis
virtual const std::shared_ptr<const Sequence<std::string> > value() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print_flat(const Formatter<std::string> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -256,9 +247,6 @@ namespace paludis
virtual const std::shared_ptr<const Map<std::string, std::string> > value() const PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print_flat(const Formatter<std::pair<const std::string, std::string> > &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
diff --git a/paludis/metadata_key.hh b/paludis/metadata_key.hh
index 2652d70..e70cc1c 100644
--- a/paludis/metadata_key.hh
+++ b/paludis/metadata_key.hh
@@ -28,7 +28,6 @@
#include <paludis/spec_tree.hh>
#include <paludis/contents-fwd.hh>
#include <paludis/repository-fwd.hh>
-#include <paludis/formatter-fwd.hh>
#include <paludis/metadata_key_holder.hh>
#include <paludis/choice-fwd.hh>
#include <paludis/pretty_printer-fwd.hh>
diff --git a/paludis/repositories/accounts/accounts_dep_key.cc b/paludis/repositories/accounts/accounts_dep_key.cc
index d7d3aec..fdd9098 100644
--- a/paludis/repositories/accounts/accounts_dep_key.cc
+++ b/paludis/repositories/accounts/accounts_dep_key.cc
@@ -27,7 +27,6 @@
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
#include <paludis/dep_spec.hh>
-#include <paludis/formatter.hh>
#include <paludis/environment.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/partially_made_package_dep_spec.hh>
@@ -121,41 +120,6 @@ AccountsDepKey::initial_labels() const
return AccountsDepKeyData::get_instance()->initial_labels;
}
-std::string
-AccountsDepKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
-{
- return f.indent(0) + pretty_print_flat(f) + "\n";
-}
-
-std::string
-AccountsDepKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) 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 << ", ";
-
- if (_imp->env)
- {
- if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(**i, { }) |
- filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]->empty())
- s << f.format(**i, format::Installed());
- else if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(**i, { }) |
- filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty())
- s << f.format(**i, format::Installable());
- else
- s << f.format(**i, format::Plain());
- }
- else
- s << f.format(**i, format::Plain());
- }
-
- return s.str();
-}
-
const std::string
AccountsDepKey::pretty_print_value(
const PrettyPrinter & pretty_printer,
diff --git a/paludis/repositories/accounts/accounts_dep_key.hh b/paludis/repositories/accounts/accounts_dep_key.hh
index d269c00..177e20a 100644
--- a/paludis/repositories/accounts/accounts_dep_key.hh
+++ b/paludis/repositories/accounts/accounts_dep_key.hh
@@ -43,10 +43,6 @@ namespace paludis
virtual const std::shared_ptr<const DependencySpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const DependencySpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/cran/Makefile.am b/paludis/repositories/cran/Makefile.am
index 7746b53..f525c15 100644
--- a/paludis/repositories/cran/Makefile.am
+++ b/paludis/repositories/cran/Makefile.am
@@ -21,7 +21,6 @@ noinst_HEADERS = \
masks.hh \
keys.hh \
normalise.hh \
- dep_spec_pretty_printer.hh \
spec_tree_pretty_printer.hh \
package_dep_spec.hh
@@ -35,7 +34,6 @@ libpaludiscranrepository_la_SOURCES = \
normalise.cc \
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/cran_dep_parser_TEST.cc b/paludis/repositories/cran/cran_dep_parser_TEST.cc
index 19766a1..fe57261 100644
--- a/paludis/repositories/cran/cran_dep_parser_TEST.cc
+++ b/paludis/repositories/cran/cran_dep_parser_TEST.cc
@@ -20,10 +20,10 @@
#include <paludis/dep_spec.hh>
#include <paludis/dep_spec_flattener.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/environments/test/test_environment.hh>
#include <paludis/util/system.hh>
-#include <paludis/stringify_formatter.hh>
+#include <paludis/unformatted_pretty_printer.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -38,9 +38,9 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
- cranrepository::DepSpecPrettyPrinter d1(0, ff, 0, false), d2(0, ff, 0, false), d3(0, ff, 0, false),
- d4(0, ff, 0, false), d5(0, ff, 0, false), d6(0, ff, 0, false);
+ UnformattedPrettyPrinter ff;
+ cranrepository::SpecTreePrettyPrinter d1(ff, { }), d2(ff, { }), d3(ff, { }),
+ d4(ff, { }), d5(ff, { }), d6(ff, { });
// test R dependency
std::string dep1("R (>= 2.0.0)");
diff --git a/paludis/repositories/cran/dep_spec_pretty_printer.cc b/paludis/repositories/cran/dep_spec_pretty_printer.cc
deleted file mode 100644
index 5d93d86..0000000
--- a/paludis/repositories/cran/dep_spec_pretty_printer.cc
+++ /dev/null
@@ -1,155 +0,0 @@
-/* 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
- */
-
-#include <paludis/repositories/cran/dep_spec_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/environment.hh>
-#include <paludis/selection.hh>
-#include <paludis/generator.hh>
-#include <paludis/filter.hh>
-#include <paludis/filtered_generator.hh>
-#include <paludis/action-fwd.hh>
-#include <paludis/metadata_key.hh>
-#include <algorithm>
-#include <ostream>
-#include <sstream>
-
-using namespace paludis;
-using namespace paludis::cranrepository;
-
-namespace paludis
-{
- template <>
- struct Imp<DepSpecPrettyPrinter>
- {
- std::stringstream s;
- const Environment * const env;
- GenericSpecTree::ItemFormatter formatter;
- const unsigned indent;
- const bool multiline;
- bool need_comma;
-
- Imp(
- const Environment * const e,
- const GenericSpecTree::ItemFormatter & f,
- const unsigned u,
- const bool m) :
- env(e),
- formatter(f),
- indent(u),
- multiline(m),
- need_comma(false)
- {
- }
- };
-}
-
-DepSpecPrettyPrinter::DepSpecPrettyPrinter(const Environment * const e,
- const GenericSpecTree::ItemFormatter & f, const unsigned initial_indent, const bool multiline) :
- Pimp<DepSpecPrettyPrinter>(e, f, initial_indent, multiline)
-{
-}
-
-DepSpecPrettyPrinter::~DepSpecPrettyPrinter()
-{
-}
-
-void
-DepSpecPrettyPrinter::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
-{
- if (_imp->multiline)
- _imp->s << _imp->formatter.indent(_imp->indent);
- else if (_imp->need_comma)
- _imp->s << ", ";
- else
- _imp->need_comma = true;
-
- if (_imp->env)
- {
- if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
- filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]->empty())
- _imp->s << _imp->formatter.format(*node.spec(), format::Installed());
- else if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
- filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty())
- _imp->s << _imp->formatter.format(*node.spec(), format::Installable());
- else
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- }
- else
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- if (_imp->multiline)
- _imp->s << _imp->formatter.newline();
-}
-
-void
-DepSpecPrettyPrinter::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node)
-{
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
-}
-
-void
-DepSpecPrettyPrinter::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node)
-{
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
-}
-
-void
-DepSpecPrettyPrinter::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
-{
- std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
-}
-
-void
-DepSpecPrettyPrinter::visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
-{
-}
-
-void
-DepSpecPrettyPrinter::visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &)
-{
-}
-
-void
-DepSpecPrettyPrinter::visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
-{
- if (_imp->multiline)
- _imp->s << _imp->formatter.indent(_imp->indent);
- else if (_imp->need_comma)
- _imp->s << ", ";
- else
- _imp->need_comma = true;
-
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- if (_imp->multiline)
- _imp->s << _imp->formatter.newline();
-}
-
-std::ostream &
-paludis::cranrepository::operator<< (std::ostream & s, const DepSpecPrettyPrinter & p)
-{
- s << p._imp->s.str();
- return s;
-}
-
diff --git a/paludis/repositories/cran/dep_spec_pretty_printer.hh b/paludis/repositories/cran/dep_spec_pretty_printer.hh
deleted file mode 100644
index d2ddf4a..0000000
--- a/paludis/repositories/cran/dep_spec_pretty_printer.hh
+++ /dev/null
@@ -1,86 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007, 2008, 2009 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_DEP_SPEC_PRETTY_PRINTER_HH
-#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_CRAN_DEP_SPEC_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/environment-fwd.hh>
-#include <iosfwd>
-
-namespace paludis
-{
- namespace cranrepository
- {
- /**
- * Pretty printer for CRAN dep heirarchies.
- *
- * \ingroup grpcranrepository
- */
- class PALUDIS_VISIBLE DepSpecPrettyPrinter :
- private Pimp<DepSpecPrettyPrinter>
- {
- friend std::ostream & operator<< (std::ostream &, const DepSpecPrettyPrinter &);
-
- public:
- ///\name Basic operations
- ///\{
-
- /**
- * Constructor.
- *
- * \param env An optional environment, to use for formatting PackageDepSpec items
- * as format::Installed() etc. May be null, in which case format::Plain() is
- * always used.
- *
- * \param formatter The formatter to use. If no fancy formatting is required, use
- * StringifyFormatter.
- *
- * \param initial_indent Amount of indenting to use. Should probably be 0 if
- * use_newlines is false.
- *
- * \param use_newlines Whether to format over multiple lines.
- */
- DepSpecPrettyPrinter(
- const Environment * const env,
- const GenericSpecTree::ItemFormatter & formatter,
- unsigned initial_indent,
- bool use_newlines);
-
- ~DepSpecPrettyPrinter();
-
- ///\}
-
- 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 DepSpecPrettyPrinter & p) PALUDIS_VISIBLE;
- }
-}
-
-#endif
diff --git a/paludis/repositories/cran/keys.cc b/paludis/repositories/cran/keys.cc
index de39723..019c409 100644
--- a/paludis/repositories/cran/keys.cc
+++ b/paludis/repositories/cran/keys.cc
@@ -20,7 +20,6 @@
#include <paludis/repositories/cran/keys.hh>
#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>
@@ -28,9 +27,8 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/pimp-impl.hh>
#include <paludis/dep_spec.hh>
-#include <paludis/stringify_formatter-impl.hh>
-#include <paludis/formatter.hh>
#include <paludis/action.hh>
#include <paludis/repository.hh>
#include <paludis/environment.hh>
@@ -81,16 +79,6 @@ PackageIDSequenceKey::push_back(const std::shared_ptr<const PackageID> & i)
_v->push_back(i);
}
-std::string
-PackageIDSequenceKey::pretty_print_flat(const Formatter<PackageID> & f) const
-{
- using namespace std::placeholders;
- return join(indirect_iterator(value()->begin()), indirect_iterator(value()->end()), " ",
- std::bind(static_cast<std::string (Formatter<PackageID>::*)(const PackageID &, const format::Plain &) const>(
- &Formatter<PackageID>::format),
- std::cref(f), _1, format::Plain()));
-}
-
const std::string
PackageIDSequenceKey::pretty_print_value(
const PrettyPrinter & p, const PrettyPrintOptions &) const
@@ -139,23 +127,6 @@ PackageIDKey::type() const
return _t;
}
-std::string
-PackageIDKey::pretty_print(const Formatter<PackageID> & f) const
-{
- auto repo(_env->package_database()->fetch_repository(_v->repository_name()));
- if (repo->installed_root_key())
- return f.format(*_v, format::Installed());
- else if (_v->supports_action(SupportsActionTest<InstallAction>()))
- {
- if (_v->masked())
- return f.format(*_v, format::Plain());
- else
- return f.format(*_v, format::Installable());
- }
- else
- return f.format(*_v, format::Plain());
-}
-
namespace paludis
{
template <>
@@ -227,24 +198,6 @@ DepKey::value() const
return _imp->c;
}
-std::string
-DepKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, ff, 12, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
-std::string
-DepKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, ff, 0, false);
- value()->top()->accept(p);
- return stringify(p);
-}
-
const std::string
DepKey::pretty_print_value(
const PrettyPrinter & printer, const PrettyPrintOptions & options) const
diff --git a/paludis/repositories/cran/keys.hh b/paludis/repositories/cran/keys.hh
index 4faa602..00b0e90 100644
--- a/paludis/repositories/cran/keys.hh
+++ b/paludis/repositories/cran/keys.hh
@@ -50,9 +50,6 @@ namespace paludis
void push_back(const std::shared_ptr<const PackageID> &);
- virtual std::string pretty_print_flat(const Formatter<PackageID> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -79,9 +76,6 @@ namespace paludis
virtual const std::shared_ptr<const PackageID> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const Formatter<PackageID> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -108,12 +102,6 @@ namespace paludis
virtual const std::shared_ptr<const DependencySpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const DependencySpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/cran/spec_tree_pretty_printer.hh b/paludis/repositories/cran/spec_tree_pretty_printer.hh
index 78e2994..8b1ca8c 100644
--- a/paludis/repositories/cran/spec_tree_pretty_printer.hh
+++ b/paludis/repositories/cran/spec_tree_pretty_printer.hh
@@ -23,7 +23,6 @@
#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>
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index b9f2e6e..956e8f6 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -28,7 +28,6 @@ noinst_HEADERS = \
dep_parser.hh \
dep_parser-se.hh \
dep_parser-fwd.hh \
- dep_spec_pretty_printer.hh \
dependencies_rewriter.hh \
do_fetch_action.hh \
do_info_action.hh \
@@ -101,7 +100,6 @@ libpaludiserepository_la_SOURCES = \
check_fetched_files_visitor.cc \
check_userpriv.cc \
dep_parser.cc \
- dep_spec_pretty_printer.cc \
dependencies_rewriter.cc \
do_fetch_action.cc \
do_info_action.cc \
@@ -374,17 +372,6 @@ e_repository_sets_TEST_LDADD = \
e_repository_sets_TEST_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
-dep_spec_pretty_printer_TEST_SOURCES = dep_spec_pretty_printer_TEST.cc
-
-dep_spec_pretty_printer_TEST_LDADD = \
- $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/paludis/util/test_extras.o \
- $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
- $(top_builddir)/test/libtest.a \
- $(DYNAMIC_LD_LIBS)
-
-dep_spec_pretty_printer_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
-
dep_parser_TEST_SOURCES = dep_parser_TEST.cc
dep_parser_TEST_LDADD = \
@@ -457,7 +444,6 @@ EXTRA_DIST = \
dep_parser-se.hh \
dep_parser-se.cc \
dep_parser_TEST.cc \
- dep_spec_pretty_printer_TEST.cc \
depend_rdepend_TEST.cc \
depend_rdepend_TEST_setup.sh \
depend_rdepend_TEST_cleanup.sh \
@@ -649,7 +635,6 @@ TESTS = \
exndbam_repository_TEST \
aa_visitor_TEST \
dep_parser_TEST \
- dep_spec_pretty_printer_TEST \
depend_rdepend_TEST \
e_repository_sets_TEST \
ebuild_flat_metadata_cache_TEST \
diff --git a/paludis/repositories/e/dep_parser_TEST.cc b/paludis/repositories/e/dep_parser_TEST.cc
index 8c49cd9..c27a5f3 100644
--- a/paludis/repositories/e/dep_parser_TEST.cc
+++ b/paludis/repositories/e/dep_parser_TEST.cc
@@ -17,14 +17,14 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/e/dep_parser.hh>
+#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/package_database.hh>
-#include <paludis/stringify_formatter.hh>
+#include <paludis/unformatted_pretty_printer.hh>
#include <paludis/util/make_named_values.hh>
#include <sstream>
#include <test/test_framework.hh>
@@ -59,8 +59,8 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ UnformattedPrettyPrinter ff;
+ SpecTreePrettyPrinter d(ff, { });
parse_depend("",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "");
@@ -85,8 +85,8 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ UnformattedPrettyPrinter ff;
+ SpecTreePrettyPrinter d(ff, { });
parse_depend(" \n \t",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "");
@@ -111,8 +111,8 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ UnformattedPrettyPrinter ff;
+ SpecTreePrettyPrinter d(ff, { });
parse_depend("app-editors/vim",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "app-editors/vim");
@@ -129,7 +129,7 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
TestEnvironment env;
const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
@@ -138,17 +138,17 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- DepSpecPrettyPrinter d1(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d1(ff, { });
parse_depend(">=app-editors/vim-6.4_alpha",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d1);
TEST_CHECK_EQUAL(stringify(d1), ">=app-editors/vim-6.4_alpha");
- DepSpecPrettyPrinter d2(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d2(ff, { });
parse_depend("=app-editors/vim-6.4_alpha-r1",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d2);
TEST_CHECK_EQUAL(stringify(d2), "=app-editors/vim-6.4_alpha-r1");
- DepSpecPrettyPrinter d3(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d3(ff, { });
parse_depend(">=app-editors/vim-6.4_alpha:one",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d3);
TEST_CHECK_EQUAL(stringify(d3), ">=app-editors/vim-6.4_alpha:one");
@@ -165,7 +165,7 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
TestEnvironment env;
const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
@@ -174,7 +174,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d(ff, { });
parse_depend("app-editors/vim app-misc/hilite \nsys-apps/findutils",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "app-editors/vim app-misc/hilite sys-apps/findutils");
@@ -187,7 +187,7 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
TestEnvironment env;
const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
@@ -196,7 +196,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d(ff, { });
parse_depend("|| ( one/one two/two )",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "|| ( one/one two/two )");
@@ -209,7 +209,7 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
TestEnvironment env;
const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
@@ -218,7 +218,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d(ff, { });
parse_depend("|| ( one/one foo? ( two/two ) )",
&env, id, *EAPIData::get_instance()->eapi_from_string("0"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "|| ( one/one foo? ( two/two ) )");
@@ -226,7 +226,7 @@ namespace test_cases
TEST_CHECK_THROWS(parse_depend("|| ( one/one foo? ( two/two ) )",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d), Exception);
- DepSpecPrettyPrinter e(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter e(ff, { });
parse_depend("|| ( one/one ( foo? ( two/two ) ) )",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(e);
TEST_CHECK_EQUAL(stringify(e), "|| ( one/one ( foo? ( two/two ) ) )");
@@ -243,7 +243,7 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
TestEnvironment env;
const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
@@ -252,7 +252,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d(ff, { });
parse_depend(" ( one/one two/two ) ",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "one/one two/two");
@@ -269,7 +269,7 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
TestEnvironment env;
const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
@@ -278,7 +278,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d(ff, { });
parse_depend("foo? ( one/one )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "foo? ( one/one )");
}
@@ -294,7 +294,7 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
TestEnvironment env;
const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
@@ -303,7 +303,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d(ff, { });
parse_depend("!foo? ( one/one )", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "!foo? ( one/one )");
}
@@ -315,7 +315,7 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
TestEnvironment env;
const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
@@ -324,11 +324,11 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, true, false);
+ SpecTreePrettyPrinter d(ff, { ppo_multiline_allowed });
parse_fetchable_uri("a\n->\tb", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "a -> b\n");
- DepSpecPrettyPrinter e(0, std::shared_ptr<const PackageID>(), ff, 0, true, false);
+ SpecTreePrettyPrinter e(ff, { ppo_multiline_allowed });
parse_fetchable_uri("a-> b", &env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(e);
TEST_CHECK_EQUAL(stringify(e), "a->\nb\n");
@@ -347,7 +347,7 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
TestEnvironment env;
const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
@@ -356,7 +356,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d(ff, { });
TEST_CHECK_THROWS(parse_depend("!foo? ( one/one",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend("!foo? ( one/one ) )",
@@ -380,7 +380,7 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
TestEnvironment env;
const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
@@ -389,7 +389,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d(ff, { });
TEST_CHECK_THROWS(parse_depend("||",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d), Exception);
TEST_CHECK_THROWS(parse_depend("|| ",
@@ -435,7 +435,7 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
TestEnvironment env;
const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
@@ -444,7 +444,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d(ff, { });
parse_depend("build: one/one",
&env, id, *EAPIData::get_instance()->eapi_from_string("exheres-0"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "build: one/one");
@@ -459,7 +459,7 @@ namespace test_cases
void run()
{
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
TestEnvironment env;
const std::shared_ptr<FakeRepository> repo(std::make_shared<FakeRepository>(make_named_values<FakeRepositoryParams>(
n::environment() = &env,
@@ -468,7 +468,7 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter d(ff, { });
parse_fetchable_uri("http://foo/bar manual: two",
&env, id, *EAPIData::get_instance()->eapi_from_string("exheres-0"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "http://foo/bar manual: two");
@@ -491,13 +491,13 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const PackageID> id(repo->add_version("cat", "pkg", "1"));
- StringifyFormatter ff;
- DepSpecPrettyPrinter d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ UnformattedPrettyPrinter ff;
+ SpecTreePrettyPrinter d(ff, { });
parse_depend("cat/first [[ foo = bar bar = baz ]] cat/second cat/third [[ moo = oink ]]",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(d);
TEST_CHECK_EQUAL(stringify(d), "cat/first [[ bar = [ baz ] foo = [ bar ] ]] cat/second cat/third [[ moo = [ oink ] ]]");
- DepSpecPrettyPrinter e(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter e(ff, { });
parse_depend("bar? ( foo? ( cat/first [[ for = first ]] ) [[ for = foo ]] baz? ( ) [[ for = baz ]] ) [[ for = bar ]]",
&env, id, *EAPIData::get_instance()->eapi_from_string("paludis-1"))->top()->accept(e);
TEST_CHECK_EQUAL(stringify(e), "bar? ( foo? ( cat/first [[ for = [ first ] ]] ) "
diff --git a/paludis/repositories/e/dep_spec_pretty_printer.cc b/paludis/repositories/e/dep_spec_pretty_printer.cc
deleted file mode 100644
index 6d64f0c..0000000
--- a/paludis/repositories/e/dep_spec_pretty_printer.cc
+++ /dev/null
@@ -1,603 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 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
- */
-
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
-#include <paludis/util/save.hh>
-#include <paludis/util/simple_visitor_cast.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/set.hh>
-#include <paludis/util/options.hh>
-#include <paludis/util/indirect_iterator-impl.hh>
-#include <paludis/util/accept_visitor.hh>
-#include <paludis/environment.hh>
-#include <paludis/selection.hh>
-#include <paludis/generator.hh>
-#include <paludis/filter.hh>
-#include <paludis/filtered_generator.hh>
-#include <paludis/action-fwd.hh>
-#include <paludis/dep_spec.hh>
-#include <paludis/formatter.hh>
-#include <paludis/dep_spec_annotations.hh>
-#include <paludis/metadata_key.hh>
-#include <algorithm>
-#include <sstream>
-
-/** \file
- * Imp of dep_spec_pretty_printer.hh.
- *
- * \ingroup grpdepspecprettyprinter
- */
-
-using namespace paludis;
-using namespace paludis::erepository;
-
-namespace paludis
-{
- template<>
- struct Imp<DepSpecPrettyPrinter>
- {
- std::stringstream s;
- const Environment * const env;
- const std::shared_ptr<const PackageID> id;
- GenericSpecTree::ItemFormatter formatter;
- unsigned indent;
- bool extra_label_indent;
- bool use_newlines;
- bool outer_block;
- bool all_needs_parens;
- bool need_space;
- bool check_conditions;
-
- Imp(
- const Environment * const e,
- const std::shared_ptr<const PackageID> & i,
- const GenericSpecTree::ItemFormatter & f,
- unsigned in,
- bool b,
- bool c) :
- env(e),
- id(i),
- formatter(f),
- indent(in),
- extra_label_indent(false),
- use_newlines(b),
- outer_block(true),
- all_needs_parens(false),
- need_space(false),
- check_conditions(c)
- {
- }
- };
-}
-
-DepSpecPrettyPrinter::DepSpecPrettyPrinter(
- const Environment * const e,
- const std::shared_ptr<const PackageID> & id,
- const GenericSpecTree::ItemFormatter & f,
- unsigned i,
- bool b,
- bool c) :
- Pimp<DepSpecPrettyPrinter>(e, id, f, i, b, c)
-{
-}
-
-DepSpecPrettyPrinter::~DepSpecPrettyPrinter()
-{
-}
-
-std::ostream &
-paludis::erepository::operator<< (std::ostream & s, const DepSpecPrettyPrinter & 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
-DepSpecPrettyPrinter::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->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
- _imp->s << "(";
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.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->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
- _imp->s << ")";
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
- }
-}
-
-void
-DepSpecPrettyPrinter::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->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
- _imp->s << "|| (";
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.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->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
- _imp->s << ")";
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-}
-
-void
-DepSpecPrettyPrinter::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->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
- _imp->s << "^^ (";
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.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->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
- _imp->s << ")";
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-}
-
-void
-DepSpecPrettyPrinter::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->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
-
- if (! _imp->check_conditions)
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain()) << " (";
- else if (node.spec()->condition_met(_imp->env, _imp->id))
- _imp->s << _imp->formatter.format(*node.spec(), format::Enabled()) << " (";
- else
- _imp->s << _imp->formatter.format(*node.spec(), format::Disabled()) << " (";
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.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->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
- _imp->s << ")";
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-}
-
-void
-DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node)
-{
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
-
- if (_imp->env && _imp->check_conditions)
- {
- if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
- filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]->empty())
- _imp->s << _imp->formatter.format(*node.spec(), format::Installed());
- else if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
- filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty())
- _imp->s << _imp->formatter.format(*node.spec(), format::Installable());
- else
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
- }
- else
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-}
-
-void
-DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type & node)
-{
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
-
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-}
-
-void
-DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type & node)
-{
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
-
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-}
-
-void
-DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type & node)
-{
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
-
- if (_imp->env && _imp->id && _imp->check_conditions)
- {
- if (_imp->env->accept_license(node.spec()->text(), _imp->id))
- _imp->s << _imp->formatter.format(*node.spec(), format::Accepted());
- else
- _imp->s << _imp->formatter.format(*node.spec(), format::Unaccepted());
- }
- else
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-}
-
-void
-DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & node)
-{
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
-
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-}
-
-void
-DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type & node)
-{
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
-
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-}
-
-void
-DepSpecPrettyPrinter::visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type & node)
-{
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
-
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-}
-
-void
-DepSpecPrettyPrinter::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->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
-
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-
- if (! _imp->extra_label_indent)
- {
- _imp->extra_label_indent = true;
- _imp->indent += 1;
- }
-}
-
-void
-DepSpecPrettyPrinter::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->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
-
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-
- if (! _imp->extra_label_indent)
- {
- _imp->extra_label_indent = true;
- _imp->indent += 1;
- }
-}
-
-void
-DepSpecPrettyPrinter::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->formatter.indent(_imp->indent);
- else if (_imp->need_space)
- _imp->s << " ";
-
- _imp->s << _imp->formatter.format(*node.spec(), format::Plain());
-
- do_annotations(*node.spec());
-
- if (_imp->use_newlines)
- _imp->s << _imp->formatter.newline();
- else
- _imp->need_space = true;
-
- if (!_imp->extra_label_indent)
- {
- _imp->extra_label_indent = true;
- _imp->indent += 1;
- }
-}
-
-void
-DepSpecPrettyPrinter::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/dep_spec_pretty_printer.hh b/paludis/repositories/e/dep_spec_pretty_printer.hh
deleted file mode 100644
index 59d85c8..0000000
--- a/paludis/repositories/e/dep_spec_pretty_printer.hh
+++ /dev/null
@@ -1,121 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 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_DEP_ATOM_PRETTY_PRINTER_HH
-#define PALUDIS_GUARD_PALUDIS_DEP_ATOM_PRETTY_PRINTER_HH 1
-
-#include <iosfwd>
-#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>
-
-/** \file
- * Declarations for the paludis::erepository::DepSpecPrettyPrinter class.
- *
- * \ingroup grperepository
- */
-
-namespace paludis
-{
- namespace erepository
- {
- /**
- * Pretty print dependency specs.
- *
- * \ingroup grperepository
- */
- class PALUDIS_VISIBLE DepSpecPrettyPrinter :
- private Pimp<DepSpecPrettyPrinter>
- {
- friend std::ostream & operator<< (std::ostream &, const DepSpecPrettyPrinter &);
-
- private:
- void do_annotations(const DepSpec &);
-
- public:
- ///\name Basic operations
- ///\{
-
- /**
- * Constructor.
- *
- * \param env An optional environment, to use for formatting PackageDepSpec items
- * as format::Installed() etc. May be null, in which case format::Plain() is
- * always used.
- *
- * \param id The ID to use for determining use flag formatting. May be null, in
- * which case format::Plain() is used.
- *
- * \param formatter The formatter to use. If no fancy formatting is required, use
- * StringifyFormatter.
- *
- * \param initial_indent Amount of indenting to use. Should probably be 0 if
- * use_newlines is false.
- *
- * \param use_newlines Whether to format over multiple lines.
- *
- * \param check_conditions Whether to check conditions and format as appropriate.
- * When writing cache files, formatting isn't useful and we don't have the choices
- * key ready yet.
- */
- DepSpecPrettyPrinter(
- const Environment * const env,
- const std::shared_ptr<const PackageID> & id,
- const GenericSpecTree::ItemFormatter & formatter,
- unsigned initial_indent,
- bool use_newlines,
- bool check_conditions);
-
- ~DepSpecPrettyPrinter();
-
- ///\}
-
- /// \name Visit functions
- ///{
-
- 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);
-
- ///}
- };
-
- /**
- * Output a DepSpecPrettyPrinter to an ostream.
- *
- * \ingroup grperepository
- */
- std::ostream & operator<< (std::ostream & s, const DepSpecPrettyPrinter & p) PALUDIS_VISIBLE;
- }
-}
-
-#endif
diff --git a/paludis/repositories/e/depend_rdepend_TEST.cc b/paludis/repositories/e/depend_rdepend_TEST.cc
index c8d8853..849c2a0 100644
--- a/paludis/repositories/e/depend_rdepend_TEST.cc
+++ b/paludis/repositories/e/depend_rdepend_TEST.cc
@@ -33,7 +33,6 @@
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/metadata_key.hh>
#include <paludis/unformatted_pretty_printer.hh>
#include <test/test_framework.hh>
diff --git a/paludis/repositories/e/e_choices_key.cc b/paludis/repositories/e/e_choices_key.cc
index a9cd8b8..023a79a 100644
--- a/paludis/repositories/e/e_choices_key.cc
+++ b/paludis/repositories/e/e_choices_key.cc
@@ -21,7 +21,6 @@
#include <paludis/repositories/e/e_key.hh>
#include <paludis/repositories/e/ebuild_id.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/e/profile.hh>
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/e/myoption.hh>
@@ -42,7 +41,6 @@
#include <paludis/util/accept_visitor.hh>
#include <paludis/environment.hh>
-#include <paludis/stringify_formatter-impl.hh>
#include <paludis/choice.hh>
#include <paludis/elike_choices.hh>
#include <paludis/dep_spec_annotations.hh>
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 3a7bd52..8013de3 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -21,7 +21,6 @@
#include <paludis/repositories/e/ebuild_id.hh>
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/e/vdb_contents_tokeniser.hh>
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/e/myoption.hh>
@@ -49,7 +48,6 @@
#include <paludis/contents.hh>
#include <paludis/repository.hh>
#include <paludis/environment.hh>
-#include <paludis/stringify_formatter-impl.hh>
#include <paludis/dep_spec_flattener.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/call_pretty_printer.hh>
@@ -179,24 +177,6 @@ EDependenciesKey::pretty_print_value(
return stringify(p);
}
-std::string
-EDependenciesKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
-std::string
-EDependenciesKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
const std::string
EDependenciesKey::raw_name() const
{
@@ -276,24 +256,6 @@ ELicenseKey::pretty_print_value(
return stringify(p);
}
-std::string
-ELicenseKey::pretty_print(const LicenseSpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
-std::string
-ELicenseKey::pretty_print_flat(const LicenseSpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
const std::string
ELicenseKey::raw_name() const
{
@@ -374,24 +336,6 @@ EFetchableURIKey::pretty_print_value(
return stringify(p);
}
-std::string
-EFetchableURIKey::pretty_print(const FetchableURISpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
-std::string
-EFetchableURIKey::pretty_print_flat(const FetchableURISpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
const std::shared_ptr<const URILabel>
EFetchableURIKey::initial_label() const
{
@@ -509,24 +453,6 @@ ESimpleURIKey::pretty_print_value(
return stringify(p);
}
-std::string
-ESimpleURIKey::pretty_print(const SimpleURISpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
-std::string
-ESimpleURIKey::pretty_print_flat(const SimpleURISpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
const std::string
ESimpleURIKey::raw_name() const
{
@@ -606,24 +532,6 @@ EPlainTextSpecKey::pretty_print_value(
return stringify(p);
}
-std::string
-EPlainTextSpecKey::pretty_print(const PlainTextSpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
-std::string
-EPlainTextSpecKey::pretty_print_flat(const PlainTextSpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
const std::string
EPlainTextSpecKey::raw_name() const
{
@@ -704,24 +612,6 @@ EMyOptionsKey::pretty_print_value(
return stringify(p);
}
-std::string
-EMyOptionsKey::pretty_print(const PlainTextSpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
-std::string
-EMyOptionsKey::pretty_print_flat(const PlainTextSpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
const std::string
EMyOptionsKey::raw_name() const
{
@@ -802,24 +692,6 @@ ERequiredUseKey::pretty_print_value(
return stringify(p);
}
-std::string
-ERequiredUseKey::pretty_print(const RequiredUseSpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
-std::string
-ERequiredUseKey::pretty_print_flat(const RequiredUseSpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
const std::string
ERequiredUseKey::raw_name() const
{
@@ -899,24 +771,6 @@ EProvideKey::pretty_print_value(
return stringify(p);
}
-std::string
-EProvideKey::pretty_print(const ProvideSpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, true, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
-std::string
-EProvideKey::pretty_print_flat(const ProvideSpecTree::ItemFormatter & f) const
-{
- StringifyFormatter ff(f);
- DepSpecPrettyPrinter p(_imp->env, _imp->id, ff, 0, false, true);
- value()->top()->accept(p);
- return stringify(p);
-}
-
const std::string
EProvideKey::raw_name() const
{
@@ -992,27 +846,6 @@ EKeywordsKey::pretty_print_value(const PrettyPrinter & p, const PrettyPrintOptio
return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(p));
}
-std::string
-EKeywordsKey::pretty_print_flat(const Formatter<KeywordName> & f) const
-{
- std::string result;
- for (KeywordNameSet::ConstIterator i(value()->begin()), i_end(value()->end()) ;
- i != i_end ; ++i)
- {
- if (! result.empty())
- result.append(" ");
-
- std::shared_ptr<KeywordNameSet> k(std::make_shared<KeywordNameSet>());
- k->insert(*i);
- if (_imp->env->accept_keywords(k, _imp->id))
- result.append(f.format(*i, format::Accepted()));
- else
- result.append(f.format(*i, format::Unaccepted()));
- }
-
- return result;
-}
-
const std::string
EKeywordsKey::raw_name() const
{
@@ -1099,21 +932,6 @@ EStringSetKey::type() const
return _imp->type;
}
-namespace
-{
- std::string format_string(const std::string & i, const Formatter<std::string> & f)
- {
- return f.format(i, format::Plain());
- }
-}
-
-std::string
-EStringSetKey::pretty_print_flat(const Formatter<std::string> & f) const
-{
- using namespace std::placeholders;
- 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
diff --git a/paludis/repositories/e/e_key.hh b/paludis/repositories/e/e_key.hh
index 6589da8..4b80c20 100644
--- a/paludis/repositories/e/e_key.hh
+++ b/paludis/repositories/e/e_key.hh
@@ -73,12 +73,6 @@ namespace paludis
virtual const std::shared_ptr<const DependencySpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const DependencySpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -106,12 +100,6 @@ namespace paludis
virtual const std::shared_ptr<const FetchableURISpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const FetchableURISpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const FetchableURISpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual const std::shared_ptr<const URILabel> initial_label() const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -137,12 +125,6 @@ namespace paludis
virtual const std::shared_ptr<const SimpleURISpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const SimpleURISpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const SimpleURISpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -166,12 +148,6 @@ namespace paludis
virtual const std::shared_ptr<const PlainTextSpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const PlainTextSpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const PlainTextSpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -194,12 +170,6 @@ namespace paludis
virtual const std::shared_ptr<const PlainTextSpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const PlainTextSpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const PlainTextSpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -222,12 +192,6 @@ namespace paludis
virtual const std::shared_ptr<const RequiredUseSpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const RequiredUseSpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const RequiredUseSpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -250,12 +214,6 @@ namespace paludis
virtual const std::shared_ptr<const ProvideSpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const ProvideSpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const ProvideSpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -280,12 +238,6 @@ namespace paludis
virtual const std::shared_ptr<const LicenseSpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const LicenseSpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const LicenseSpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -309,9 +261,6 @@ namespace paludis
const std::shared_ptr<const KeywordNameSet> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print_flat(const Formatter<KeywordName> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -333,9 +282,6 @@ namespace paludis
const std::shared_ptr<const Set<std::string> > value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print_flat(const Formatter<std::string> &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index d3b4a31..705970b 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -22,7 +22,7 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -38,7 +38,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
@@ -46,6 +45,7 @@
#include <paludis/selection.hh>
#include <paludis/repository_factory.hh>
#include <paludis/choice.hh>
+#include <paludis/unformatted_pretty_printer.hh>
#include <paludis/util/indirect_iterator-impl.hh>
@@ -504,12 +504,12 @@ namespace test_cases
TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id1->find_metadata("EAPI"))->value(), "0");
TEST_CHECK(bool(id1->short_description_key()));
TEST_CHECK_EQUAL(id1->short_description_key()->value(), "The Description");
- StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter pd(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ UnformattedPrettyPrinter ff;
+ erepository::SpecTreePrettyPrinter pd(ff, { });
TEST_CHECK(bool(id1->build_dependencies_key()));
id1->build_dependencies_key()->value()->top()->accept(pd);
TEST_CHECK_STRINGIFY_EQUAL(pd, "foo/bar");
- erepository::DepSpecPrettyPrinter pr(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::SpecTreePrettyPrinter pr(ff, { });
TEST_CHECK(bool(id1->run_dependencies_key()));
id1->run_dependencies_key()->value()->top()->accept(pr);
TEST_CHECK_STRINGIFY_EQUAL(pr, "foo/bar");
@@ -521,11 +521,11 @@ namespace test_cases
TEST_CHECK(id2->end_metadata() != id2->find_metadata("EAPI"));
TEST_CHECK(bool(id2->short_description_key()));
TEST_CHECK_EQUAL(id2->short_description_key()->value(), "dquote \" squote ' backslash \\ dollar $");
- erepository::DepSpecPrettyPrinter pd2(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::SpecTreePrettyPrinter pd2(ff, { });
TEST_CHECK(bool(id2->build_dependencies_key()));
id2->build_dependencies_key()->value()->top()->accept(pd2);
TEST_CHECK_STRINGIFY_EQUAL(pd2, "foo/bar bar/baz");
- erepository::DepSpecPrettyPrinter pr2(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::SpecTreePrettyPrinter pr2(ff, { });
TEST_CHECK(bool(id2->run_dependencies_key()));
id2->run_dependencies_key()->value()->top()->accept(pr2);
TEST_CHECK_STRINGIFY_EQUAL(pr2, "foo/bar");
diff --git a/paludis/repositories/e/e_repository_TEST_0.cc b/paludis/repositories/e/e_repository_TEST_0.cc
index 106d475..bb18821 100644
--- a/paludis/repositories/e/e_repository_TEST_0.cc
+++ b/paludis/repositories/e/e_repository_TEST_0.cc
@@ -22,7 +22,6 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -36,7 +35,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/repositories/e/e_repository_TEST_1.cc b/paludis/repositories/e/e_repository_TEST_1.cc
index d30c80b..c786c20 100644
--- a/paludis/repositories/e/e_repository_TEST_1.cc
+++ b/paludis/repositories/e/e_repository_TEST_1.cc
@@ -22,7 +22,6 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -36,7 +35,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/repositories/e/e_repository_TEST_2.cc b/paludis/repositories/e/e_repository_TEST_2.cc
index 88d5201..768ff80 100644
--- a/paludis/repositories/e/e_repository_TEST_2.cc
+++ b/paludis/repositories/e/e_repository_TEST_2.cc
@@ -22,7 +22,6 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -36,7 +35,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/repositories/e/e_repository_TEST_3.cc b/paludis/repositories/e/e_repository_TEST_3.cc
index 6a2fb3d..4694256 100644
--- a/paludis/repositories/e/e_repository_TEST_3.cc
+++ b/paludis/repositories/e/e_repository_TEST_3.cc
@@ -22,7 +22,6 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -36,7 +35,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/repositories/e/e_repository_TEST_4.cc b/paludis/repositories/e/e_repository_TEST_4.cc
index ea672a4..b720681 100644
--- a/paludis/repositories/e/e_repository_TEST_4.cc
+++ b/paludis/repositories/e/e_repository_TEST_4.cc
@@ -22,7 +22,7 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -36,7 +36,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc b/paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc
index 1ca688e..b07f79e 100644
--- a/paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc
+++ b/paludis/repositories/e/e_repository_TEST_dependencies_rewriter.cc
@@ -22,7 +22,7 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -36,7 +36,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
@@ -44,6 +43,7 @@
#include <paludis/selection.hh>
#include <paludis/repository_factory.hh>
#include <paludis/choice.hh>
+#include <paludis/unformatted_pretty_printer.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <functional>
@@ -108,19 +108,19 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("category/package",
&env, { })), { }))]->last());
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
- erepository::DepSpecPrettyPrinter pd(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::SpecTreePrettyPrinter pd(ff, { });
TEST_CHECK(bool(id->build_dependencies_key()));
id->build_dependencies_key()->value()->top()->accept(pd);
TEST_CHECK_STRINGIFY_EQUAL(pd, "( cat/pkg1 build: cat/pkg2 build+run: cat/pkg3 suggestion: post: )");
- erepository::DepSpecPrettyPrinter pr(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::SpecTreePrettyPrinter pr(ff, { });
TEST_CHECK(bool(id->run_dependencies_key()));
id->run_dependencies_key()->value()->top()->accept(pr);
TEST_CHECK_STRINGIFY_EQUAL(pr, "( cat/pkg1 build: build+run: cat/pkg3 suggestion: post: )");
- erepository::DepSpecPrettyPrinter pp(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::SpecTreePrettyPrinter pp(ff, { });
TEST_CHECK(bool(id->post_dependencies_key()));
id->post_dependencies_key()->value()->top()->accept(pp);
TEST_CHECK_STRINGIFY_EQUAL(pp, "( build: build+run: suggestion: cat/pkg4 post: cat/pkg5 )");
diff --git a/paludis/repositories/e/e_repository_TEST_ever.cc b/paludis/repositories/e/e_repository_TEST_ever.cc
index ed65748..1d0f418 100644
--- a/paludis/repositories/e/e_repository_TEST_ever.cc
+++ b/paludis/repositories/e/e_repository_TEST_ever.cc
@@ -22,7 +22,6 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -36,7 +35,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/repositories/e/e_repository_TEST_exheres_0.cc b/paludis/repositories/e/e_repository_TEST_exheres_0.cc
index 449e318..8025b46 100644
--- a/paludis/repositories/e/e_repository_TEST_exheres_0.cc
+++ b/paludis/repositories/e/e_repository_TEST_exheres_0.cc
@@ -22,7 +22,6 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -36,7 +35,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/repositories/e/e_repository_TEST_exlibs.cc b/paludis/repositories/e/e_repository_TEST_exlibs.cc
index dc889d0..10ad171 100644
--- a/paludis/repositories/e/e_repository_TEST_exlibs.cc
+++ b/paludis/repositories/e/e_repository_TEST_exlibs.cc
@@ -23,7 +23,6 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -35,7 +34,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/repositories/e/e_repository_TEST_pbin.cc b/paludis/repositories/e/e_repository_TEST_pbin.cc
index 2831bc5..a940010 100644
--- a/paludis/repositories/e/e_repository_TEST_pbin.cc
+++ b/paludis/repositories/e/e_repository_TEST_pbin.cc
@@ -22,7 +22,6 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -37,7 +36,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/repositories/e/e_repository_TEST_phases.cc b/paludis/repositories/e/e_repository_TEST_phases.cc
index 7e36036..ef73cbc 100644
--- a/paludis/repositories/e/e_repository_TEST_phases.cc
+++ b/paludis/repositories/e/e_repository_TEST_phases.cc
@@ -22,7 +22,6 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -36,7 +35,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc b/paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc
index a69984c..afec5f7 100644
--- a/paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc
+++ b/paludis/repositories/e/e_repository_TEST_symlink_rewriting.cc
@@ -22,7 +22,6 @@
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -36,7 +35,6 @@
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
diff --git a/paludis/repositories/e/e_repository_sets_TEST.cc b/paludis/repositories/e/e_repository_sets_TEST.cc
index 31f3e66..e126833 100644
--- a/paludis/repositories/e/e_repository_sets_TEST.cc
+++ b/paludis/repositories/e/e_repository_sets_TEST.cc
@@ -18,7 +18,7 @@
*/
#include <paludis/repositories/e/e_repository.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/environments/test/test_environment.hh>
@@ -26,7 +26,7 @@
#include <paludis/util/map.hh>
#include <paludis/util/set.hh>
#include <paludis/util/make_named_values.hh>
-#include <paludis/stringify_formatter.hh>
+#include <paludis/unformatted_pretty_printer.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include "config.h"
@@ -103,8 +103,8 @@ namespace test_cases
std::shared_ptr<const SetSpecTree> set1(env.set(SetName("set1::test-repo-1")));
TEST_CHECK(bool(set1));
- StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter pretty(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ UnformattedPrettyPrinter ff;
+ erepository::SpecTreePrettyPrinter pretty(ff, { });
set1->top()->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "cat-one/foo >=cat-two/bar-2");
}
@@ -133,8 +133,8 @@ namespace test_cases
env.package_database()->add_repository(1, repo);
std::shared_ptr<const SetSpecTree> insecurity(env.set(SetName("insecurity::test-repo-1")));
- StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter pretty(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ UnformattedPrettyPrinter ff;
+ erepository::SpecTreePrettyPrinter pretty(ff, { });
insecurity->top()->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "=cat-four/xyzzy-2.0.1::test-repo-1 =cat-four/xyzzy-2.0.2::test-repo-1 =cat-one/foo-1::test-repo-1 =cat-two/bar-1.5::test-repo-1 "
"=cat-two/bar-1.5.1::test-repo-1 =cat-three/baz-1.0::test-repo-1 "
@@ -177,8 +177,8 @@ namespace test_cases
env.package_database()->add_repository(0, installed);
std::shared_ptr<const SetSpecTree> security(env.set(SetName("security::test-repo-1")));
- StringifyFormatter ff;
- erepository::DepSpecPrettyPrinter pretty(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ UnformattedPrettyPrinter ff;
+ erepository::SpecTreePrettyPrinter pretty(ff, { });
security->top()->accept(pretty);
TEST_CHECK_STRINGIFY_EQUAL(pretty, "=cat-four/xyzzy-2.0.3::test-repo-1 =cat-two/bar-2.0::test-repo-1 =cat-three/baz-1.3::test-repo-1");
}
diff --git a/paludis/repositories/e/ebuild_flat_metadata_cache.cc b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
index 30d9c8f..ab502a5 100644
--- a/paludis/repositories/e/ebuild_flat_metadata_cache.cc
+++ b/paludis/repositories/e/ebuild_flat_metadata_cache.cc
@@ -30,14 +30,14 @@
#include <paludis/util/timestamp.hh>
#include <paludis/util/fs_stat.hh>
#include <paludis/util/fs_error.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/dependencies_rewriter.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/environment.hh>
#include <paludis/package_database.hh>
+#include <paludis/unformatted_pretty_printer.hh>
#include <set>
#include <map>
#include <list>
@@ -676,8 +676,8 @@ namespace
template <typename T_>
std::string flatten(const T_ & d)
{
- StringifyFormatter ff;
- DepSpecPrettyPrinter p(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ UnformattedPrettyPrinter f;
+ SpecTreePrettyPrinter p(f, { });
d->top()->accept(p);
return stringify(p);
}
diff --git a/paludis/repositories/e/fix_locked_dependencies_TEST.cc b/paludis/repositories/e/fix_locked_dependencies_TEST.cc
index 74f3710..ca6ffb9 100644
--- a/paludis/repositories/e/fix_locked_dependencies_TEST.cc
+++ b/paludis/repositories/e/fix_locked_dependencies_TEST.cc
@@ -20,14 +20,14 @@
#include <paludis/repositories/e/fix_locked_dependencies.hh>
#include <paludis/repositories/e/dep_parser.hh>
#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/repositories/fake/fake_package_id.hh>
#include <paludis/repositories/fake/fake_repository.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/make_named_values.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/package_database.hh>
+#include <paludis/unformatted_pretty_printer.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -67,10 +67,10 @@ namespace test_cases
"|| ( foo/bar ( bar/baz oink/squeak ) ) blah/blah", &env, id, *eapi)),
aa(fix_locked_dependencies(&env, *eapi, id, bb));
- StringifyFormatter ff;
- DepSpecPrettyPrinter
- a(0, std::shared_ptr<const PackageID>(), ff, 0, false, false),
- b(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ UnformattedPrettyPrinter ff;
+ SpecTreePrettyPrinter
+ a(ff, { }),
+ b(ff, { });
aa->top()->accept(a);
bb->top()->accept(b);
@@ -80,9 +80,9 @@ namespace test_cases
"foo/bar:= cat/installed:= >=cat/installed-1.2:= <=cat/installed-1.2:=", &env, id, *eapi)),
dd(fix_locked_dependencies(&env, *eapi, id, cc));
- DepSpecPrettyPrinter
- c(0, std::shared_ptr<const PackageID>(), ff, 0, false, false),
- d(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ SpecTreePrettyPrinter
+ c(ff, { }),
+ d(ff, { });
cc->top()->accept(c);
dd->top()->accept(d);
diff --git a/paludis/repositories/e/info_metadata_key.cc b/paludis/repositories/e/info_metadata_key.cc
index 1174449..a14cfbd 100644
--- a/paludis/repositories/e/info_metadata_key.cc
+++ b/paludis/repositories/e/info_metadata_key.cc
@@ -41,7 +41,6 @@
#include <paludis/dep_spec.hh>
#include <paludis/environment.hh>
#include <paludis/package_id.hh>
-#include <paludis/formatter.hh>
#include <paludis/pretty_printer.hh>
#include <paludis/call_pretty_printer.hh>
@@ -211,21 +210,6 @@ InfoPkgsMetadataKey::need_keys_added() const
}
}
-namespace
-{
- std::string format_string(const std::string & i, const Formatter<std::string> & f)
- {
- return f.format(i, format::Plain());
- }
-}
-
-std::string
-InfoVarsMetadataKey::pretty_print_flat(const Formatter<std::string> & f) const
-{
- using namespace std::placeholders;
- return join(value()->begin(), value()->end(), " ", std::bind(&format_string, _1, f));
-}
-
const std::string
InfoVarsMetadataKey::pretty_print_value(
const PrettyPrinter & pretty_printer,
diff --git a/paludis/repositories/e/info_metadata_key.hh b/paludis/repositories/e/info_metadata_key.hh
index ea3dc9f..01e04e7 100644
--- a/paludis/repositories/e/info_metadata_key.hh
+++ b/paludis/repositories/e/info_metadata_key.hh
@@ -45,8 +45,6 @@ namespace paludis
const std::shared_ptr<const Set<std::string> > value() const;
- std::string pretty_print_flat(const Formatter<std::string> &) const;
-
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));
diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc
index d7e048f..0e839eb 100644
--- a/paludis/repositories/e/pipe_command_handler.cc
+++ b/paludis/repositories/e/pipe_command_handler.cc
@@ -22,7 +22,7 @@
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/fix_locked_dependencies.hh>
#include <paludis/repositories/e/dep_parser.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/util/log.hh>
#include <paludis/util/join.hh>
#include <paludis/util/exception.hh>
@@ -41,13 +41,13 @@
#include <paludis/environment.hh>
#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/selection.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/choice.hh>
#include <paludis/dep_spec_annotations.hh>
+#include <paludis/unformatted_pretty_printer.hh>
#include <vector>
#include <limits>
#include <sstream>
@@ -64,7 +64,7 @@ namespace
struct MyOptionsRewriter
{
- StringifyFormatter f;
+ UnformattedPrettyPrinter f;
std::stringstream str;
std::string prefix;
@@ -95,7 +95,7 @@ namespace
void visit(const PlainTextSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
Save<std::string> save_prefix(&prefix);
- str << f.format(*node.spec(), format::Plain()) << " ( ";
+ str << f.prettify(*node.spec()) << " ( ";
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
str << " ) ";
do_annotations(*node.spec(), "");
@@ -103,14 +103,14 @@ namespace
void visit(const PlainTextSpecTree::NodeType<PlainTextDepSpec>::Type & node)
{
- str << f.format(*node.spec(), format::Plain()) << " ";
+ str << f.prettify(*node.spec()) << " ";
do_annotations(*node.spec(), (prefix.empty() ? "" : prefix + joiner) + stringify(*node.spec()));
}
void visit(const PlainTextSpecTree::NodeType<PlainTextLabelDepSpec>::Type & node)
{
prefix = node.spec()->label();
- str << f.format(*node.spec(), format::Plain()) << " ";
+ str << f.prettify(*node.spec()) << " ";
do_annotations(*node.spec(), "");
}
@@ -470,8 +470,8 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
std::shared_ptr<const DependencySpecTree> before(mm->value());
std::shared_ptr<const DependencySpecTree> after(fix_locked_dependencies(
environment, *eapi, package_id, before));
- StringifyFormatter ff;
- DepSpecPrettyPrinter p(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ UnformattedPrettyPrinter ff;
+ SpecTreePrettyPrinter p(ff, { });
after->top()->accept(p);
return "O0;" + stringify(p);
}
@@ -488,7 +488,6 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
if (! mm)
throw InternalError(PALUDIS_HERE, "oops. key '" + var + "' isn't a PlainTextSpecTree key");
- StringifyFormatter ff;
MyOptionsRewriter p(package_id,
eapi->supported()->annotations()->general_description(),
std::string(1, eapi->supported()->choices_options()->use_expand_separator()));
diff --git a/paludis/repositories/e/required_use_verifier.cc b/paludis/repositories/e/required_use_verifier.cc
index e46d262..962034f 100644
--- a/paludis/repositories/e/required_use_verifier.cc
+++ b/paludis/repositories/e/required_use_verifier.cc
@@ -26,7 +26,6 @@
#include <paludis/action.hh>
#include <paludis/metadata_key.hh>
#include <paludis/choice.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/unformatted_pretty_printer.hh>
#include <list>
#include <algorithm>
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index c6c7b28..8120531 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -24,7 +24,6 @@
#include <paludis/repositories/e/eapi_phase.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/dep_parser.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/e/e_repository_params.hh>
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/e/extra_distribution_data.hh>
@@ -49,7 +48,6 @@
#include <paludis/set_file.hh>
#include <paludis/version_operator.hh>
#include <paludis/version_requirements.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/selection.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
@@ -57,6 +55,7 @@
#include <paludis/output_manager.hh>
#include <paludis/partially_made_package_dep_spec.hh>
#include <paludis/dep_spec_annotations.hh>
+#include <paludis/unformatted_pretty_printer.hh>
#include <paludis/util/accept_visitor.hh>
#include <paludis/util/fast_unique_copy.hh>
@@ -1196,7 +1195,7 @@ namespace
bool changed;
std::stringstream str;
- StringifyFormatter f;
+ UnformattedPrettyPrinter f;
DepRewriter(const DepRewrites & w) :
rewrites(w),
@@ -1236,13 +1235,13 @@ namespace
{
/* don't rewrite blocks. some people block the old package after
* doing a move. */
- str << f.format(*node.spec(), format::Plain()) << " ";
+ str << f.prettify(*node.spec()) << " ";
do_annotations(*node.spec());
}
void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node)
{
- str << f.format(*node.spec(), format::Plain()) << " ";
+ str << f.prettify(*node.spec()) << " ";
do_annotations(*node.spec());
}
@@ -1251,19 +1250,18 @@ namespace
if (node.spec()->package_ptr() && rewrites.end() != rewrites.find(*node.spec()->package_ptr()))
{
changed = true;
- str << f.format(PartiallyMadePackageDepSpec(*node.spec())
- .package(rewrites.find(*node.spec()->package_ptr())->second),
- format::Plain()) << " ";
+ str << f.prettify(PartiallyMadePackageDepSpec(*node.spec())
+ .package(rewrites.find(*node.spec()->package_ptr())->second)) << " ";
}
else
- str << f.format(*node.spec(), format::Plain()) << " ";
+ str << f.prettify(*node.spec()) << " ";
do_annotations(*node.spec());
}
void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
- str << f.format(*node.spec(), format::Plain()) << " ( ";
+ str << f.prettify(*node.spec()) << " ( ";
std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
str << " ) ";
do_annotations(*node.spec());
@@ -1271,7 +1269,7 @@ namespace
void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node)
{
- str << f.format(*node.spec(), format::Plain()) << " ";
+ str << f.prettify(*node.spec()) << " ";
do_annotations(*node.spec());
}
};
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index f6f616f..a0205b5 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -18,8 +18,8 @@
*/
#include <paludis/repositories/e/vdb_repository.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/e/e_repository.hh>
+#include <paludis/repositories/e/spec_tree_pretty_printer.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
@@ -37,9 +37,9 @@
#include <paludis/selection.hh>
#include <paludis/dep_spec.hh>
#include <paludis/user_dep_spec.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/action.hh>
#include <paludis/choice.hh>
+#include <paludis/unformatted_pretty_printer.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_null_shared_ptr.hh>
@@ -280,19 +280,19 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("category/package",
&env, { })), { }))]->begin());
- StringifyFormatter ff;
+ UnformattedPrettyPrinter ff;
- erepository::DepSpecPrettyPrinter pd(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::SpecTreePrettyPrinter pd(ff, { });
TEST_CHECK(bool(id->build_dependencies_key()));
id->build_dependencies_key()->value()->top()->accept(pd);
TEST_CHECK_STRINGIFY_EQUAL(pd, "( cat/pkg1 build: cat/pkg2 build+run: cat/pkg3 suggestion: post: )");
- erepository::DepSpecPrettyPrinter pr(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::SpecTreePrettyPrinter pr(ff, { });
TEST_CHECK(bool(id->run_dependencies_key()));
id->run_dependencies_key()->value()->top()->accept(pr);
TEST_CHECK_STRINGIFY_EQUAL(pr, "( cat/pkg1 build: build+run: cat/pkg3 suggestion: post: )");
- erepository::DepSpecPrettyPrinter pp(0, std::shared_ptr<const PackageID>(), ff, 0, false, false);
+ erepository::SpecTreePrettyPrinter pp(ff, { });
TEST_CHECK(bool(id->post_dependencies_key()));
id->post_dependencies_key()->value()->top()->accept(pp);
TEST_CHECK_STRINGIFY_EQUAL(pp, "( build: build+run: suggestion: cat/pkg4 post: cat/pkg5 )");
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index 7338d2b..eb6258c 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -24,7 +24,6 @@
#include <paludis/action.hh>
#include <paludis/environment.hh>
#include <paludis/version_spec.hh>
-#include <paludis/formatter.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/dep_spec.hh>
#include <paludis/choice.hh>
@@ -270,20 +269,6 @@ FakeMetadataSpecTreeKey<C_>::type() const
}
template <typename C_>
-std::string
-FakeMetadataSpecTreeKey<C_>::pretty_print(const typename C_::ItemFormatter &) const
-{
- return _imp->string_value;
-}
-
-template <typename C_>
-std::string
-FakeMetadataSpecTreeKey<C_>::pretty_print_flat(const typename C_::ItemFormatter &) const
-{
- return _imp->string_value;
-}
-
-template <typename C_>
const std::string
FakeMetadataSpecTreeKey<C_>::pretty_print_value(
const PrettyPrinter &, const PrettyPrintOptions &) const
@@ -340,18 +325,6 @@ FakeMetadataSpecTreeKey<FetchableURISpecTree>::pretty_print_value(const PrettyPr
return _imp->string_value;
}
-std::string
-FakeMetadataSpecTreeKey<FetchableURISpecTree>::pretty_print(const FetchableURISpecTree::ItemFormatter &) const
-{
- return _imp->string_value;
-}
-
-std::string
-FakeMetadataSpecTreeKey<FetchableURISpecTree>::pretty_print_flat(const FetchableURISpecTree::ItemFormatter &) const
-{
- return _imp->string_value;
-}
-
const std::shared_ptr<const URILabel>
FakeMetadataSpecTreeKey<FetchableURISpecTree>::initial_label() const
{
@@ -390,18 +363,6 @@ FakeMetadataSpecTreeKey<DependencySpecTree>::pretty_print_value(const PrettyPrin
return _imp->string_value;
}
-std::string
-FakeMetadataSpecTreeKey<DependencySpecTree>::pretty_print(const DependencySpecTree::ItemFormatter &) const
-{
- return _imp->string_value;
-}
-
-std::string
-FakeMetadataSpecTreeKey<DependencySpecTree>::pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
-{
- return _imp->string_value;
-}
-
const std::shared_ptr<const DependenciesLabelSequence>
FakeMetadataSpecTreeKey<DependencySpecTree>::initial_labels() const
{
@@ -1281,27 +1242,6 @@ FakeMetadataKeywordSetKey::pretty_print_value(
return join(value()->begin(), value()->end(), " ", CallPrettyPrinter(pretty_printer));
}
-std::string
-FakeMetadataKeywordSetKey::pretty_print_flat(const Formatter<KeywordName> & f) const
-{
- std::string result;
- for (KeywordNameSet::ConstIterator i(value()->begin()), i_end(value()->end()) ;
- i != i_end ; ++i)
- {
- if (! result.empty())
- result.append(" ");
-
- std::shared_ptr<KeywordNameSet> k(std::make_shared<KeywordNameSet>());
- k->insert(*i);
- if (_imp->env->accept_keywords(k, _imp->id))
- result.append(f.format(*i, format::Accepted()));
- else
- result.append(f.format(*i, format::Unaccepted()));
- }
-
- return result;
-}
-
const std::shared_ptr<const MetadataValueKey<std::shared_ptr<const Choices> > >
FakePackageID::choices_key() const
{
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index fe27a43..cb4f548 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -64,9 +64,6 @@ namespace paludis
void set_from_string(const std::string &);
- 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));
@@ -90,12 +87,6 @@ namespace paludis
void set_from_string(const std::string &);
- virtual std::string pretty_print(const typename C_::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const typename C_::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
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));
@@ -124,12 +115,6 @@ namespace paludis
void set_from_string(const std::string &);
- virtual std::string pretty_print(const FetchableURISpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const FetchableURISpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual const std::shared_ptr<const URILabel> initial_label() const
PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -162,12 +147,6 @@ namespace paludis
void set_from_string(const std::string &);
- virtual std::string pretty_print(const DependencySpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc b/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc
index 76cb717..d3c1625 100644
--- a/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc
+++ b/paludis/repositories/gemcutter/gemcutter_dependencies_key.cc
@@ -54,93 +54,6 @@ GemcutterDependenciesError::GemcutterDependenciesError(const std::string & s) th
namespace
{
- struct Printer
- {
- std::stringstream s;
- const Environment * const env;
- DependencySpecTree::ItemFormatter formatter;
- const unsigned indent;
- const bool flat;
- bool need_space;
-
- Printer(
- const Environment * const e,
- const DependencySpecTree::ItemFormatter & f,
- const bool b) :
- env(e),
- formatter(f),
- indent(0),
- flat(b),
- need_space(false)
- {
- }
-
- void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node)
- {
- if (! flat)
- s << formatter.indent(indent + 1);
- else if (need_space)
- s << " ";
- else
- need_space = true;
-
- if (env)
- {
- if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
- filter::InstalledAtRoot(env->preferred_root_key()->value()))]->empty())
- s << formatter.format(*node.spec(), format::Installed());
- else if (! (*env)[selection::SomeArbitraryVersion(generator::Matches(*node.spec(), { }) |
- filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty())
- s << formatter.format(*node.spec(), format::Installable());
- else
- s << formatter.format(*node.spec(), format::Plain());
- }
- else
- s << formatter.format(*node.spec(), format::Plain());
-
- if (! flat)
- s << formatter.newline();
- }
-
- void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &)
- {
- }
-
- void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node)
- {
- if (! flat)
- s << formatter.indent(indent);
- else if (need_space)
- s << " ";
- else
- need_space = true;
-
- s << formatter.format(*node.spec(), format::Plain());
-
- if (! flat)
- s << formatter.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 ValuePrinter
{
std::stringstream s;
@@ -362,22 +275,6 @@ GemcutterDependenciesKey::initial_labels() const
return GemcutterDependenciesKeyData::get_instance()->initial_labels;
}
-std::string
-GemcutterDependenciesKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
-{
- Printer p{_imp->env, f, false};
- _imp->value->top()->accept(p);
- return p.s.str();
-}
-
-std::string
-GemcutterDependenciesKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const
-{
- Printer p{_imp->env, f, true};
- _imp->value->top()->accept(p);
- return p.s.str();
-}
-
const std::string
GemcutterDependenciesKey::pretty_print_value(
const PrettyPrinter & printer,
diff --git a/paludis/repositories/gemcutter/gemcutter_dependencies_key.hh b/paludis/repositories/gemcutter/gemcutter_dependencies_key.hh
index 09f9d7e..3b221a7 100644
--- a/paludis/repositories/gemcutter/gemcutter_dependencies_key.hh
+++ b/paludis/repositories/gemcutter/gemcutter_dependencies_key.hh
@@ -62,12 +62,6 @@ namespace paludis
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 DependencySpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() 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 27ecfe4..b8f5c1f 100644
--- a/paludis/repositories/gemcutter/gemcutter_uri_key.cc
+++ b/paludis/repositories/gemcutter/gemcutter_uri_key.cc
@@ -39,48 +39,6 @@ namespace
return result;
}
- struct Printer
- {
- const bool flat;
- const SimpleURISpecTree::ItemFormatter & formatter;
- int indent;
- bool need_space;
- std::stringstream s;
-
- Printer(const bool f, const SimpleURISpecTree::ItemFormatter & i) :
- flat(f),
- formatter(i),
- indent(0),
- need_space(false)
- {
- }
-
- void visit(const SimpleURISpecTree::NodeType<SimpleURIDepSpec>::Type & node)
- {
- if (! flat)
- s << formatter.indent(indent);
- else if (need_space)
- s << " ";
- else
- need_space = true;
-
- s << formatter.format(*node.spec(), format::Plain());
-
- if (! flat)
- s << formatter.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));
- }
- };
-
struct ValuePrinter
{
std::stringstream s;
@@ -197,21 +155,5 @@ GemcutterURIKey::pretty_print_value(
return p.s.str();
}
-std::string
-GemcutterURIKey::pretty_print(const SimpleURISpecTree::ItemFormatter & f) const
-{
- Printer p{false, f};
- _imp->value->top()->accept(p);
- return p.s.str();
-}
-
-std::string
-GemcutterURIKey::pretty_print_flat(const SimpleURISpecTree::ItemFormatter & f) const
-{
- Printer p{true, f};
- _imp->value->top()->accept(p);
- return p.s.str();
-}
-
template class Pimp<GemcutterURIKey>;
diff --git a/paludis/repositories/gemcutter/gemcutter_uri_key.hh b/paludis/repositories/gemcutter/gemcutter_uri_key.hh
index 6aa0e6d..19813ff 100644
--- a/paludis/repositories/gemcutter/gemcutter_uri_key.hh
+++ b/paludis/repositories/gemcutter/gemcutter_uri_key.hh
@@ -51,20 +51,6 @@ namespace paludis
virtual const std::string human_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual MetadataKeyType type() const PALUDIS_ATTRIBUTE((warn_unused_result));
- /**
- * Return a multiline-line indented and formatted version of our
- * value, using the supplied Formatter to format individual items.
- */
- virtual std::string pretty_print(const SimpleURISpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- /**
- * Return a single-line formatted version of our value, using the
- * supplied Formatter to format individual items.
- */
- 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 bc2df96..ac8d00e 100644
--- a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.cc
@@ -25,7 +25,6 @@
#include <paludis/util/singleton-impl.hh>
#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>
@@ -118,22 +117,6 @@ UnavailableRepositoryDependenciesKey::pretty_print_value(
return p.result();
}
-std::string
-UnavailableRepositoryDependenciesKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
-{
- CommaSeparatedDepPrinter p(_imp->env, f, false);
- _imp->value->top()->accept(p);
- return p.result();
-}
-
-std::string
-UnavailableRepositoryDependenciesKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const
-{
- CommaSeparatedDepPrinter p(_imp->env, f, true);
- _imp->value->top()->accept(p);
- return p.result();
-}
-
const std::shared_ptr<const DependenciesLabelSequence>
UnavailableRepositoryDependenciesKey::initial_labels() const
{
diff --git a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh
index e7de985..38e65aa 100644
--- a/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh
+++ b/paludis/repositories/unavailable/unavailable_repository_dependencies_key.hh
@@ -40,10 +40,6 @@ namespace paludis
const std::shared_ptr<const DependencySpecTree> value() const;
- std::string pretty_print(const DependencySpecTree::ItemFormatter & f) const;
-
- std::string pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const;
-
virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 7e9a20e..4fa31a4 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -46,9 +46,7 @@
#include <paludis/action.hh>
#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>
@@ -81,11 +79,6 @@ namespace
}
};
- std::string format_string(const std::string & i, const Formatter<std::string> & f)
- {
- return f.format(i, format::Plain());
- }
-
class InstalledUnpackagedFSPathKey :
public MetadataValueKey<FSPath>
{
@@ -292,12 +285,6 @@ namespace
return _v;
}
- std::string pretty_print_flat(const Formatter<std::string> & f) const
- {
- using namespace std::placeholders;
- return join(value()->begin(), value()->end(), " ", std::bind(&format_string, _1, f));
- }
-
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
{
return _raw_name;
@@ -362,22 +349,6 @@ namespace
return _v;
}
- std::string
- pretty_print(const DependencySpecTree::ItemFormatter & f) const
- {
- CommaSeparatedDepPrinter p(_env, f, false);
- value()->top()->accept(p);
- return p.result();
- }
-
- std::string
- pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const
- {
- CommaSeparatedDepPrinter p(_env, f, true);
- value()->top()->accept(p);
- return p.result();
- }
-
const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const
{
return _labels;
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index 5ca5b3d..1d864ea 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -36,7 +36,6 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/fs_iterator.hh>
#include <paludis/util/fs_stat.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/action.hh>
#include <paludis/environment.hh>
#include <paludis/dep_tag.hh>
diff --git a/paludis/repositories/unpackaged/unpackaged_key.cc b/paludis/repositories/unpackaged/unpackaged_key.cc
index cbd7fd7..d2aecb8 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.cc
+++ b/paludis/repositories/unpackaged/unpackaged_key.cc
@@ -25,7 +25,6 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/choice.hh>
#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>
@@ -105,22 +104,6 @@ UnpackagedDependencyKey::pretty_print_value(
return p.result();
}
-std::string
-UnpackagedDependencyKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
-{
- CommaSeparatedDepPrinter p(_imp->env, f, false);
- _imp->value->top()->accept(p);
- return p.result();
-}
-
-std::string
-UnpackagedDependencyKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const
-{
- CommaSeparatedDepPrinter p(_imp->env, f, true);
- _imp->value->top()->accept(p);
- return p.result();
-}
-
const std::shared_ptr<const DependenciesLabelSequence>
UnpackagedDependencyKey::initial_labels() const
{
diff --git a/paludis/repositories/unpackaged/unpackaged_key.hh b/paludis/repositories/unpackaged/unpackaged_key.hh
index c6053a0..39519b1 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.hh
+++ b/paludis/repositories/unpackaged/unpackaged_key.hh
@@ -42,10 +42,6 @@ namespace paludis
const std::shared_ptr<const DependencySpecTree> value() const;
- std::string pretty_print(const DependencySpecTree::ItemFormatter & f) const;
-
- std::string pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const;
-
virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/unwritten/unwritten_repository_file.cc b/paludis/repositories/unwritten/unwritten_repository_file.cc
index b9541e8..157bc9f 100644
--- a/paludis/repositories/unwritten/unwritten_repository_file.cc
+++ b/paludis/repositories/unwritten/unwritten_repository_file.cc
@@ -33,7 +33,6 @@
#include <paludis/literal_metadata_key.hh>
#include <paludis/metadata_key-fwd.hh>
#include <paludis/dep_spec.hh>
-#include <paludis/formatter.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/spec_tree.hh>
#include <paludis/pretty_printer.hh>
@@ -89,34 +88,6 @@ UnwrittenRepositoryFile::end() const
namespace
{
- struct UnwrittenHomepagePrinter
- {
- std::stringstream s;
- const SimpleURISpecTree::ItemFormatter & formatter;
-
- UnwrittenHomepagePrinter(const SimpleURISpecTree::ItemFormatter & f) :
- formatter(f)
- {
- }
-
- 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 << formatter.format(*node.spec(), format::Plain());
- }
- };
-
struct UnwrittenHomepagePrettyPrinter
{
std::stringstream s;
@@ -168,20 +139,6 @@ namespace
return vv;
}
- std::string pretty_print(const SimpleURISpecTree::ItemFormatter & f) const
- {
- UnwrittenHomepagePrinter p(f);
- value()->top()->accept(p);
- return p.s.str();
- }
-
- std::string pretty_print_flat(const SimpleURISpecTree::ItemFormatter & f) const
- {
- UnwrittenHomepagePrinter p(f);
- value()->top()->accept(p);
- return p.s.str();
- }
-
virtual const std::string raw_name() const PALUDIS_ATTRIBUTE((warn_unused_result))
{
return _raw_name;
diff --git a/paludis/repositories/virtuals/package_id.cc b/paludis/repositories/virtuals/package_id.cc
index 9028500..4f23004 100644
--- a/paludis/repositories/virtuals/package_id.cc
+++ b/paludis/repositories/virtuals/package_id.cc
@@ -34,7 +34,6 @@
#include <paludis/environment.hh>
#include <paludis/version_requirements.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/formatter.hh>
#include <paludis/action.hh>
#include <paludis/mask.hh>
#include <paludis/package_database.hh>
@@ -131,30 +130,6 @@ VirtualsDepKey::type() const
return mkt_dependencies;
}
-std::string
-VirtualsDepKey::pretty_print(const DependencySpecTree::ItemFormatter & f) const
-{
- if (_imp->env)
- {
- if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*_imp->spec, { }) |
- filter::InstalledAtRoot(_imp->env->preferred_root_key()->value()))]->empty())
- return f.format(*_imp->spec, format::Installed());
- else if (! (*_imp->env)[selection::SomeArbitraryVersion(generator::Matches(*_imp->spec, { }) |
- filter::SupportsAction<InstallAction>() | filter::NotMasked())]->empty())
- return f.format(*_imp->spec, format::Installable());
- else
- return f.format(*_imp->spec, format::Plain());
- }
- else
- return f.format(*_imp->spec, format::Plain());
-}
-
-std::string
-VirtualsDepKey::pretty_print_flat(const DependencySpecTree::ItemFormatter & f) const
-{
- return pretty_print(f);
-}
-
const std::string
VirtualsDepKey::pretty_print_value(
const PrettyPrinter & pretty_printer,
diff --git a/paludis/repositories/virtuals/package_id.hh b/paludis/repositories/virtuals/package_id.hh
index bd4e984..00152a1 100644
--- a/paludis/repositories/virtuals/package_id.hh
+++ b/paludis/repositories/virtuals/package_id.hh
@@ -45,12 +45,6 @@ namespace paludis
virtual const std::shared_ptr<const DependencySpecTree> value() const
PALUDIS_ATTRIBUTE((warn_unused_result));
- virtual std::string pretty_print(const DependencySpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- virtual std::string pretty_print_flat(const DependencySpecTree::ItemFormatter &) const
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
virtual const std::shared_ptr<const DependenciesLabelSequence> initial_labels() const
PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/spec_tree.hh b/paludis/spec_tree.hh
index 1a32b7e..424fc33 100644
--- a/paludis/spec_tree.hh
+++ b/paludis/spec_tree.hh
@@ -25,7 +25,6 @@
#include <paludis/util/select.hh>
#include <paludis/util/simple_visitor.hh>
#include <paludis/util/sequence.hh>
-#include <paludis/formatter.hh>
namespace paludis
{
@@ -174,31 +173,6 @@ namespace paludis
const std::shared_ptr<const typename InnerNodeType<RootNode_>::Type> top() const;
- typedef Formatter<
- typename Select<TypeListContains<VisitableTypeList, typename NodeType<PackageDepSpec>::Type>::value,
- PackageDepSpec, NoType<1u> >::Type,
- typename Select<TypeListContains<VisitableTypeList, typename NodeType<BlockDepSpec>::Type>::value,
- BlockDepSpec, NoType<2u> >::Type,
- typename Select<TypeListContains<VisitableTypeList, typename NodeType<FetchableURIDepSpec>::Type>::value,
- FetchableURIDepSpec, NoType<3u> >::Type,
- typename Select<TypeListContains<VisitableTypeList, typename NodeType<SimpleURIDepSpec>::Type>::value,
- SimpleURIDepSpec, NoType<4u> >::Type,
- typename Select<TypeListContains<VisitableTypeList, typename NodeType<DependenciesLabelsDepSpec>::Type>::value,
- DependenciesLabelsDepSpec, NoType<5u> >::Type,
- typename Select<TypeListContains<VisitableTypeList, typename NodeType<URILabelsDepSpec>::Type>::value,
- URILabelsDepSpec, NoType<6u> >::Type,
- typename Select<TypeListContains<VisitableTypeList, typename NodeType<PlainTextDepSpec>::Type>::value,
- PlainTextDepSpec, NoType<7u> >::Type,
- typename Select<TypeListContains<VisitableTypeList, typename NodeType<LicenseDepSpec>::Type>::value,
- LicenseDepSpec, NoType<8u> >::Type,
- typename Select<TypeListContains<VisitableTypeList, typename NodeType<ConditionalDepSpec>::Type>::value,
- ConditionalDepSpec, NoType<9u> >::Type,
- typename Select<TypeListContains<VisitableTypeList, typename NodeType<NamedSetDepSpec>::Type>::value,
- NamedSetDepSpec, NoType<10u> >::Type,
- typename Select<TypeListContains<VisitableTypeList, typename NodeType<PlainTextLabelDepSpec>::Type>::value,
- PlainTextLabelDepSpec, NoType<11u> >::Type
- > ItemFormatter;
-
private:
const std::shared_ptr<typename InnerNodeType<RootNode_>::Type> _top;
};
diff --git a/paludis/stringify_formatter-fwd.hh b/paludis/stringify_formatter-fwd.hh
deleted file mode 100644
index 9bd6eda..0000000
--- a/paludis/stringify_formatter-fwd.hh
+++ /dev/null
@@ -1,34 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 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_STRINGIFY_FORMATTER_FWD_HH
-#define PALUDIS_GUARD_PALUDIS_STRINGIFY_FORMATTER_FWD_HH 1
-
-/** \file
- * Forward declarations for paludis/stringify_formatter.hh .
- *
- * \ingroup g_formatters
- */
-
-namespace paludis
-{
- class StringifyFormatter;
-}
-
-#endif
diff --git a/paludis/stringify_formatter-impl.hh b/paludis/stringify_formatter-impl.hh
deleted file mode 100644
index 7983a35..0000000
--- a/paludis/stringify_formatter-impl.hh
+++ /dev/null
@@ -1,225 +0,0 @@
-/* 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_STRINGIFY_FORMATTER_IMPL_HH
-#define PALUDIS_GUARD_PALUDIS_STRINGIFY_FORMATTER_IMPL_HH 1
-
-#include <paludis/stringify_formatter.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <type_traits>
-
-/** \file
- * Imp for paludis/stringify_formatter.hh .
- *
- * \ingroup g_formatters
- */
-
-namespace paludis
-{
- /**
- * Imp data for StringifyFormatter.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- template <>
- struct Imp<StringifyFormatter>
- {
- const CanFormat<std::string> * const f_str;
- const CanFormat<std::pair<const std::string, std::string> > * const f_str_str;
- const CanFormat<ChoiceValue> * const f_conf;
- const CanFormat<KeywordName> * const f_keyword;
- const CanFormat<PackageDepSpec> * const f_package;
- const CanFormat<BlockDepSpec> * const f_block;
- const CanFormat<FetchableURIDepSpec> * const f_f_uri;
- const CanFormat<SimpleURIDepSpec> * const f_s_uri;
- const CanFormat<LicenseDepSpec> * const f_license;
- const CanFormat<DependenciesLabelsDepSpec> * const f_dep_label;
- const CanFormat<URILabelsDepSpec> * const f_uri_label;
- const CanFormat<PlainTextDepSpec> * const f_plain;
- const CanFormat<ConditionalDepSpec> * const f_use_dep;
- const CanFormat<NamedSetDepSpec> * const f_named;
- const CanFormat<FSPath> * const f_fspath;
- const CanFormat<PackageID> * const f_package_id;
- const CanFormat<PlainTextLabelDepSpec> * const f_plain_label;
- const CanSpace * const f_space;
-
- Imp(
- const CanFormat<std::string> * const f_str_v,
- const CanFormat<std::pair<const std::string, std::string> > * const f_str_str_v,
- const CanFormat<ChoiceValue> * const f_conf_v,
- const CanFormat<KeywordName> * const f_keyword_v,
- const CanFormat<PackageDepSpec> * const f_package_v,
- const CanFormat<BlockDepSpec> * const f_block_v,
- const CanFormat<FetchableURIDepSpec> * const f_f_uri_v,
- const CanFormat<SimpleURIDepSpec> * const f_s_uri_v,
- const CanFormat<LicenseDepSpec> * const f_license_v,
- const CanFormat<DependenciesLabelsDepSpec> * const f_dep_label_v,
- const CanFormat<URILabelsDepSpec> * const f_uri_label_v,
- const CanFormat<PlainTextDepSpec> * const f_plain_v,
- const CanFormat<ConditionalDepSpec> * const f_use_dep_v,
- const CanFormat<NamedSetDepSpec> * const f_named_v,
- const CanFormat<FSPath> * const f_fspath_v,
- const CanFormat<PackageID> * const f_package_id_v,
- const CanFormat<PlainTextLabelDepSpec> * const f_plain_label_v,
- const CanSpace * const f_space_v
- ) :
- f_str(f_str_v),
- f_str_str(f_str_str_v),
- f_conf(f_conf_v),
- f_keyword(f_keyword_v),
- f_package(f_package_v),
- f_block(f_block_v),
- f_f_uri(f_f_uri_v),
- f_s_uri(f_s_uri_v),
- f_license(f_license_v),
- f_dep_label(f_dep_label_v),
- f_uri_label(f_uri_label_v),
- f_plain(f_plain_v),
- f_use_dep(f_use_dep_v),
- f_named(f_named_v),
- f_fspath(f_fspath_v),
- f_package_id(f_package_id_v),
- f_plain_label(f_plain_label_v),
- f_space(f_space_v)
- {
- }
- };
-
- /**
- * Internal use by StringifyFormatter: get a CanFormat<> interface, or 0 if
- * not implemented.
- *
- * \ingroup g_formatters
- * \nosubgrouping
- * \since 0.26
- */
- template <bool b_, typename T_>
- struct StringifyFormatterGetForwarder
- {
- /**
- * Get a CanFormat<> interface, or 0 if not implemented.
- */
- static const CanFormat<T_> * get(const CanFormat<T_> * const t)
- {
- return t;
- }
- };
-
- /**
- * Internal use by StringifyFormatter: get a CanFormat<> interface, or 0 if
- * not implemented.
- *
- * \ingroup g_formatters
- * \nosubgrouping
- * \since 0.26
- */
- template <typename T_>
- struct StringifyFormatterGetForwarder<false, T_>
- {
- /**
- * Get a CanFormat<> interface, or 0 if not implemented.
- */
- static const CanFormat<T_> * get(const void * const)
- {
- return 0;
- }
- };
-
- /**
- * Internal use by StringifyFormatter: get a CanSpace<> interface, or 0 if
- * not implemented.
- *
- * \ingroup g_formatters
- * \nosubgrouping
- * \since 0.26
- */
- template <bool b_>
- struct StringifyFormatterGetSpaceForwarder
- {
- /**
- * Get a CanSpace interface, or 0 if not implemented.
- */
- static const CanSpace * get(const CanSpace * const t)
- {
- return t;
- }
- };
-
- /**
- * Internal use by StringifyFormatter: get a CanSpace<> interface, or 0 if
- * not implemented.
- *
- * \ingroup g_formatters
- * \nosubgrouping
- * \since 0.26
- */
- template <>
- struct StringifyFormatterGetSpaceForwarder<false>
- {
- /**
- * Get a CanSpace interface, or 0 if not implemented.
- */
- static const CanSpace * get(const void * const)
- {
- return 0;
- }
- };
-
- template <typename T_>
- StringifyFormatter::StringifyFormatter(const T_ & t) :
- Pimp<StringifyFormatter>(
- StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<std::string> *>::value, std::string>::get(&t),
- StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<std::pair<const std::string, std::string> > *>::value, std::pair<const std::string, std::string> >::get(&t),
- StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<ChoiceValue> *>::value, ChoiceValue>::get(&t),
- StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<KeywordName> *>::value, KeywordName>::get(&t),
- StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<PackageDepSpec> *>::value, PackageDepSpec>::get(&t),
- StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<BlockDepSpec> *>::value, BlockDepSpec>::get(&t),
- StringifyFormatterGetForwarder<
- std::is_convertible<T_ *, CanFormat<FetchableURIDepSpec> *>::value,
- FetchableURIDepSpec>::get(&t),
- StringifyFormatterGetForwarder<
- std::is_convertible<T_ *, CanFormat<SimpleURIDepSpec> *>::value,
- SimpleURIDepSpec>::get(&t),
- StringifyFormatterGetForwarder<
- std::is_convertible<T_ *, CanFormat<LicenseDepSpec> *>::value,
- LicenseDepSpec>::get(&t),
- StringifyFormatterGetForwarder<
- std::is_convertible<T_ *, CanFormat<DependenciesLabelsDepSpec> *>::value,
- DependenciesLabelsDepSpec>::get(&t),
- StringifyFormatterGetForwarder<
- std::is_convertible<T_ *, CanFormat<URILabelsDepSpec> *>::value,
- URILabelsDepSpec>::get(&t),
- StringifyFormatterGetForwarder<
- std::is_convertible<T_ *, CanFormat<PlainTextDepSpec> *>::value,
- PlainTextDepSpec>::get(&t),
- StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<ConditionalDepSpec> *>::value, ConditionalDepSpec>::get(&t),
- StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<NamedSetDepSpec> *>::value, NamedSetDepSpec>::get(&t),
- StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<FSPath> *>::value, FSPath>::get(&t),
- StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<PackageID> *>::value, PackageID>::get(&t),
- StringifyFormatterGetForwarder<std::is_convertible<T_ *, CanFormat<PlainTextLabelDepSpec> *>::value, PlainTextLabelDepSpec>::get(&t),
- StringifyFormatterGetSpaceForwarder<std::is_convertible<T_ *, CanSpace *>::value>::get(&t)
- ),
- CanSpace()
- {
- }
-}
-
-#endif
diff --git a/paludis/stringify_formatter.cc b/paludis/stringify_formatter.cc
deleted file mode 100644
index c24895f..0000000
--- a/paludis/stringify_formatter.cc
+++ /dev/null
@@ -1,373 +0,0 @@
-/* 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
- */
-
-#include <paludis/stringify_formatter.hh>
-#include <paludis/stringify_formatter-impl.hh>
-#include <paludis/util/stringify.hh>
-#include <paludis/util/pimp-impl.hh>
-#include <paludis/dep_spec.hh>
-#include <paludis/dep_label.hh>
-#include <paludis/choice.hh>
-
-using namespace paludis;
-
-StringifyFormatter::StringifyFormatter() :
- Pimp<StringifyFormatter>(
- static_cast<const CanFormat<std::string> *>(0),
- static_cast<const CanFormat<std::pair<const std::string, std::string> > *>(0),
- static_cast<const CanFormat<ChoiceValue> *>(0),
- static_cast<const CanFormat<KeywordName> *>(0),
- static_cast<const CanFormat<PackageDepSpec> *>(0),
- static_cast<const CanFormat<BlockDepSpec> *>(0),
- static_cast<const CanFormat<FetchableURIDepSpec> *>(0),
- static_cast<const CanFormat<SimpleURIDepSpec> *>(0),
- static_cast<const CanFormat<LicenseDepSpec> *>(0),
- static_cast<const CanFormat<DependenciesLabelsDepSpec> *>(0),
- static_cast<const CanFormat<URILabelsDepSpec> *>(0),
- static_cast<const CanFormat<PlainTextDepSpec> *>(0),
- static_cast<const CanFormat<ConditionalDepSpec> *>(0),
- static_cast<const CanFormat<NamedSetDepSpec> *>(0),
- static_cast<const CanFormat<FSPath> *>(0),
- static_cast<const CanFormat<PackageID> *>(0),
- static_cast<const CanFormat<PlainTextLabelDepSpec> *>(0),
- static_cast<const CanSpace *>(0)
- )
-{
-}
-
-StringifyFormatter::~StringifyFormatter()
-{
-}
-
-std::string
-StringifyFormatter::format(const std::string & s, const format::Plain & k) const
-{
- if (_imp->f_str)
- return _imp->f_str->format(s, k);
- return s;
-}
-
-std::string
-StringifyFormatter::format(const std::pair<const std::string, std::string> & s, const format::Plain & k) const
-{
- if (_imp->f_str)
- return _imp->f_str_str->format(s, k);
-
- if (s.first.empty())
- return s.second;
- else
- return s.first + "=" + s.second;
-}
-
-std::string
-StringifyFormatter::format(const KeywordName & s, const format::Accepted & k) const
-{
- if (_imp->f_keyword)
- return _imp->f_keyword->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const KeywordName & s, const format::Unaccepted & k) const
-{
- if (_imp->f_keyword)
- return _imp->f_keyword->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const KeywordName & s, const format::Plain & k) const
-{
- if (_imp->f_keyword)
- return _imp->f_keyword->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const PackageDepSpec & s, const format::Plain & k) const
-{
- if (_imp->f_package)
- return _imp->f_package->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const PackageDepSpec & s, const format::Installed & k) const
-{
- if (_imp->f_package)
- return _imp->f_package->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const PackageDepSpec & s, const format::Installable & k) const
-{
- if (_imp->f_package)
- return _imp->f_package->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const PackageID & s, const format::Plain & k) const
-{
- if (_imp->f_package_id)
- return _imp->f_package_id->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const PackageID & s, const format::Installed & k) const
-{
- if (_imp->f_package_id)
- return _imp->f_package_id->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const PackageID & s, const format::Installable & k) const
-{
- if (_imp->f_package_id)
- return _imp->f_package_id->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const BlockDepSpec & s, const format::Plain & k) const
-{
- if (_imp->f_block)
- return _imp->f_block->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const SimpleURIDepSpec & s, const format::Plain & k) const
-{
- if (_imp->f_s_uri)
- return _imp->f_s_uri->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const FetchableURIDepSpec & s, const format::Plain & k) const
-{
- if (_imp->f_f_uri)
- return _imp->f_f_uri->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const LicenseDepSpec & s, const format::Plain & k) const
-{
- if (_imp->f_license)
- return _imp->f_license->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const LicenseDepSpec & s, const format::Accepted & k) const
-{
- if (_imp->f_license)
- return _imp->f_license->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const LicenseDepSpec & s, const format::Unaccepted & k) const
-{
- if (_imp->f_license)
- return _imp->f_license->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const DependenciesLabelsDepSpec & s, const format::Plain & k) const
-{
- if (_imp->f_dep_label)
- return _imp->f_dep_label->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const URILabelsDepSpec & s, const format::Plain & k) const
-{
- if (_imp->f_uri_label)
- return _imp->f_uri_label->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const PlainTextLabelDepSpec & s, const format::Plain & k) const
-{
- if (_imp->f_plain_label)
- return _imp->f_plain_label->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const PlainTextDepSpec & s, const format::Plain & k) const
-{
- if (_imp->f_plain)
- return _imp->f_plain->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const ChoiceValue & s, const format::Enabled & k) const
-{
- if (_imp->f_conf)
- return _imp->f_conf->format(s, k);
- return stringify(s.name_with_prefix());
-}
-
-std::string
-StringifyFormatter::format(const ChoiceValue & s, const format::Disabled & k) const
-{
- if (_imp->f_conf)
- return _imp->f_conf->format(s, k);
- return stringify(s.name_with_prefix());
-}
-
-std::string
-StringifyFormatter::format(const ChoiceValue & s, const format::Forced & k) const
-{
- if (_imp->f_conf)
- return _imp->f_conf->format(s, k);
- return stringify(s.name_with_prefix());
-}
-
-std::string
-StringifyFormatter::format(const ChoiceValue & s, const format::Masked & k) const
-{
- if (_imp->f_conf)
- return _imp->f_conf->format(s, k);
- return stringify(s.name_with_prefix());
-}
-
-std::string
-StringifyFormatter::format(const ChoiceValue & s, const format::Plain & k) const
-{
- if (_imp->f_conf)
- return _imp->f_conf->format(s, k);
- return stringify(s.name_with_prefix());
-}
-
-std::string
-StringifyFormatter::decorate(const ChoiceValue & s, const std::string & t, const format::Changed & k) const
-{
- if (_imp->f_conf)
- return _imp->f_conf->decorate(s, t, k);
- return t;
-}
-
-std::string
-StringifyFormatter::decorate(const ChoiceValue & s, const std::string & t, const format::Added & k) const
-{
- if (_imp->f_conf)
- return _imp->f_conf->decorate(s, t, k);
- return t;
-}
-
-std::string
-StringifyFormatter::format(const ConditionalDepSpec & s, const format::Enabled & k) const
-{
- if (_imp->f_use_dep)
- return _imp->f_use_dep->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const ConditionalDepSpec & s, const format::Disabled & k) const
-{
- if (_imp->f_use_dep)
- return _imp->f_use_dep->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const ConditionalDepSpec & s, const format::Forced & k) const
-{
- if (_imp->f_use_dep)
- return _imp->f_use_dep->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const ConditionalDepSpec & s, const format::Masked & k) const
-{
- if (_imp->f_use_dep)
- return _imp->f_use_dep->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const ConditionalDepSpec & s, const format::Plain & k) const
-{
- if (_imp->f_use_dep)
- return _imp->f_use_dep->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::decorate(const ConditionalDepSpec & s, const std::string & t, const format::Changed & k) const
-{
- if (_imp->f_use_dep)
- return _imp->f_use_dep->decorate(s, t, k);
- return t;
-}
-
-std::string
-StringifyFormatter::decorate(const ConditionalDepSpec & s, const std::string & t, const format::Added & k) const
-{
- if (_imp->f_use_dep)
- return _imp->f_use_dep->decorate(s, t, k);
- return t;
-}
-
-std::string
-StringifyFormatter::format(const FSPath & s, const format::Plain & k) const
-{
- if (_imp->f_fspath)
- return _imp->f_fspath->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::format(const NamedSetDepSpec & s, const format::Plain & k) const
-{
- if (_imp->f_named)
- return _imp->f_named->format(s, k);
- return stringify(s);
-}
-
-std::string
-StringifyFormatter::newline() const
-{
- if (_imp->f_space)
- return _imp->f_space->newline();
- return "\n";
-}
-
-std::string
-StringifyFormatter::indent(const int i) const
-{
- if (_imp->f_space)
- return _imp->f_space->indent(i);
- return std::string(4 * i, ' ');
-}
-
diff --git a/paludis/stringify_formatter.hh b/paludis/stringify_formatter.hh
deleted file mode 100644
index c223516..0000000
--- a/paludis/stringify_formatter.hh
+++ /dev/null
@@ -1,159 +0,0 @@
-/* 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_STRINGIFY_FORMATTER_HH
-#define PALUDIS_GUARD_PALUDIS_STRINGIFY_FORMATTER_HH 1
-
-#include <paludis/stringify_formatter-fwd.hh>
-#include <paludis/formatter.hh>
-#include <paludis/name.hh>
-#include <paludis/dep_spec-fwd.hh>
-#include <paludis/util/pimp.hh>
-#include <paludis/util/fs_path-fwd.hh>
-
-/** \file
- * Declarations for the StringifyFormatter class.
- *
- * \ingroup g_formatters
- *
- * \section Examples
- *
- * - \ref example_stringify_formatter.cc "example_stringify_formatter.cc"
- * - \ref example_formatter.cc "example_formatter.cc"
- */
-
-namespace paludis
-{
- /**
- * A StringifyFormatter is a Formatter that implements every format function
- * by calling paludis::stringify().
- *
- * A StringifyFormatter can also act as a wrapper class around another
- * Formatter. Any CanFormat<> interface implemented by that other formatter
- * is used; any not implemented by the other formatter is implemented using
- * paludis::stringify().
- *
- * Indenting is done via simple spaces; newlines are done via a newline
- * character. Again, when used as a wrapper, this can be overridden by the
- * wrapped class.
- *
- * \ingroup g_formatters
- * \since 0.26
- * \nosubgrouping
- */
- class PALUDIS_VISIBLE StringifyFormatter :
- private Pimp<StringifyFormatter>,
- public CanFormat<std::string>,
- public CanFormat<std::pair<const std::string, std::string> >,
- public CanFormat<ChoiceValue>,
- public CanFormat<KeywordName>,
- public CanFormat<PackageDepSpec>,
- public CanFormat<BlockDepSpec>,
- public CanFormat<FetchableURIDepSpec>,
- public CanFormat<SimpleURIDepSpec>,
- public CanFormat<DependenciesLabelsDepSpec>,
- public CanFormat<URILabelsDepSpec>,
- public CanFormat<PlainTextDepSpec>,
- public CanFormat<LicenseDepSpec>,
- public CanFormat<ConditionalDepSpec>,
- public CanFormat<NamedSetDepSpec>,
- public CanFormat<FSPath>,
- public CanFormat<PackageID>,
- public CanFormat<PlainTextLabelDepSpec>,
- public CanSpace
- {
- private:
- StringifyFormatter(const StringifyFormatter &);
-
- public:
- ///\name Basic operations
- ///\{
-
- StringifyFormatter();
-
- /**
- * StringifyFormatter can be constructed as a wrapper around another
- * formatter.
- */
- template <typename T_> explicit StringifyFormatter(const T_ &);
-
- ~StringifyFormatter();
-
- ///\}
-
- virtual std::string format(const std::string &, const format::Plain &) const;
-
- virtual std::string format(const std::pair<const std::string, std::string> &, const format::Plain &) const;
-
- virtual std::string format(const ChoiceValue &, const format::Enabled &) const;
- virtual std::string format(const ChoiceValue &, const format::Disabled &) const;
- virtual std::string format(const ChoiceValue &, const format::Forced &) const;
- virtual std::string format(const ChoiceValue &, const format::Masked &) const;
- virtual std::string format(const ChoiceValue &, const format::Plain &) const;
- virtual std::string decorate(const ChoiceValue &, const std::string &, const format::Changed &) const;
- virtual std::string decorate(const ChoiceValue &, const std::string &, const format::Added &) const;
-
- virtual std::string format(const KeywordName &, const format::Accepted &) const;
- virtual std::string format(const KeywordName &, const format::Unaccepted &) const;
- virtual std::string format(const KeywordName &, const format::Plain &) const;
-
- virtual std::string format(const PackageDepSpec &, const format::Plain &) const;
- virtual std::string format(const PackageDepSpec &, const format::Installed &) const;
- virtual std::string format(const PackageDepSpec &, const format::Installable &) const;
-
- virtual std::string format(const BlockDepSpec &, const format::Plain &) const;
-
- virtual std::string format(const FetchableURIDepSpec &, const format::Plain &) const;
-
- virtual std::string format(const SimpleURIDepSpec &, const format::Plain &) const;
-
- virtual std::string format(const DependenciesLabelsDepSpec &, const format::Plain &) const;
-
- virtual std::string format(const NamedSetDepSpec &, const format::Plain &) const;
-
- virtual std::string format(const URILabelsDepSpec &, const format::Plain &) const;
-
- virtual std::string format(const PlainTextDepSpec &, const format::Plain &) const;
-
- virtual std::string format(const LicenseDepSpec &, const format::Plain &) const;
- virtual std::string format(const LicenseDepSpec &, const format::Accepted &) const;
- virtual std::string format(const LicenseDepSpec &, const format::Unaccepted &) const;
-
- virtual std::string format(const ConditionalDepSpec &, const format::Enabled &) const;
- virtual std::string format(const ConditionalDepSpec &, const format::Disabled &) const;
- virtual std::string format(const ConditionalDepSpec &, const format::Forced &) const;
- virtual std::string format(const ConditionalDepSpec &, const format::Masked &) const;
- virtual std::string format(const ConditionalDepSpec &, const format::Plain &) const;
- virtual std::string decorate(const ConditionalDepSpec &, const std::string &, const format::Changed &) const;
- virtual std::string decorate(const ConditionalDepSpec &, const std::string &, const format::Added &) const;
-
- virtual std::string format(const FSPath &, const format::Plain &) const;
-
- virtual std::string format(const PackageID &, const format::Plain &) const;
- virtual std::string format(const PackageID &, const format::Installed &) const;
- virtual std::string format(const PackageID &, const format::Installable &) const;
-
- virtual std::string format(const PlainTextLabelDepSpec &, const format::Plain &) const;
-
- virtual std::string newline() const;
- virtual std::string indent(const int) const;
- };
-}
-
-#endif
diff --git a/paludis/stringify_formatter_TEST.cc b/paludis/stringify_formatter_TEST.cc
deleted file mode 100644
index 5245f87..0000000
--- a/paludis/stringify_formatter_TEST.cc
+++ /dev/null
@@ -1,129 +0,0 @@
-/* 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
- */
-
-#include <paludis/stringify_formatter.hh>
-#include <paludis/stringify_formatter-impl.hh>
-#include <paludis/util/options.hh>
-#include <paludis/dep_spec.hh>
-#include <paludis/spec_tree.hh>
-#include <paludis/user_dep_spec.hh>
-#include <paludis/environments/test/test_environment.hh>
-#include <paludis/choice.hh>
-#include <test/test_runner.hh>
-#include <test/test_framework.hh>
-#include <paludis/util/clone-impl.hh>
-
-using namespace test;
-using namespace paludis;
-
-namespace
-{
- std::string format_two(const KeywordName & k, const LicenseDepSpec & n,
- const Formatter<KeywordName, LicenseDepSpec> & f)
- {
- return f.format(k, format::Accepted()) + " " + f.format(n, format::Accepted());
- }
-
- std::string format_three(const PackageDepSpec & k, const BlockDepSpec & d, const NamedSetDepSpec & u,
- const GenericSpecTree::ItemFormatter & f)
- {
- return f.format(k, format::Plain()) + " " + f.format(d, format::Plain()) + " " + f.format(u, format::Plain());
- }
-
- class PartialFormatter :
- public CanFormat<KeywordName>,
- public CanFormat<PackageDepSpec>
- {
- private:
- PartialFormatter(const PartialFormatter &);
-
- public:
- PartialFormatter()
- {
- }
-
- virtual std::string format(const KeywordName & s, const format::Accepted &) const
- {
- return "<" + stringify(s) + ">";
- }
-
- virtual std::string format(const KeywordName & s, const format::Unaccepted &) const
- {
- return "<" + stringify(s) + ">";
- }
-
- virtual std::string format(const KeywordName & s, const format::Plain &) const
- {
- return "<" + stringify(s) + ">";
- }
-
- virtual std::string format(const PackageDepSpec & s, const format::Plain &) const
- {
- return "<" + stringify(s) + ">";
- }
-
- virtual std::string format(const PackageDepSpec & s, const format::Installed &) const
- {
- return "<" + stringify(s) + ">";
- }
-
- virtual std::string format(const PackageDepSpec & s, const format::Installable &) const
- {
- return "<" + stringify(s) + ">";
- }
- };
-}
-
-namespace test_cases
-{
- struct StringifyFormatterTest : TestCase
- {
- StringifyFormatterTest() : TestCase("stringify formatter") { }
-
- void run()
- {
- StringifyFormatter ff;
- LicenseDepSpec l("two");
- std::string s(format_two(KeywordName("one"), l, ff));
- TEST_CHECK_EQUAL(s, "one two");
- }
- } test_stringify_formatter;
-
- struct StringifyFormatterPartialTest : TestCase
- {
- StringifyFormatterPartialTest() : TestCase("stringify formatter partial") { }
-
- void run()
- {
- TestEnvironment env;
-
- PartialFormatter f;
- StringifyFormatter ff(f);
- BlockDepSpec b("!!!!!cat/pkg", parse_user_package_dep_spec("cat/pkg", &env, { }), bk_weak);
- NamedSetDepSpec u(SetName("foo"));
- std::string s(format_three(
- parse_user_package_dep_spec("cat/pkg", &env, { }),
- b, u,
- ff));
- TEST_CHECK_EQUAL(s, "<cat/pkg> !!!!!cat/pkg foo");
- }
- } test_stringify_formatter_partial;
-}
-
-
diff --git a/python/Makefile.am b/python/Makefile.am
index f82cbe6..00f78f3 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -35,7 +35,6 @@ IF_PYTHON_TESTS = \
environment_TEST.py \
filter_TEST.py \
filtered_generator_TEST.py \
- formatter_TEST.py \
generator_TEST.py \
log_TEST.py \
mask_TEST.py \
@@ -66,7 +65,6 @@ IF_PYTHON_SOURCES = \
exception.hh exception.cc \
filter.cc \
filtered_generator.cc \
- formatter.cc \
fs_path.cc \
generator.cc \
mask.cc \
diff --git a/python/additional_tests.cc b/python/additional_tests.cc
index 1a1dbc5..0f9567b 100644
--- a/python/additional_tests.cc
+++ b/python/additional_tests.cc
@@ -35,8 +35,6 @@
#include <paludis/hook.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/util/options.hh>
-#include <paludis/formatter.hh>
-#include <paludis/stringify_formatter-impl.hh>
#include <paludis/util/clone-impl.hh>
#include <paludis/util/timestamp.hh>
#include <memory>
@@ -213,76 +211,6 @@ namespace metadata_key
}
}
-namespace formatter
-{
- using namespace format;
-
- // CanFormat for PlainRoles
- void test_plain_roles(CanFormat<PlainTextDepSpec> & f)
- {
- PlainTextDepSpec d("foo");
- f.format(d, Plain());
- }
-
- // CanFormat for AcceptableRoles
- void test_acceptable_roles(CanFormat<KeywordName> & f)
- {
- KeywordName k("keyword");
- f.format(k, Plain());
- f.format(k, Accepted());
- f.format(k, Unaccepted());
- }
-
- // CanFormat for PackageRoles
- void test_package_roles(CanFormat<PackageDepSpec> & f)
- {
- TestEnvironment e;
- PackageDepSpec p(parse_user_package_dep_spec("cat/pkg", &e, { }));
- f.format(p, Plain());
- f.format(p, Installed());
- f.format(p, Installable());
- }
-
- // CanSpace
- void test_can_space(CanSpace & f)
- {
- f.newline();
- f.indent(1);
- }
-
- void test_formatter_string(const Formatter<std::string> &)
- {
- }
-
- void test_formmater_keyword_name(const Formatter<KeywordName> &)
- {
- }
-
- void test_formatter_license_spec_tree(const LicenseSpecTree::ItemFormatter &)
- {
- }
-
- void test_formatter_provide_spec_tree(const ProvideSpecTree::ItemFormatter &)
- {
- }
-
- void test_formatter_dependency_spec_tree(const DependencySpecTree::ItemFormatter &)
- {
- }
-
- void test_formatter_plain_text_spec_tree(const PlainTextSpecTree::ItemFormatter &)
- {
- }
-
- void test_formatter_simple_uri_spec_tree(const SimpleURISpecTree::ItemFormatter &)
- {
- }
-
- void test_formatter_fetchable_uri_spec_tree(const FetchableURISpecTree::ItemFormatter &)
- {
- }
-}
-
void expose_additional_tests()
{
/**
@@ -317,22 +245,5 @@ void expose_additional_tests()
bp::def("test_metadata_fetchable_uri_spec_tree_key", &metadata_key::test_metadata_spec_tree_key<FetchableURISpecTree>);
bp::def("test_metadata_simple_uri_spec_tree_key", &metadata_key::test_metadata_spec_tree_key<SimpleURISpecTree>);
bp::def("test_metadata_section_key", &metadata_key::test_metadata_section_key);
-
- /**
- * Formatter tests
- */
- bp::def("test_plain_roles", &formatter::test_plain_roles);
- bp::def("test_acceptable_roles", &formatter::test_acceptable_roles);
- bp::def("test_package_roles", &formatter::test_package_roles);
- bp::def("test_can_space", &formatter::test_can_space);
-
- bp::def("test_formatter_string", &formatter::test_formatter_string);
- bp::def("test_formmater_keyword_name", &formatter::test_formmater_keyword_name);
- bp::def("test_formatter_license_spec_tree", &formatter::test_formatter_license_spec_tree);
- bp::def("test_formatter_provide_spec_tree", &formatter::test_formatter_provide_spec_tree);
- bp::def("test_formatter_dependency_spec_tree", &formatter::test_formatter_dependency_spec_tree);
- bp::def("test_formatter_plain_text_spec_tree", &formatter::test_formatter_plain_text_spec_tree);
- bp::def("test_formatter_simple_uri_spec_tree", &formatter::test_formatter_simple_uri_spec_tree);
- bp::def("test_formatter_fetchable_uri_spec_tree", &formatter::test_formatter_fetchable_uri_spec_tree);
}
diff --git a/python/formatter.cc b/python/formatter.cc
deleted file mode 100644
index 044a2dc..0000000
--- a/python/formatter.cc
+++ /dev/null
@@ -1,689 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2007 Piotr Jaroszyński
- *
- * 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
- */
-
-#define BOOST_PYTHON_MAX_BASES 20
-
-#include <python/paludis_python.hh>
-#include <python/exception.hh>
-#include <python/nice_names-nn.hh>
-
-#include <paludis/formatter.hh>
-#include <paludis/stringify_formatter.hh>
-#include <paludis/name.hh>
-#include <paludis/dep_spec.hh>
-#include <paludis/spec_tree.hh>
-#include <paludis/util/clone-impl.hh>
-
-using namespace paludis;
-using namespace paludis::python;
-namespace bp = boost::python;
-
-template <typename T_>
-struct PythonCanFormatBase
-{
- virtual bp::override get_override(const char *) const = 0;
-
- virtual ~PythonCanFormatBase()
- {
- }
-
- template <typename F_>
- std::string do_format(const T_ & t, const F_ &) const
- {
- Lock l(get_mutex());
-
- std::string func_name(std::string("format_") + LowercaseNiceNames<T_>::name
- + "_" + LowercaseNiceNames<F_>::name);
-
- if (bp::override f = this->get_override(func_name.c_str()))
- return f(t);
- else
- throw PythonMethodNotImplemented(std::string("CanFormat") + NiceNames<T_>::name, func_name);
- }
-};
-
-template <typename T_, typename C_ = typename format::CategorySelector<T_>::Category >
-struct PythonCanFormat;
-
-template <typename T_>
-struct PythonCanFormat<T_, format::PlainRoles> :
- CanFormat<T_>,
- PythonCanFormatBase<T_>
-{
- std::string format(const T_ & t, const format::Plain & f) const
- {
- return do_format(t, f);
- }
-
- static std::string format_plain(const CanFormat<T_> & self, const T_ & t)
- {
- return self.format(t, format::Plain());
- }
-};
-
-template <typename T_>
-struct PythonCanFormat<T_, format::AcceptableRoles> :
- CanFormat<T_>,
- PythonCanFormatBase<T_>
-{
- std::string format(const T_ & t, const format::Plain & f) const
- {
- return do_format(t, f);
- }
-
- std::string format(const T_ & t, const format::Accepted & f) const
- {
- return do_format(t, f);
- }
-
- std::string format(const T_ & t, const format::Unaccepted & f) const
- {
- return do_format(t, f);
- }
-
- static std::string format_plain(const CanFormat<T_> & self, const T_ & t)
- {
- return self.format(t, format::Plain());
- }
-
- static std::string format_accepted(const CanFormat<T_> & self, const T_ & t)
- {
- return self.format(t, format::Accepted());
- }
-
- static std::string format_unaccepted(const CanFormat<T_> & self, const T_ & t)
- {
- return self.format(t, format::Unaccepted());
- }
-};
-
-template <typename T_>
-struct PythonCanFormat<T_, format::ChoiceRoles> :
- CanFormat<T_>,
- PythonCanFormatBase<T_>
-{
- template <typename F_>
- std::string do_decorate(const T_ & t, const std::string & s, const F_ &) const
- {
- Lock l(get_mutex());
-
- std::string func_name(std::string("decorate_") + LowercaseNiceNames<T_>::name
- + "_" + LowercaseNiceNames<F_>::name);
-
- if (bp::override f = this->get_override(func_name.c_str()))
- return f(t, s);
- else
- throw PythonMethodNotImplemented(std::string("CanFormat") + NiceNames<T_>::name, func_name);
- }
-
- std::string format(const T_ & t, const format::Plain & f) const
- {
- return do_format(t, f);
- }
-
- std::string format(const T_ & t, const format::Enabled & f) const
- {
- return do_format(t, f);
- }
-
- std::string format(const T_ & t, const format::Disabled & f) const
- {
- return do_format(t, f);
- }
-
- std::string format(const T_ & t, const format::Forced & f) const
- {
- return do_format(t, f);
- }
-
- std::string format(const T_ & t, const format::Masked & f) const
- {
- return do_format(t, f);
- }
-
- std::string decorate(const T_ & t, const std::string & s, const format::Added & f) const
- {
- return do_decorate(t, s, f);
- }
-
- std::string decorate(const T_ & t, const std::string & s, const format::Changed & f) const
- {
- return do_decorate(t, s, f);
- }
-
- static std::string format_plain(const CanFormat<T_> & self, const T_ & t)
- {
- return self.format(t, format::Plain());
- }
-
- static std::string format_enabled(const CanFormat<T_> & self, const T_ & t)
- {
- return self.format(t, format::Enabled());
- }
-
- static std::string format_disabled(const CanFormat<T_> & self, const T_ & t)
- {
- return self.format(t, format::Disabled());
- }
-
- static std::string format_forced(const CanFormat<T_> & self, const T_ & t)
- {
- return self.format(t, format::Forced());
- }
-
- static std::string format_masked(const CanFormat<T_> & self, const T_ & t)
- {
- return self.format(t, format::Masked());
- }
-
- std::string decorate_added(const T_ & t, const std::string & s) const
- {
- return decorate(t, s, format::Added());
- }
-
- std::string decorate_changed(const T_ & t, const std::string & s) const
- {
- return decorate(t, s, format::Changed());
- }
-};
-
-template <typename T_>
-struct PythonCanFormat<T_, format::PackageRoles> :
- CanFormat<T_>,
- PythonCanFormatBase<T_>
-{
- std::string format(const T_ & t, const format::Plain & f) const
- {
- return do_format(t, f);
- }
-
- std::string format(const T_ & t, const format::Installed & f) const
- {
- return do_format(t, f);
- }
-
- std::string format(const T_ & t, const format::Installable & f) const
- {
- return do_format(t, f);
- }
-
- static std::string format_plain(const CanFormat<T_> & self, const T_ & t)
- {
- return self.format(t, format::Plain());
- }
-
- static std::string format_installed(const CanFormat<T_> & self, const T_ & t)
- {
- return self.format(t, format::Installed());
- }
-
- static std::string format_installable(const CanFormat<T_> & self, const T_ & t)
- {
- return self.format(t, format::Installable());
- }
-};
-
-template <typename T_>
-struct PythonCanFormatWrapper:
- PythonCanFormat<T_>,
- bp::wrapper<CanFormat<T_> >
-{
- bp::override get_override(const char * name) const
- {
- return bp::wrapper<CanFormat<T_> >::get_override(name);
- }
-};
-
-struct PythonCanSpace :
- CanSpace
-{
- virtual bp::override get_override(const char *) const = 0;
-
- std::string newline() const
- {
- Lock l(get_mutex());
-
- if (bp::override f = this->get_override("newline"))
- return f();
- else
- throw PythonMethodNotImplemented(std::string("CanSpace"), "newline");
- }
-
- std::string indent(const int i) const
- {
- Lock l(get_mutex());
-
- if (bp::override f = this->get_override("indent"))
- return f(i);
- else
- throw PythonMethodNotImplemented(std::string("CanSpace"), "indent");
- }
-};
-
-struct PythonCanSpaceWrapper :
- PythonCanSpace,
- bp::wrapper<CanSpace>
-{
- bp::override get_override(const char * name) const
- {
- return bp::wrapper<CanSpace>::get_override(name);
- }
-};
-
-class PythonFormatterWrapper :
- public PythonCanFormat<std::string>,
- public PythonCanFormat<KeywordName>,
- public PythonCanFormat<PackageDepSpec>,
- public PythonCanFormat<BlockDepSpec>,
- public PythonCanFormat<FetchableURIDepSpec>,
- public PythonCanFormat<SimpleURIDepSpec>,
- public PythonCanFormat<DependenciesLabelsDepSpec>,
- public PythonCanFormat<URILabelsDepSpec>,
- public PythonCanFormat<PlainTextLabelDepSpec>,
- public PythonCanFormat<PlainTextDepSpec>,
- public PythonCanFormat<LicenseDepSpec>,
- public PythonCanFormat<ConditionalDepSpec>,
- public PythonCanFormat<NamedSetDepSpec>,
- public PythonCanSpace,
- public bp::wrapper<PythonFormatterWrapper>
-{
- bp::override get_override(const char * name) const
- {
- return bp::wrapper<PythonFormatterWrapper>::get_override(name);
- }
-};
-
-void expose_formatter()
-{
-
- /**
- * CanFormatString
- */
- bp::class_<PythonCanFormatWrapper<std::string>, boost::noncopyable>
- (
- "CanFormatString",
- "Descendents of this class implement the necessary methods to format a String.",
- bp::init<>("__init__()")
- )
- .def("format_string_plain", &PythonCanFormatWrapper<std::string>::format_plain)
- ;
-
- /**
- * CanFormatKeywordName
- */
- bp::class_<PythonCanFormatWrapper<KeywordName>, boost::noncopyable>
- (
- "CanFormatKeywordName",
- "Descendents of this class implement the necessary methods to format a KeywordName.",
- bp::init<>("__init__()")
- )
- .def("format_keyword_name_plain", &PythonCanFormatWrapper<KeywordName>::format_plain)
- .def("format_keyword_name_accepted", &PythonCanFormatWrapper<KeywordName>::format_accepted)
- .def("format_keyword_name_unaccepted", &PythonCanFormatWrapper<KeywordName>::format_unaccepted)
- ;
-
- /**
- * CanFormatPackageDepSpec
- */
- bp::class_<PythonCanFormatWrapper<PackageDepSpec>, boost::noncopyable>
- (
- "CanFormatPackageDepSpec",
- "Descendents of this class implement the necessary methods to format a PackageDepSpec.",
- bp::init<>("__init__()")
- )
- .def("format_package_dep_spec_plain", &PythonCanFormatWrapper<PackageDepSpec>::format_plain)
- .def("format_package_dep_spec_installed", &PythonCanFormatWrapper<PackageDepSpec>::format_installed)
- .def("format_package_dep_spec_installable", &PythonCanFormatWrapper<PackageDepSpec>::format_installable)
- ;
-
- /**
- * CanFormatBlockDepSpec
- */
- bp::class_<PythonCanFormatWrapper<BlockDepSpec>, boost::noncopyable>
- (
- "CanFormatBlockDepSpec",
- "Descendents of this class implement the necessary methods to format a BlockDepSpec.",
- bp::init<>("__init__()")
- )
- .def("format_block_dep_spec_plain", &PythonCanFormatWrapper<BlockDepSpec>::format_plain)
- ;
-
- /**
- * CanFormatFetchableURIDepSpec
- */
- bp::class_<PythonCanFormatWrapper<FetchableURIDepSpec>, boost::noncopyable>
- (
- "CanFormatFetchableURIDepSpec",
- "Descendents of this class implement the necessary methods to format a FetchableURIDepSpec.",
- bp::init<>("__init__()")
- )
- .def("format_fetchable_uri_dep_spec_plain", &PythonCanFormatWrapper<FetchableURIDepSpec>::format_plain)
- ;
-
- /**
- * CanFormatSimpleURIDepSpec
- */
- bp::class_<PythonCanFormatWrapper<SimpleURIDepSpec>, boost::noncopyable>
- (
- "CanFormatSimpleURIDepSpec",
- "Descendents of this class implement the necessary methods to format a SimpleURIDepSpec.",
- bp::init<>("__init__()")
- )
- .def("format_simple_uri_dep_spec_plain", &PythonCanFormatWrapper<SimpleURIDepSpec>::format_plain)
- ;
-
- /**
- * CanFormatDependenciesLabelsDepSpec
- */
- bp::class_<PythonCanFormatWrapper<DependenciesLabelsDepSpec>, boost::noncopyable>
- (
- "CanFormatDependenciesLabelsDepSpec",
- "Descendents of this class implement the necessary methods to format a DependenciesLabelsDepSpec.",
- bp::init<>("__init__()")
- )
- .def("format_dependencies_labels_dep_spec_plain",
- &PythonCanFormatWrapper<DependenciesLabelsDepSpec>::format_plain)
- ;
-
- /**
- * CanFormatURILabelsDepSpec
- */
- bp::class_<PythonCanFormatWrapper<URILabelsDepSpec>, boost::noncopyable>
- (
- "CanFormatURILabelsDepSpec",
- "Descendents of this class implement the necessary methods to format an URILabelsDepSpec.",
- bp::init<>("__init__()")
- )
- .def("format_uri_labels_dep_spec_plain", &PythonCanFormatWrapper<URILabelsDepSpec>::format_plain)
- ;
-
- /**
- * CanFormatPlainTextLabelDepSpec
- */
- bp::class_<PythonCanFormatWrapper<PlainTextLabelDepSpec>, boost::noncopyable>
- (
- "CanFormatPlainTextLabelDepSpec",
- "Descendents of this class implement the necessary methods to format a PlainTextLabelDepSpec.",
- bp::init<>("__init__()")
- )
- .def("format_plain_text_label_dep_spec_plain", &PythonCanFormatWrapper<PlainTextLabelDepSpec>::format_plain)
- ;
-
- /**
- * CanFormatPlainTextDepSpec
- */
- bp::class_<PythonCanFormatWrapper<PlainTextDepSpec>, boost::noncopyable>
- (
- "CanFormatPlainTextDepSpec",
- "Descendents of this class implement the necessary methods to format a PlainTextDepSpec.",
- bp::init<>("__init__()")
- )
- .def("format_plain_text_dep_spec_plain", &PythonCanFormatWrapper<PlainTextDepSpec>::format_plain)
- ;
-
- /**
- * CanFormatLicenseDepSpec
- */
- bp::class_<PythonCanFormatWrapper<LicenseDepSpec>, boost::noncopyable>
- (
- "CanFormatLicenseDepSpec",
- "Descendents of this class implement the necessary methods to format a LicenseDepSpec.",
- bp::init<>("__init__()")
- )
- .def("format_license_dep_spec_plain", &PythonCanFormatWrapper<LicenseDepSpec>::format_plain)
- .def("format_license_dep_spec_accepted", &PythonCanFormatWrapper<LicenseDepSpec>::format_accepted)
- .def("format_license_dep_spec_unaccepted", &PythonCanFormatWrapper<LicenseDepSpec>::format_unaccepted)
- ;
-
- /**
- * CanFormatConditionalDepSpec
- */
- bp::class_<PythonCanFormatWrapper<ConditionalDepSpec>, boost::noncopyable>
- (
- "CanFormatConditionalDepSpec",
- "Descendents of this class implement the necessary methods to format a ConditionalDepSpec.",
- bp::init<>("__init__()")
- )
- .def("format_conditional_dep_spec_plain", &PythonCanFormatWrapper<ConditionalDepSpec>::format_plain)
- .def("format_conditional_dep_spec_enabled", &PythonCanFormatWrapper<ConditionalDepSpec>::format_enabled)
- .def("format_conditional_dep_spec_disabled", &PythonCanFormatWrapper<ConditionalDepSpec>::format_disabled)
- .def("format_conditional_dep_spec_forced", &PythonCanFormatWrapper<ConditionalDepSpec>::format_forced)
- .def("format_conditional_dep_spec_masked", &PythonCanFormatWrapper<ConditionalDepSpec>::format_masked)
- ;
-
- /**
- * CanFormatNamedSetDepSpec
- */
- bp::class_<PythonCanFormatWrapper<NamedSetDepSpec>, boost::noncopyable>
- (
- "CanFormatNamedSetDepSpec",
- "Descendents of this class implement the necessary methods to format a NamedSetDepSpec.",
- bp::init<>("__init__()")
- )
- .def("format_named_set_dep_spec_plain", &PythonCanFormatWrapper<NamedSetDepSpec>::format_plain)
- ;
-
- /**
- * CanSpace
- */
- bp::class_<PythonCanSpaceWrapper, boost::noncopyable>
- (
- "CanSpace",
- "Descendents of this class implement the necessary methods to format whitespace.",
- bp::init<>("__init__()")
- )
- .def("newline", &CanSpace::newline,
- "newline() -> string\n"
- "Output a newline."
- )
-
- .def("indent", &CanSpace::newline,
- "indent(int) -> string\n"
- "Output an indent marker of the specified indent level."
- )
- ;
-
- /**
- * StringFormatter
- */
- bp::class_<Formatter<std::string>, bp::bases<CanFormat<std::string> >, boost::noncopyable>
- (
- "StringFormatter",
- "A formatter that can handle Strings.",
- bp::no_init
- );
-
- /**
- * KeywordNameFormatter
- */
- bp::class_<Formatter<KeywordName>, bp::bases<CanFormat<KeywordName> >, boost::noncopyable>
- (
- "KeywordNameFormatter",
- "A formatter that can handle KeywordNames.",
- bp::no_init
- );
-
- /**
- * LicenseSpecTreeFormatter
- */
- bp::class_<LicenseSpecTree::ItemFormatter,
- bp::bases<
- CanFormat<ConditionalDepSpec>,
- CanFormat<LicenseDepSpec> >,
- boost::noncopyable>
- (
- "LicenseSpecTreeFormatter",
- "A formatter that can handle any formattable type found in a\n"
- "LicenseSpecTree.",
- bp::no_init
- );
-
- /**
- * ProvideSpecTreeFormatter
- */
- bp::class_<ProvideSpecTree::ItemFormatter,
- bp::bases<
- CanFormat<ConditionalDepSpec>,
- CanFormat<PackageDepSpec> >,
- boost::noncopyable>
- (
- "ProvideSpecTreeFormatter",
- "A formatter that can handle any formattable type found in a\n"
- "ProvideSpecTree.",
- bp::no_init
- );
-
- /**
- * DependencySpecTreeFormatter
- */
- bp::class_<DependencySpecTree::ItemFormatter,
- bp::bases<
- CanFormat<ConditionalDepSpec>,
- CanFormat<PackageDepSpec>,
- CanFormat<NamedSetDepSpec>,
- CanFormat<DependenciesLabelsDepSpec> >,
- boost::noncopyable>
- (
- "DependencySpecTreeFormatter",
- "A formatter that can handle any formattable type found in a\n"
- "DependencySpecTree.",
- bp::no_init
- );
-
- /**
- * PlainTextSpecTreeFormatter
- */
- bp::class_<PlainTextSpecTree::ItemFormatter,
- bp::bases<
- CanFormat<ConditionalDepSpec>,
- CanFormat<PlainTextLabelDepSpec>,
- CanFormat<PlainTextDepSpec> >,
- boost::noncopyable>
- (
- "PlainTextSpecTreeFormatter",
- "A formatter that can handle any formattable type found in a\n"
- "PlainTextSpecTree.",
- bp::no_init
- );
-
- /**
- * SimpleURISpecTreeFormatter
- */
- bp::class_<SimpleURISpecTree::ItemFormatter,
- bp::bases<
- CanFormat<ConditionalDepSpec>,
- CanFormat<SimpleURIDepSpec> >,
- boost::noncopyable>
- (
- "SimpleURISpecTreeFormatter",
- "A formatter that can handle any formattable type found in a\n"
- "SimpleURISpecTree.",
- bp::no_init
- );
-
- /**
- * FetchableURISpecTreeFormatter
- */
- bp::class_<FetchableURISpecTree::ItemFormatter,
- bp::bases<
- CanFormat<ConditionalDepSpec>,
- CanFormat<FetchableURIDepSpec>,
- CanFormat<URILabelsDepSpec> >,
- boost::noncopyable>
- (
- "FetchableURISpecTreeFormatter",
- "A formatter that can handle any formattable type found in a\n"
- "FetchableURISpecTree.",
- bp::no_init
- );
-
- /**
- * StringifyFormatter
- */
- bp::implicitly_convertible<StringifyFormatter, Formatter<std::string> >();
- bp::implicitly_convertible<StringifyFormatter, Formatter<KeywordName> >();
- bp::implicitly_convertible<StringifyFormatter, LicenseSpecTree::ItemFormatter>();
- bp::implicitly_convertible<StringifyFormatter, ProvideSpecTree::ItemFormatter>();
- bp::implicitly_convertible<StringifyFormatter, DependencySpecTree::ItemFormatter>();
- bp::implicitly_convertible<StringifyFormatter, PlainTextSpecTree::ItemFormatter>();
- bp::implicitly_convertible<StringifyFormatter, SimpleURISpecTree::ItemFormatter>();
- bp::implicitly_convertible<StringifyFormatter, FetchableURISpecTree::ItemFormatter>();
- bp::class_<StringifyFormatter,
- bp::bases<
- CanFormat<std::string>,
- CanFormat<KeywordName>,
- CanFormat<PackageDepSpec>,
- CanFormat<BlockDepSpec>,
- CanFormat<FetchableURIDepSpec>,
- CanFormat<SimpleURIDepSpec>,
- CanFormat<DependenciesLabelsDepSpec>,
- CanFormat<URILabelsDepSpec>,
- CanFormat<PlainTextLabelDepSpec>,
- CanFormat<PlainTextDepSpec>,
- CanFormat<LicenseDepSpec>,
- CanFormat<ConditionalDepSpec>,
- CanFormat<NamedSetDepSpec>,
- CanSpace>,
- boost::noncopyable>
- (
- "StringifyFormatter",
- "A StringifyFormatter is a Formatter that implements every format function\n"
- "by calling paludis::stringify().\n\n"
-
- "Indenting is done via simple spaces; newlines are done via a newline\n"
- "character. Again, when used as a wrapper, this can be overridden by the\n"
- "wrapped class.\n\n"
-
- "This class can be subclassed in Python.",
- bp::init<>("__init__()")
- );
-
- /**
- * PythonFormatter
- */
- bp::implicitly_convertible<PythonFormatterWrapper, Formatter<std::string> >();
- bp::implicitly_convertible<PythonFormatterWrapper, Formatter<KeywordName> >();
- bp::implicitly_convertible<PythonFormatterWrapper, LicenseSpecTree::ItemFormatter>();
- bp::implicitly_convertible<PythonFormatterWrapper, ProvideSpecTree::ItemFormatter>();
- bp::implicitly_convertible<PythonFormatterWrapper, DependencySpecTree::ItemFormatter>();
- bp::implicitly_convertible<PythonFormatterWrapper, PlainTextSpecTree::ItemFormatter>();
- bp::implicitly_convertible<PythonFormatterWrapper, SimpleURISpecTree::ItemFormatter>();
- bp::implicitly_convertible<PythonFormatterWrapper, FetchableURISpecTree::ItemFormatter>();
- bp::class_<PythonFormatterWrapper,
- bp::bases<
- CanFormat<std::string>,
- CanFormat<KeywordName>,
- CanFormat<PackageDepSpec>,
- CanFormat<BlockDepSpec>,
- CanFormat<FetchableURIDepSpec>,
- CanFormat<SimpleURIDepSpec>,
- CanFormat<DependenciesLabelsDepSpec>,
- CanFormat<URILabelsDepSpec>,
- CanFormat<PlainTextLabelDepSpec>,
- CanFormat<PlainTextDepSpec>,
- CanFormat<LicenseDepSpec>,
- CanFormat<ConditionalDepSpec>,
- CanFormat<NamedSetDepSpec>,
- CanSpace>,
- boost::noncopyable>
- (
- "PythonFormatter",
- bp::init<>("__init__()")
- );
-}
diff --git a/python/formatter_TEST.py b/python/formatter_TEST.py
deleted file mode 100755
index 1139e78..0000000
--- a/python/formatter_TEST.py
+++ /dev/null
@@ -1,150 +0,0 @@
-#!/usr/bin/env python
-# vim: set fileencoding=utf-8 sw=4 sts=4 et :
-
-#
-# Copyright (c) 2007 Piotr Jaroszyński
-#
-# 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
-#
-
-from paludis import *
-from additional_tests import *
-
-import unittest
-
-Log.instance.log_level = LogLevel.WARNING
-
-class TestCase_01_StringifyFormatter(unittest.TestCase):
- def test_01_create(self):
- StringifyFormatter()
-
- def test_02_passing_to_cpp(self):
- f = StringifyFormatter()
-
- test_formatter_string(f)
- test_formmater_keyword_name(f)
- test_formatter_license_spec_tree(f)
- test_formatter_provide_spec_tree(f)
- test_formatter_dependency_spec_tree(f)
- test_formatter_plain_text_spec_tree(f)
- test_formatter_simple_uri_spec_tree(f)
- test_formatter_fetchable_uri_spec_tree(f)
-
-class TestCase_02_PythonFormatter(unittest.TestCase):
- def test_01_create(self):
- PythonFormatter()
-
- def test_02_passing_to_cpp(self):
- f = PythonFormatter()
-
- test_formatter_string(f)
- test_formmater_keyword_name(f)
- test_formatter_license_spec_tree(f)
- test_formatter_provide_spec_tree(f)
- test_formatter_dependency_spec_tree(f)
- test_formatter_plain_text_spec_tree(f)
- test_formatter_simple_uri_spec_tree(f)
- test_formatter_fetchable_uri_spec_tree(f)
-
-class TestCase_03_Formatters_suclassing(unittest.TestCase):
- def test_python_can_formats(self):
-
- class TestCanFormatPlain(CanFormatPlainTextDepSpec):
- def format_plain_text_dep_spec_plain(self, d):
- return str(d)
-
- class TestCanFormatAcceptable(CanFormatKeywordName):
- def format_keyword_name_plain(self, k):
- return str(k)
-
- def format_keyword_name_accepted(self, k):
- return str(k)
-
- def format_keyword_name_unaccepted(self, k):
- return str(k)
-
- class TestCanFormatPackage(CanFormatPackageDepSpec):
- def format_package_dep_spec_plain(self, pds):
- return str(pds)
-
- def format_package_dep_spec_installed(self, pds):
- return str(pds)
-
- def format_package_dep_spec_installable(self, pds):
- return str(pds)
-
- test_plain_roles(TestCanFormatPlain())
- test_acceptable_roles(TestCanFormatAcceptable())
- test_package_roles(TestCanFormatPackage())
-
- def test_can_space(self):
-
- class TestCanSpace(CanSpace):
- def newline(self):
- return "\n"
-
- def indent(self, k):
- return " " * k
-
- test_can_space(TestCanSpace())
-
- def test_python_formatter(self):
-
- class TestFormatter(PythonFormatter):
- def format_plain_text_dep_spec_plain(self, d):
- return str(d)
-
- def format_keyword_name_plain(self, k):
- return str(k)
-
- def format_keyword_name_accepted(self, k):
- return str(k)
-
- def format_keyword_name_unaccepted(self, k):
- return str(k)
-
- def format_package_dep_spec_plain(self, pds):
- return str(pds)
-
- def format_package_dep_spec_installed(self, pds):
- return str(pds)
-
- def format_package_dep_spec_installable(self, pds):
- return str(pds)
-
- def newline(self):
- return "\n"
-
- def indent(self, k):
- return " " * k
-
- f = TestFormatter()
-
- test_plain_roles(f)
- test_acceptable_roles(f)
- test_package_roles(f)
- test_can_space(f)
-
- test_formatter_string(f)
- test_formmater_keyword_name(f)
- test_formatter_license_spec_tree(f)
- test_formatter_provide_spec_tree(f)
- test_formatter_dependency_spec_tree(f)
- test_formatter_plain_text_spec_tree(f)
- test_formatter_simple_uri_spec_tree(f)
- test_formatter_fetchable_uri_spec_tree(f)
-
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index 31fed32..98b43e7 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -22,7 +22,6 @@
#include <paludis/metadata_key.hh>
#include <paludis/name.hh>
-#include <paludis/formatter.hh>
#include <paludis/dep_label.hh>
#include <paludis/environment.hh>
#include <paludis/util/set.hh>
@@ -693,17 +692,6 @@ struct MetadataSpecTreeKeyWrapper :
throw PythonMethodNotImplemented("MetadataSpecTreeKey", "value");
}
- virtual std::string pretty_print_flat(const typename C_::ItemFormatter & formatter) const
- PALUDIS_ATTRIBUTE((warn_unused_result))
- {
- Lock l(get_mutex());
-
- if (bp::override f = this->get_override("pretty_print_flat"))
- return f(boost::cref(formatter));
- else
- throw PythonMethodNotImplemented("MetadataSpecTreeKey", "pretty_print_flat");
- }
-
virtual const std::string raw_name() const
{
Lock l(get_mutex());
diff --git a/python/nice_names.nn b/python/nice_names.nn
index 8473eed..352d322 100644
--- a/python/nice_names.nn
+++ b/python/nice_names.nn
@@ -4,7 +4,7 @@
include_hh << END
#include <paludis/dep_spec-fwd.hh>
#include <paludis/spec_tree-fwd.hh>
-#include <paludis/formatter.hh>
+#include <paludis/name.hh>
END
include_cc << END
@@ -80,16 +80,4 @@ make_nn_LowercaseNiceNames() {
name "LicenseDepSpec" "license_dep_spec"
name "ConditionalDepSpec" "conditional_dep_spec"
name "NamedSetDepSpec" "named_set_dep_spec"
-
- name "format::Plain" "plain"
- name "format::Enabled" "enabled"
- name "format::Disabled" "disabled"
- name "format::Masked" "masked"
- name "format::Forced" "forced"
- name "format::Changed" "changed"
- name "format::Added" "added"
- name "format::Accepted" "accepted"
- name "format::Unaccepted" "unaccepted"
- name "format::Installed" "installed"
- name "format::Installable" "installable"
}
diff --git a/python/paludis_python.hh b/python/paludis_python.hh
index dd90d06..0f467c0 100644
--- a/python/paludis_python.hh
+++ b/python/paludis_python.hh
@@ -183,7 +183,6 @@ void expose_environment() PALUDIS_VISIBLE;
void expose_exception() PALUDIS_VISIBLE;
void expose_filter() PALUDIS_VISIBLE;
void expose_filtered_generator() PALUDIS_VISIBLE;
-void expose_formatter() PALUDIS_VISIBLE;
void expose_fs_path() PALUDIS_VISIBLE;
void expose_generator() PALUDIS_VISIBLE;
void expose_log() PALUDIS_VISIBLE;
diff --git a/python/paludis_python_so.cc b/python/paludis_python_so.cc
index d2ec5f7..61ac663 100644
--- a/python/paludis_python_so.cc
+++ b/python/paludis_python_so.cc
@@ -51,7 +51,6 @@ BOOST_PYTHON_MODULE(paludis)
expose_action();
expose_package_database();
expose_repository();
- expose_formatter();
expose_filtered_generator();
expose_generator();
expose_selection();
diff --git a/src/clients/cave/Makefile.am b/src/clients/cave/Makefile.am
index 39a20a3..fb03c54 100644
--- a/src/clients/cave/Makefile.am
+++ b/src/clients/cave/Makefile.am
@@ -118,7 +118,6 @@ noinst_LIBRARIES = libcave.a
# See note above for adding commands
libcave_a_SOURCES = \
- colour_formatter.cc colour_formatter.hh colour_formatter-fmt.hh \
colour_pretty_printer.cc colour_pretty_printer.hh colour_pretty_printer-fmt.hh \
command.cc command.hh \
command_line.cc command_line.hh \
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index ad0d913..6273c35 100755
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -22,7 +22,6 @@
#include "exceptions.hh"
#include "command_command_line.hh"
#include "colours.hh"
-#include "colour_formatter.hh"
#include "colour_pretty_printer.hh"
#include "format_user_config.hh"
#include <paludis/args/do_help.hh>
diff --git a/src/clients/cave/cmd_dump_cave_formats_conf.cc b/src/clients/cave/cmd_dump_cave_formats_conf.cc
index 048edcc..e1cc518 100644
--- a/src/clients/cave/cmd_dump_cave_formats_conf.cc
+++ b/src/clients/cave/cmd_dump_cave_formats_conf.cc
@@ -146,8 +146,6 @@ namespace
}{
#include "cmd_verify-fmt.hh"
}{
-#include "colour_formatter-fmt.hh"
- }{
#include "colour_pretty_printer-fmt.hh"
}
}
diff --git a/src/clients/cave/cmd_execute_resolution.cc b/src/clients/cave/cmd_execute_resolution.cc
index e851a82..3f3b682 100644
--- a/src/clients/cave/cmd_execute_resolution.cc
+++ b/src/clients/cave/cmd_execute_resolution.cc
@@ -23,7 +23,6 @@
#include "exceptions.hh"
#include "command_command_line.hh"
#include "colours.hh"
-#include "colour_formatter.hh"
#include "resume_data.hh"
#include "format_user_config.hh"
#include <paludis/args/do_help.hh>
diff --git a/src/clients/cave/cmd_import.cc b/src/clients/cave/cmd_import.cc
index 2effd6d..057cb0f 100644
--- a/src/clients/cave/cmd_import.cc
+++ b/src/clients/cave/cmd_import.cc
@@ -36,7 +36,6 @@
#include <paludis/package_id.hh>
#include <paludis/repository.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/repository_factory.hh>
#include <paludis/package_database.hh>
#include <paludis/unformatted_pretty_printer.hh>
diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc
index 0e60e5f..3f621dc 100644
--- a/src/clients/cave/cmd_info.cc
+++ b/src/clients/cave/cmd_info.cc
@@ -19,7 +19,6 @@
#include "cmd_info.hh"
#include "cmd_perform.hh"
-#include "colour_formatter.hh"
#include "colour_pretty_printer.hh"
#include "colours.hh"
#include "exceptions.hh"
diff --git a/src/clients/cave/cmd_report.cc b/src/clients/cave/cmd_report.cc
index 1454a27..db8b224 100644
--- a/src/clients/cave/cmd_report.cc
+++ b/src/clients/cave/cmd_report.cc
@@ -18,7 +18,6 @@
*/
#include "cmd_report.hh"
-#include "colour_formatter.hh"
#include "format_user_config.hh"
#include "colours.hh"
#include "exceptions.hh"
diff --git a/src/clients/cave/cmd_resume.cc b/src/clients/cave/cmd_resume.cc
index 0a2fa8f..8a32497 100644
--- a/src/clients/cave/cmd_resume.cc
+++ b/src/clients/cave/cmd_resume.cc
@@ -23,7 +23,6 @@
#include "exceptions.hh"
#include "command_command_line.hh"
#include "colours.hh"
-#include "colour_formatter.hh"
#include "resume_data.hh"
#include <paludis/args/do_help.hh>
#include <paludis/args/escape.hh>
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index be967ae..7a20cb2 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -18,7 +18,6 @@
*/
#include "cmd_show.hh"
-#include "colour_formatter.hh"
#include "colour_pretty_printer.hh"
#include "colours.hh"
#include "exceptions.hh"
diff --git a/src/clients/cave/colour_formatter-fmt.hh b/src/clients/cave/colour_formatter-fmt.hh
deleted file mode 100644
index cb600cc..0000000
--- a/src/clients/cave/colour_formatter-fmt.hh
+++ /dev/null
@@ -1,101 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-const auto fs_format_keyword_name_plain = make_format_string_fetcher("format-keyword-name/plain", 1)
- << param<'s'>();
-
-const auto fs_format_keyword_name_accepted = make_format_string_fetcher("format-keyword-name/accepted", 1)
- << c::green_or_pink() << param<'s'>() << c::normal();
-
-const auto fs_format_keyword_name_unaccepted = make_format_string_fetcher("format-keyword-name/unaccepted", 1)
- << c::red() << param<'s'>() << c::normal();
-
-const auto fs_format_string_plain = make_format_string_fetcher("format-string/plain", 1)
- << param<'s'>();
-
-const auto fs_format_string_string_plain = make_format_string_fetcher("format-string-string/plain", 2)
- << param<'k'>() << param<'e'>() << param<'v'>();
-
-const auto fs_format_package_id_plain = make_format_string_fetcher("format-package-id/plain", 1)
- << param<'s'>();
-
-const auto fs_format_package_id_installed = make_format_string_fetcher("format-package-id/installed", 1)
- << c::bold_green_or_pink() << param<'s'>() << c::normal();
-
-const auto fs_format_package_id_installable = make_format_string_fetcher("format-package-id/installable", 1)
- << c::green_or_pink() << param<'s'>() << c::normal();
-
-const auto fs_format_license_dep_spec_plain = make_format_string_fetcher("format-license-dep-spec/plain", 1)
- << param<'s'>();
-
-const auto fs_format_license_dep_spec_accepted = make_format_string_fetcher("format-license-dep-spec/accepted", 1)
- << c::green_or_pink() << param<'s'>() << c::normal();
-
-const auto fs_format_license_dep_spec_unaccepted = make_format_string_fetcher("format-license-dep-spec/unaccepted", 1)
- << c::red() << param<'s'>() << c::normal();
-
-const auto fs_format_choice_value_plain = make_format_string_fetcher("format-choice-value/plain", 1)
- << param<'s'>();
-
-const auto fs_format_choice_value_enabled = make_format_string_fetcher("format-choice-value/enabled", 1)
- << c::green_or_pink() << param<'k'>() << c::normal() << param<'v'>();
-
-const auto fs_format_choice_value_disabled = make_format_string_fetcher("format-choice-value/disabled", 1)
- << c::red() << "-" << param<'s'>() << c::normal();
-
-const auto fs_format_choice_value_forced = make_format_string_fetcher("format-choice-value/forced", 1)
- << c::green_or_pink() << "(" << param<'k'>() << param<'v'>() << ")" << c::normal();
-
-const auto fs_format_choice_value_masked = make_format_string_fetcher("format-choice-value/masked", 1)
- << c::red() << "(-" << param<'s'>() << ")" << c::normal();
-
-const auto fs_format_conditional_dep_spec_plain = make_format_string_fetcher("format-conditional-dep-spec/plain", 1)
- << param<'s'>();
-
-const auto fs_format_conditional_dep_spec_enabled = make_format_string_fetcher("format-conditional-dep-spec/enabled", 1)
- << c::green_or_pink() << param<'s'>() << c::normal();
-
-const auto fs_format_conditional_dep_spec_disabled = make_format_string_fetcher("format-conditional-dep-spec/disabled", 1)
- << c::red() << param<'s'>() << c::normal();
-
-const auto fs_format_conditional_dep_spec_forced = make_format_string_fetcher("format-conditional-dep-spec/forced", 1)
- << c::green_or_pink() << "(" << param<'s'>() << ")" << c::normal();
-
-const auto fs_format_conditional_dep_spec_masked = make_format_string_fetcher("format-conditional-dep-spec/masked", 1)
- << c::red() << "(" << param<'s'>() << ")" << c::normal();
-
-const auto fs_format_plain_text_dep_spec_plain = make_format_string_fetcher("format-plain-text-dep-spec/plain", 1)
- << param<'s'>();
-
-const auto fs_format_simple_uri_dep_spec_plain = make_format_string_fetcher("format-simple-uri-dep-spec/plain", 1)
- << param<'s'>();
-
-const auto fs_format_fetchable_uri_dep_spec_plain = make_format_string_fetcher("format-fetchable-uri-dep-spec/plain", 1)
- << param<'s'>();
-
-const auto fs_format_uri_labels_dep_spec_plain = make_format_string_fetcher("format-uri-labels-dep-spec/plain", 1)
- << param<'s'>();
-
-const auto fs_format_package_dep_spec_plain = make_format_string_fetcher("format-package-dep-spec/plain", 1)
- << param<'s'>();
-
-const auto fs_format_package_dep_spec_installed = make_format_string_fetcher("format-package-dep-spec/installed", 1)
- << c::bold_green_or_pink() << param<'s'>() << c::normal();
-
-const auto fs_format_package_dep_spec_installable = make_format_string_fetcher("format-package-dep-spec/installable", 1)
- << c::green_or_pink() << param<'s'>() << c::normal();
-
-const auto fs_format_dependency_labels_dep_spec_plain = make_format_string_fetcher("format-dependency-labels-dep-spec/plain", 1)
- << param<'s'>();
-
-const auto fs_format_block_dep_spec_plain = make_format_string_fetcher("format-block-dep-spec/plain", 1)
- << param<'s'>();
-
-const auto fs_format_named_set_dep_spec_plain = make_format_string_fetcher("format-named-set-dep-spec/plain", 1)
- << c::blue_or_pink() << param<'s'>() << c::normal();
-
-const auto fs_format_fsentry_plain = make_format_string_fetcher("format-fsentry/plain", 1)
- << param<'s'>();
-
-const auto fs_format_indent = make_format_string_fetcher("format/indent", 1)
- << "%{column 30}" << param<'i'>() << param<'i'>() << param<'i'>() << param<'i'>();
-
diff --git a/src/clients/cave/colour_formatter.cc b/src/clients/cave/colour_formatter.cc
deleted file mode 100644
index 4da25e1..0000000
--- a/src/clients/cave/colour_formatter.cc
+++ /dev/null
@@ -1,279 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 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
- */
-
-#include "colour_formatter.hh"
-#include "colours.hh"
-#include "format_user_config.hh"
-#include <paludis/util/stringify.hh>
-#include <paludis/name.hh>
-#include <paludis/choice.hh>
-
-using namespace paludis;
-using namespace cave;
-
-ColourFormatter::ColourFormatter(const int initial_indent) :
- _initial_indent(initial_indent)
-{
-}
-
-namespace
-{
-#include "colour_formatter-fmt.hh"
-}
-
-std::string
-ColourFormatter::format(const paludis::ChoiceValue & s, const paludis::format::Plain &) const
-{
- return fuc(fs_format_choice_value_plain(), fv<'s'>(stringify(s.name_with_prefix())));
-}
-
-std::string
-ColourFormatter::format(const paludis::ChoiceValue & s, const paludis::format::Enabled &) const
-{
- return fuc(fs_format_choice_value_enabled(),
- fv<'k'>(stringify(s.unprefixed_name())),
- fv<'v'>(s.parameter().empty() ? "" : "=" + s.parameter()));
-}
-
-std::string
-ColourFormatter::format(const paludis::ChoiceValue & s, const paludis::format::Disabled &) const
-{
- return fuc(fs_format_choice_value_disabled(), fv<'s'>(stringify(s.unprefixed_name())));
-}
-
-std::string
-ColourFormatter::format(const paludis::ChoiceValue & s, const paludis::format::Forced &) const
-{
- return fuc(fs_format_choice_value_forced(),
- fv<'k'>(stringify(s.unprefixed_name())),
- fv<'v'>(s.parameter().empty() ? "" : "=" + s.parameter()));
-}
-
-std::string
-ColourFormatter::format(const paludis::ChoiceValue & s, const paludis::format::Masked &) const
-{
- return fuc(fs_format_choice_value_masked(), fv<'s'>(stringify(s.unprefixed_name())));
-}
-
-std::string
-ColourFormatter::decorate(const paludis::ChoiceValue &, const std::string & f, const paludis::format::Added &) const
-{
- return f + "+";
-}
-
-std::string
-ColourFormatter::decorate(const paludis::ChoiceValue &, const std::string & f, const paludis::format::Changed &) const
-{
- return f + "*";
-}
-
-std::string
-ColourFormatter::format(const KeywordName & s, const format::Plain &) const
-{
- return fuc(fs_format_keyword_name_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const KeywordName & s, const format::Accepted &) const
-{
- return fuc(fs_format_keyword_name_accepted(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const KeywordName & s, const format::Unaccepted &) const
-{
- return fuc(fs_format_keyword_name_unaccepted(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const std::string & s, const format::Plain &) const
-{
- return fuc(fs_format_string_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const std::pair<const std::string, std::string> & s, const format::Plain &) const
-{
- return fuc(fs_format_string_string_plain(), fv<'k'>(stringify(s.first)), fv<'v'>(stringify(s.second)),
- fv<'e'>(s.first.empty() ? "" : "="));
-}
-
-std::string
-ColourFormatter::format(const PackageID & s, const format::Plain &) const
-{
- return fuc(fs_format_package_id_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const PackageID & s, const format::Installed &) const
-{
- return fuc(fs_format_package_id_installed(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const PackageID & s, const format::Installable &) const
-{
- return fuc(fs_format_package_id_installable(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const LicenseDepSpec & s, const format::Plain &) const
-{
- return fuc(fs_format_license_dep_spec_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const LicenseDepSpec & s, const format::Accepted &) const
-{
- return fuc(fs_format_license_dep_spec_accepted(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const LicenseDepSpec & s, const format::Unaccepted &) const
-{
- return fuc(fs_format_license_dep_spec_unaccepted(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & s, const format::Plain &) const
-{
- return fuc(fs_format_conditional_dep_spec_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & s, const format::Enabled &) const
-{
- return fuc(fs_format_conditional_dep_spec_enabled(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & s, const format::Disabled &) const
-{
- return fuc(fs_format_conditional_dep_spec_disabled(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & s, const format::Forced &) const
-{
- return fuc(fs_format_conditional_dep_spec_forced(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & s, const format::Masked &) const
-{
- return fuc(fs_format_conditional_dep_spec_masked(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::decorate(const ConditionalDepSpec &, const std::string & s, const format::Added &) const
-{
- return s;
-}
-
-std::string
-ColourFormatter::decorate(const ConditionalDepSpec &, const std::string & s, const format::Changed &) const
-{
- return s;
-}
-
-std::string
-ColourFormatter::format(const PlainTextDepSpec & s, const format::Plain &) const
-{
- return fuc(fs_format_plain_text_dep_spec_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const SimpleURIDepSpec & s, const format::Plain &) const
-{
- return fuc(fs_format_simple_uri_dep_spec_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const FetchableURIDepSpec & s, const format::Plain &) const
-{
- return fuc(fs_format_fetchable_uri_dep_spec_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const URILabelsDepSpec & s, const format::Plain &) const
-{
- return fuc(fs_format_uri_labels_dep_spec_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const PlainTextLabelDepSpec & s, const format::Plain &) const
-{
- return fuc(fs_format_uri_labels_dep_spec_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const PackageDepSpec & s, const format::Plain &) const
-{
- return fuc(fs_format_package_dep_spec_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const PackageDepSpec & s, const format::Installed &) const
-{
- return fuc(fs_format_package_dep_spec_installed(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const PackageDepSpec & s, const format::Installable &) const
-{
- return fuc(fs_format_package_dep_spec_installable(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const DependenciesLabelsDepSpec & s, const format::Plain &) const
-{
- return fuc(fs_format_dependency_labels_dep_spec_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const BlockDepSpec & s, const format::Plain &) const
-{
- return fuc(fs_format_block_dep_spec_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::format(const NamedSetDepSpec & s, const format::Plain &) const
-{
- return fuc(fs_format_named_set_dep_spec_plain(), fv<'s'>(stringify(s)));
-}
-
-
-std::string
-ColourFormatter::format(const FSPath & s, const format::Plain &) const
-{
- return fuc(fs_format_fsentry_plain(), fv<'s'>(stringify(s)));
-}
-
-std::string
-ColourFormatter::newline() const
-{
- return "\n";
-}
-
-std::string
-ColourFormatter::indent(const int i) const
-{
- return fuc(fs_format_indent(), fv<'i'>(std::string(i, ' ')));
-}
-
diff --git a/src/clients/cave/colour_formatter.hh b/src/clients/cave/colour_formatter.hh
deleted file mode 100644
index 17b548a..0000000
--- a/src/clients/cave/colour_formatter.hh
+++ /dev/null
@@ -1,117 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 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_SRC_CLIENTS_CAVE_COLOUR_FORMATTER_HH
-#define PALUDIS_GUARD_SRC_CLIENTS_CAVE_COLOUR_FORMATTER_HH 1
-
-#include <paludis/util/attributes.hh>
-#include <paludis/util/fs_path-fwd.hh>
-#include <paludis/formatter.hh>
-
-namespace paludis
-{
- namespace cave
- {
- class PALUDIS_VISIBLE ColourFormatter :
- public CanFormat<KeywordName>,
- public CanFormat<std::string>,
- public CanFormat<std::pair<const std::string, std::string> >,
- public CanFormat<PackageID>,
- public CanFormat<LicenseDepSpec>,
- public CanFormat<ConditionalDepSpec>,
- public CanFormat<PlainTextDepSpec>,
- public CanFormat<SimpleURIDepSpec>,
- public CanFormat<FetchableURIDepSpec>,
- public CanFormat<URILabelsDepSpec>,
- public CanFormat<PackageDepSpec>,
- public CanFormat<DependenciesLabelsDepSpec>,
- public CanFormat<BlockDepSpec>,
- public CanFormat<NamedSetDepSpec>,
- public CanFormat<PlainTextLabelDepSpec>,
- public CanFormat<ChoiceValue>,
- public CanFormat<FSPath>,
- public CanSpace
- {
- private:
- const int _initial_indent;
-
- public:
- ColourFormatter(const int initial_indent);
-
- std::string format(const ChoiceValue &, const format::Plain &) const;
- std::string format(const ChoiceValue &, const format::Enabled &) const;
- std::string format(const ChoiceValue &, const format::Disabled &) const;
- std::string format(const ChoiceValue &, const format::Forced &) const;
- std::string format(const ChoiceValue &, const format::Masked &) const;
- std::string decorate(const ChoiceValue &, const std::string &, const format::Added &) const;
- std::string decorate(const ChoiceValue &, const std::string &, const format::Changed &) const;
-
- std::string format(const KeywordName &, const format::Plain &) const;
- std::string format(const KeywordName &, const format::Accepted &) const;
- std::string format(const KeywordName &, const format::Unaccepted &) const;
-
- std::string format(const std::string &, const format::Plain &) const;
-
- std::string format(const std::pair<const std::string, std::string> &, const format::Plain &) const;
-
- std::string format(const PackageID &, const format::Plain &) const;
- std::string format(const PackageID &, const format::Installed &) const;
- std::string format(const PackageID &, const format::Installable &) const;
-
- std::string format(const LicenseDepSpec &, const format::Plain &) const;
- std::string format(const LicenseDepSpec &, const format::Accepted &) const;
- std::string format(const LicenseDepSpec &, const format::Unaccepted &) const;
-
- std::string format(const ConditionalDepSpec &, const format::Plain &) const;
- std::string format(const ConditionalDepSpec &, const format::Enabled &) const;
- std::string format(const ConditionalDepSpec &, const format::Disabled &) const;
- std::string format(const ConditionalDepSpec &, const format::Forced &) const;
- std::string format(const ConditionalDepSpec &, const format::Masked &) const;
- std::string decorate(const ConditionalDepSpec &, const std::string &, const format::Added &) const;
- std::string decorate(const ConditionalDepSpec &, const std::string &, const format::Changed &) const;
-
- std::string format(const PlainTextDepSpec &, const format::Plain &) const;
-
- std::string format(const SimpleURIDepSpec &, const format::Plain &) const;
-
- std::string format(const FetchableURIDepSpec &, const format::Plain &) const;
-
- std::string format(const URILabelsDepSpec &, const format::Plain &) const;
-
- std::string format(const PlainTextLabelDepSpec &, const format::Plain &) const;
-
- std::string format(const PackageDepSpec &, const format::Plain &) const;
- std::string format(const PackageDepSpec &, const format::Installed &) const;
- std::string format(const PackageDepSpec &, const format::Installable &) const;
-
- std::string format(const DependenciesLabelsDepSpec &, const format::Plain &) const;
-
- std::string format(const BlockDepSpec &, const format::Plain &) const;
-
- std::string format(const NamedSetDepSpec &, const format::Plain &) const;
-
- std::string format(const FSPath &, const format::Plain &) const;
-
- std::string newline() const;
- std::string indent(const int) const;
- };
- }
-}
-
-#endif
diff --git a/src/clients/cave/format_plain_metadata_key.cc b/src/clients/cave/format_plain_metadata_key.cc
index c33f6a5..5897710 100644
--- a/src/clients/cave/format_plain_metadata_key.cc
+++ b/src/clients/cave/format_plain_metadata_key.cc
@@ -25,10 +25,10 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/map.hh>
#include <paludis/util/timestamp.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/metadata_key.hh>
#include <paludis/mask.hh>
#include <paludis/unformatted_pretty_printer.hh>
+#include <paludis/name.hh>
#include <sstream>
using namespace paludis;
diff --git a/src/clients/importare/importare.cc b/src/clients/importare/importare.cc
index bfab581..a831e31 100644
--- a/src/clients/importare/importare.cc
+++ b/src/clients/importare/importare.cc
@@ -33,7 +33,6 @@
#include <paludis/repository_factory.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/generator.hh>
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index 2038669..6254427 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -29,7 +29,6 @@
#include <paludis/util/accept_visitor.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/stringify_formatter.hh>
#include <paludis/dep_spec.hh>
#include <paludis/environment.hh>
#include <paludis/choice.hh>
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index c14aef6..94d37b9 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -20,7 +20,6 @@
#include "info.hh"
#include "command_line.hh"
#include "src/output/colour.hh"
-#include "src/output/colour_formatter.hh"
#include "src/output/colour_pretty_printer.hh"
#include <paludis/about.hh>
#include <paludis/user_dep_spec.hh>
diff --git a/src/output/Makefile.am b/src/output/Makefile.am
index cae2bae..dfecb07 100644
--- a/src/output/Makefile.am
+++ b/src/output/Makefile.am
@@ -6,7 +6,6 @@ AUTOMAKE_OPTIONS = 1.11 parallel-tests
noinst_LIBRARIES = liboutput.a
liboutput_a_SOURCES = \
colour.cc colour.hh \
- colour_formatter.cc colour_formatter.hh \
colour_pretty_printer.cc colour_pretty_printer.hh \
console_task.cc console_task.hh \
console_install_task.cc console_install_task.hh \
diff --git a/src/output/colour_formatter.cc b/src/output/colour_formatter.cc
deleted file mode 100644
index 0f0aa3e..0000000
--- a/src/output/colour_formatter.cc
+++ /dev/null
@@ -1,268 +0,0 @@
-/* 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
- */
-
-#include "colour_formatter.hh"
-#include "colour.hh"
-#include <paludis/util/stringify.hh>
-#include <paludis/util/set.hh>
-#include <paludis/name.hh>
-#include <paludis/choice.hh>
-
-using namespace paludis;
-
-std::string
-ColourFormatter::format(const ChoiceValue & f, const format::Plain &) const
-{
- return stringify(f.name_with_prefix());
-}
-
-std::string
-ColourFormatter::format(const ChoiceValue & f, const format::Enabled &) const
-{
- std::string s(colour(cl_flag_on, stringify(f.unprefixed_name())));
- if (! f.parameter().empty())
- s.append("=" + f.parameter());
- return s;
-}
-
-std::string
-ColourFormatter::format(const ChoiceValue & f, const format::Disabled &) const
-{
- return colour(cl_flag_off, "-" + stringify(f.unprefixed_name()));
-}
-
-std::string
-ColourFormatter::format(const ChoiceValue & f, const format::Forced &) const
-{
- std::string s(colour(cl_flag_on, "(" + stringify(f.unprefixed_name())));
- if (! f.parameter().empty())
- s.append("=" + f.parameter());
- return s + colour(cl_flag_on, ")");
-}
-
-std::string
-ColourFormatter::format(const ChoiceValue & f, const format::Masked &) const
-{
- return colour(cl_flag_off, "(-" + stringify(f.unprefixed_name()) + ")");
-}
-
-std::string
-ColourFormatter::decorate(const ChoiceValue &, const std::string & f, const format::Added &) const
-{
- return f + "+";
-}
-
-std::string
-ColourFormatter::decorate(const ChoiceValue &, const std::string & f, const format::Changed &) const
-{
- return f + "*";
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & f, const format::Enabled &) const
-{
- return colour(cl_flag_on, f);
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & f, const format::Disabled &) const
-{
- return colour(cl_flag_off, f);
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & f, const format::Forced &) const
-{
- return colour(cl_flag_on, "(" + stringify(f) + ")");
-}
-
-std::string
-ColourFormatter::format(const ConditionalDepSpec & f, const format::Masked &) const
-{
- return colour(cl_flag_off, "(" + stringify(f) + ")");
-}
-
-std::string
-ColourFormatter::decorate(const ConditionalDepSpec &, const std::string & f, const format::Added &) const
-{
- return f;
-}
-
-std::string
-ColourFormatter::decorate(const ConditionalDepSpec &, const std::string & f, const format::Changed &) const
-{
- return f;
-}
-
-std::string
-ColourFormatter::format(const PackageDepSpec & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const PackageDepSpec & f, const format::Installed &) const
-{
- return colour(cl_package_name, f);
-}
-
-std::string
-ColourFormatter::format(const PackageDepSpec & f, const format::Installable &) const
-{
- return colour(cl_installable_package_name, f);
-}
-
-std::string
-ColourFormatter::format(const PlainTextDepSpec & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const LicenseDepSpec & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const LicenseDepSpec & f, const format::Accepted &) const
-{
- return colour(cl_flag_on, f);
-}
-
-std::string
-ColourFormatter::format(const LicenseDepSpec & f, const format::Unaccepted &) const
-{
- return colour(cl_flag_off, f);
-}
-
-std::string
-ColourFormatter::format(const KeywordName & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const KeywordName & f, const format::Accepted &) const
-{
- return colour(cl_flag_on, f);
-}
-
-std::string
-ColourFormatter::format(const KeywordName & f, const format::Unaccepted &) const
-{
- return colour(cl_flag_off, f);
-}
-
-std::string
-ColourFormatter::format(const std::string & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const std::pair<const std::string, std::string> & f, const format::Plain &) const
-{
- return stringify(f.first) + "=" + stringify(f.second);
-}
-
-std::string
-ColourFormatter::format(const PlainTextLabelDepSpec & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const URILabelsDepSpec & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const NamedSetDepSpec & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const DependenciesLabelsDepSpec & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const FetchableURIDepSpec & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const SimpleURIDepSpec & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const BlockDepSpec & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const PackageID & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::format(const PackageID & f, const format::Installed &) const
-{
- return colour(cl_package_name, f);
-}
-
-std::string
-ColourFormatter::format(const PackageID & f, const format::Installable &) const
-{
- return colour(cl_installable_package_name, f);
-}
-
-std::string
-ColourFormatter::format(const FSPath & f, const format::Plain &) const
-{
- return stringify(f);
-}
-
-std::string
-ColourFormatter::newline() const
-{
- return "\n";
-}
-
-std::string
-ColourFormatter::indent(const int i) const
-{
- return std::string(12 + (4 * i), ' ');
-}
-
diff --git a/src/output/colour_formatter.hh b/src/output/colour_formatter.hh
deleted file mode 100644
index 5de2b6d..0000000
--- a/src/output/colour_formatter.hh
+++ /dev/null
@@ -1,107 +0,0 @@
-/* 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_SRC_OUTPUT_COLOUR_FORMATTER_HH
-#define PALUDIS_GUARD_SRC_OUTPUT_COLOUR_FORMATTER_HH 1
-
-#include <paludis/formatter.hh>
-#include <paludis/name-fwd.hh>
-#include <paludis/dep_spec-fwd.hh>
-#include <paludis/util/fs_path-fwd.hh>
-
-class ColourFormatter :
- public paludis::CanFormat<paludis::ChoiceValue>,
- public paludis::CanFormat<paludis::KeywordName>,
- public paludis::CanFormat<paludis::ConditionalDepSpec>,
- public paludis::CanFormat<paludis::PackageDepSpec>,
- public paludis::CanFormat<paludis::BlockDepSpec>,
- public paludis::CanFormat<paludis::DependenciesLabelsDepSpec>,
- public paludis::CanFormat<paludis::URILabelsDepSpec>,
- public paludis::CanFormat<paludis::PlainTextDepSpec>,
- public paludis::CanFormat<paludis::SimpleURIDepSpec>,
- public paludis::CanFormat<paludis::PlainTextLabelDepSpec>,
- public paludis::CanFormat<paludis::FetchableURIDepSpec>,
- public paludis::CanFormat<paludis::LicenseDepSpec>,
- public paludis::CanFormat<paludis::NamedSetDepSpec>,
- public paludis::CanFormat<paludis::FSPath>,
- public paludis::CanFormat<paludis::PackageID>,
- public paludis::CanFormat<std::string>,
- public paludis::CanFormat<std::pair<const std::string, std::string> >,
- public paludis::CanSpace
-{
- public:
- std::string format(const paludis::ChoiceValue &, const paludis::format::Plain &) const;
- std::string format(const paludis::ChoiceValue &, const paludis::format::Enabled &) const;
- std::string format(const paludis::ChoiceValue &, const paludis::format::Disabled &) const;
- std::string format(const paludis::ChoiceValue &, const paludis::format::Forced &) const;
- std::string format(const paludis::ChoiceValue &, const paludis::format::Masked &) const;
- std::string decorate(const paludis::ChoiceValue &, const std::string &, const paludis::format::Added &) const;
- std::string decorate(const paludis::ChoiceValue &, const std::string &, const paludis::format::Changed &) const;
-
- std::string format(const paludis::ConditionalDepSpec &, const paludis::format::Plain &) const;
- std::string format(const paludis::ConditionalDepSpec &, const paludis::format::Enabled &) const;
- std::string format(const paludis::ConditionalDepSpec &, const paludis::format::Disabled &) const;
- std::string format(const paludis::ConditionalDepSpec &, const paludis::format::Forced &) const;
- std::string format(const paludis::ConditionalDepSpec &, const paludis::format::Masked &) const;
- std::string decorate(const paludis::ConditionalDepSpec &, const std::string &, const paludis::format::Added &) const;
- std::string decorate(const paludis::ConditionalDepSpec &, const std::string &, const paludis::format::Changed &) const;
-
- std::string format(const paludis::PackageDepSpec &, const paludis::format::Plain &) const;
- std::string format(const paludis::PackageDepSpec &, const paludis::format::Installed &) const;
- std::string format(const paludis::PackageDepSpec &, const paludis::format::Installable &) const;
-
- std::string format(const paludis::PlainTextDepSpec &, const paludis::format::Plain &) const;
-
- std::string format(const paludis::LicenseDepSpec &, const paludis::format::Plain &) const;
- std::string format(const paludis::LicenseDepSpec &, const paludis::format::Accepted &) const;
- std::string format(const paludis::LicenseDepSpec &, const paludis::format::Unaccepted &) const;
-
- std::string format(const paludis::KeywordName &, const paludis::format::Plain &) const;
- std::string format(const paludis::KeywordName &, const paludis::format::Accepted &) const;
- std::string format(const paludis::KeywordName &, const paludis::format::Unaccepted &) const;
-
- std::string format(const std::string &, const paludis::format::Plain &) const;
-
- std::string format(const std::pair<const std::string, std::string> &, const paludis::format::Plain &) const;
-
- std::string format(const paludis::PlainTextLabelDepSpec &, const paludis::format::Plain &) const;
-
- std::string format(const paludis::URILabelsDepSpec &, const paludis::format::Plain &) const;
-
- std::string format(const paludis::DependenciesLabelsDepSpec &, const paludis::format::Plain &) const;
-
- std::string format(const paludis::FetchableURIDepSpec &, const paludis::format::Plain &) const;
-
- std::string format(const paludis::SimpleURIDepSpec &, const paludis::format::Plain &) const;
-
- std::string format(const paludis::NamedSetDepSpec &, const paludis::format::Plain &) const;
-
- std::string format(const paludis::BlockDepSpec &, const paludis::format::Plain &) const;
-
- std::string format(const paludis::FSPath &, const paludis::format::Plain &) const;
-
- std::string format(const paludis::PackageID &, const paludis::format::Plain &) const;
- std::string format(const paludis::PackageID &, const paludis::format::Installed &) const;
- std::string format(const paludis::PackageID &, const paludis::format::Installable &) const;
-
- std::string newline() const;
- std::string indent(const int) const;
-};
-
-#endif
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 7a3956e..fdcbea2 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -19,7 +19,7 @@
#include "console_install_task.hh"
#include "colour.hh"
-#include "colour_formatter.hh"
+#include "colour_pretty_printer.hh"
#include "mask_displayer.hh"
#include <paludis/util/indirect_iterator-impl.hh>
@@ -1149,7 +1149,8 @@ ConsoleInstallTask::display_merge_list_entry_choices(const DepListEntry & d,
if (old_id && old_id->choices_key())
old_choices = old_id->choices_key()->value();
- ColourFormatter formatter;
+ ColourPrettyPrinter printer(environment(), d.package_id());
+
std::string s;
bool non_blank_prefix(false);
for (Choices::ConstIterator k(d.package_id()->choices_key()->value()->begin()),
@@ -1180,21 +1181,7 @@ ConsoleInstallTask::display_merge_list_entry_choices(const DepListEntry & d,
if (! s.empty())
s.append(" ");
- std::string t;
- if ((*i)->enabled())
- {
- if ((*i)->locked())
- t = formatter.format(**i, format::Forced());
- else
- t = formatter.format(**i, format::Enabled());
- }
- else
- {
- if ((*i)->locked())
- t = formatter.format(**i, format::Masked());
- else
- t = formatter.format(**i, format::Disabled());
- }
+ std::string t(printer.prettify(*i));
bool changed(false), added(false);
if ((*k)->consider_added_or_changed())
@@ -1213,14 +1200,14 @@ ConsoleInstallTask::display_merge_list_entry_choices(const DepListEntry & d,
if (changed)
{
- t = formatter.decorate(**i, t, format::Changed());
+ t = t + "*";
if (want_changed_use_flags())
_choice_descriptions[(*k)->human_name()][(*i)->name_with_prefix()].push_back(d.package_id());
}
else if (added)
{
if (old_id)
- t = formatter.decorate(**i, t, format::Added());
+ t = t + "*";
if (want_new_use_flags())
_choice_descriptions[(*k)->human_name()][(*i)->name_with_prefix()].push_back(d.package_id());
}
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 88e0912..cbd7628 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -19,7 +19,6 @@
#include "console_query_task.hh"
#include "mask_displayer.hh"
-#include "colour_formatter.hh"
#include "colour_pretty_printer.hh"
#include <paludis/util/tokeniser.hh>
#include <paludis/util/pimp-impl.hh>