aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-10-06 16:50:24 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-10-06 16:50:24 +0100
commit7c2b05ee03028e238bdad4e1ab909f334bd4f064 (patch)
treec81db91e4032866cf996f07e46f1af07fe0257ba
parentb74119e81ebe65834dcf0cb2f67e7a764743bf30 (diff)
downloadpaludis-7c2b05ee03028e238bdad4e1ab909f334bd4f064.tar.gz
paludis-7c2b05ee03028e238bdad4e1ab909f334bd4f064.tar.xz
move serialise to paludis/
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/resolver/Makefile.am2
-rw-r--r--paludis/resolver/arrow.cc2
-rw-r--r--paludis/resolver/arrow.hh2
-rw-r--r--paludis/resolver/constraint.cc2
-rw-r--r--paludis/resolver/constraint.hh2
-rw-r--r--paludis/resolver/decision.cc2
-rw-r--r--paludis/resolver/decision.hh2
-rw-r--r--paludis/resolver/destination.cc2
-rw-r--r--paludis/resolver/destination.hh2
-rw-r--r--paludis/resolver/reason.cc2
-rw-r--r--paludis/resolver/reason.hh2
-rw-r--r--paludis/resolver/resolution-fwd.hh1
-rw-r--r--paludis/resolver/resolution.cc2
-rw-r--r--paludis/resolver/resolutions-fwd.hh2
-rw-r--r--paludis/resolver/resolutions.cc2
-rw-r--r--paludis/resolver/resolvent.cc2
-rw-r--r--paludis/resolver/resolvent.hh2
-rw-r--r--paludis/resolver/resolver.cc2
-rw-r--r--paludis/resolver/resolver_TEST_serialisation.cc2
-rw-r--r--paludis/resolver/sanitised_dependencies.cc2
-rw-r--r--paludis/resolver/sanitised_dependencies.hh2
-rw-r--r--paludis/resolver/serialise-impl.hh283
-rw-r--r--paludis/resolver/serialise.hh162
-rw-r--r--paludis/resolver/unsuitable_candidates.cc2
-rw-r--r--paludis/resolver/unsuitable_candidates.hh2
-rw-r--r--paludis/serialise-fwd.hh (renamed from paludis/resolver/serialise-fwd.hh)13
-rw-r--r--paludis/serialise-impl.hh280
-rw-r--r--paludis/serialise.cc (renamed from paludis/resolver/serialise.cc)8
-rw-r--r--paludis/serialise.hh159
-rw-r--r--src/clients/cave/cmd_display_resolution.cc2
-rw-r--r--src/clients/cave/cmd_execute_resolution.cc2
-rw-r--r--src/clients/cave/cmd_resolve.cc2
33 files changed, 472 insertions, 485 deletions
diff --git a/paludis/files.m4 b/paludis/files.m4
index a306954..2515358 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -75,6 +75,7 @@ add(`repository_factory', `hh', `fwd', `cc')
add(`repository_name_cache', `hh', `cc', `test', `testscript')
add(`selection', `hh', `cc', `fwd', `test')
add(`selection_handler', `hh', `cc', `fwd')
+add(`serialise', `hh', `cc', `fwd', `impl')
add(`set_file', `hh', `cc', `se', `test', `testscript')
add(`show_suggest_visitor', `hh', `cc')
add(`slot_requirement', `hh', `fwd', `cc')
diff --git a/paludis/resolver/Makefile.am b/paludis/resolver/Makefile.am
index a6e9319..61625dc 100644
--- a/paludis/resolver/Makefile.am
+++ b/paludis/resolver/Makefile.am
@@ -25,7 +25,6 @@ noinst_HEADERS = \
resolver.hh resolver-fwd.hh \
resolver_functions.hh resolver_functions-fwd.hh \
sanitised_dependencies.hh sanitised_dependencies-fwd.hh \
- serialise.hh serialise-fwd.hh serialise-impl.hh \
suggest_restart.hh suggest_restart-fwd.hh \
unsuitable_candidates.hh unsuitable_candidates-fwd.hh \
use_existing.hh use_existing-fwd.hh use_existing-se.hh
@@ -42,7 +41,6 @@ libpaludisresolver_a_SOURCES = \
resolvent.cc \
resolver.cc \
sanitised_dependencies.cc \
- serialise.cc \
suggest_restart.cc \
unsuitable_candidates.cc \
use_existing.cc
diff --git a/paludis/resolver/arrow.cc b/paludis/resolver/arrow.cc
index 240c353..da04241 100644
--- a/paludis/resolver/arrow.cc
+++ b/paludis/resolver/arrow.cc
@@ -18,11 +18,11 @@
*/
#include <paludis/resolver/arrow.hh>
-#include <paludis/resolver/serialise-impl.hh>
#include <paludis/resolver/reason.hh>
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/serialise-impl.hh>
using namespace paludis;
using namespace paludis::resolver;
diff --git a/paludis/resolver/arrow.hh b/paludis/resolver/arrow.hh
index b79cea1..a55aa69 100644
--- a/paludis/resolver/arrow.hh
+++ b/paludis/resolver/arrow.hh
@@ -22,8 +22,8 @@
#include <paludis/resolver/arrow-fwd.hh>
#include <paludis/resolver/resolvent.hh>
-#include <paludis/resolver/serialise-fwd.hh>
#include <paludis/resolver/reason-fwd.hh>
+#include <paludis/serialise-fwd.hh>
#include <paludis/util/named_value.hh>
namespace paludis
diff --git a/paludis/resolver/constraint.cc b/paludis/resolver/constraint.cc
index 13c96bf..ed99cd9 100644
--- a/paludis/resolver/constraint.cc
+++ b/paludis/resolver/constraint.cc
@@ -19,12 +19,12 @@
#include <paludis/resolver/constraint.hh>
#include <paludis/resolver/reason.hh>
-#include <paludis/resolver/serialise-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/serialise-impl.hh>
#include <algorithm>
#include <sstream>
#include <vector>
diff --git a/paludis/resolver/constraint.hh b/paludis/resolver/constraint.hh
index f5a62a4..fa5d44a 100644
--- a/paludis/resolver/constraint.hh
+++ b/paludis/resolver/constraint.hh
@@ -24,11 +24,11 @@
#include <paludis/resolver/reason-fwd.hh>
#include <paludis/resolver/use_existing-fwd.hh>
#include <paludis/resolver/sanitised_dependencies.hh>
-#include <paludis/resolver/serialise-fwd.hh>
#include <paludis/resolver/destination_types-fwd.hh>
#include <paludis/util/named_value.hh>
#include <paludis/util/options.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/serialise-fwd.hh>
#include <tr1/memory>
namespace paludis
diff --git a/paludis/resolver/decision.cc b/paludis/resolver/decision.cc
index f4bfdd5..97e8c3e 100644
--- a/paludis/resolver/decision.cc
+++ b/paludis/resolver/decision.cc
@@ -18,7 +18,6 @@
*/
#include <paludis/resolver/decision.hh>
-#include <paludis/resolver/serialise-impl.hh>
#include <paludis/resolver/destination.hh>
#include <paludis/resolver/unsuitable_candidates.hh>
#include <paludis/util/make_named_values.hh>
@@ -26,6 +25,7 @@
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/serialise-impl.hh>
#include <sstream>
using namespace paludis;
diff --git a/paludis/resolver/decision.hh b/paludis/resolver/decision.hh
index c15f299..30b0443 100644
--- a/paludis/resolver/decision.hh
+++ b/paludis/resolver/decision.hh
@@ -21,12 +21,12 @@
#define PALUDIS_GUARD_PALUDIS_RESOLVER_DECISION_HH 1
#include <paludis/resolver/decision-fwd.hh>
-#include <paludis/resolver/serialise-fwd.hh>
#include <paludis/resolver/destination-fwd.hh>
#include <paludis/resolver/unsuitable_candidates-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/simple_visitor.hh>
#include <paludis/util/type_list.hh>
+#include <paludis/serialise-fwd.hh>
#include <paludis/package_id.hh>
namespace paludis
diff --git a/paludis/resolver/destination.cc b/paludis/resolver/destination.cc
index 5aa0254..db958b2 100644
--- a/paludis/resolver/destination.cc
+++ b/paludis/resolver/destination.cc
@@ -18,12 +18,12 @@
*/
#include <paludis/resolver/destination.hh>
-#include <paludis/resolver/serialise-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/serialise-impl.hh>
using namespace paludis;
using namespace paludis::resolver;
diff --git a/paludis/resolver/destination.hh b/paludis/resolver/destination.hh
index db58df4..de41013 100644
--- a/paludis/resolver/destination.hh
+++ b/paludis/resolver/destination.hh
@@ -21,7 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_RESOLVER_DESTINATION_HH 1
#include <paludis/resolver/destination-fwd.hh>
-#include <paludis/resolver/serialise-fwd.hh>
+#include <paludis/serialise-fwd.hh>
#include <paludis/util/attributes.hh>
#include <paludis/name.hh>
#include <paludis/package_id-fwd.hh>
diff --git a/paludis/resolver/reason.cc b/paludis/resolver/reason.cc
index 3333347..eafef9c 100644
--- a/paludis/resolver/reason.cc
+++ b/paludis/resolver/reason.cc
@@ -20,9 +20,9 @@
#include <paludis/resolver/reason.hh>
#include <paludis/resolver/resolvent.hh>
#include <paludis/resolver/sanitised_dependencies.hh>
-#include <paludis/resolver/serialise-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/serialise-impl.hh>
using namespace paludis;
using namespace paludis::resolver;
diff --git a/paludis/resolver/reason.hh b/paludis/resolver/reason.hh
index dba4c4a..2fcda3c 100644
--- a/paludis/resolver/reason.hh
+++ b/paludis/resolver/reason.hh
@@ -23,12 +23,12 @@
#include <paludis/resolver/reason-fwd.hh>
#include <paludis/resolver/resolvent-fwd.hh>
#include <paludis/resolver/sanitised_dependencies-fwd.hh>
-#include <paludis/resolver/serialise-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/simple_visitor.hh>
#include <paludis/util/type_list.hh>
#include <paludis/name-fwd.hh>
#include <paludis/package_id-fwd.hh>
+#include <paludis/serialise-fwd.hh>
#include <tr1/memory>
namespace paludis
diff --git a/paludis/resolver/resolution-fwd.hh b/paludis/resolver/resolution-fwd.hh
index 020d513..7b73713 100644
--- a/paludis/resolver/resolution-fwd.hh
+++ b/paludis/resolver/resolution-fwd.hh
@@ -21,7 +21,6 @@
#define PALUDIS_GUARD_PALUDIS_RESOLVER_RESOLUTION_FWD_HH 1
#include <paludis/util/attributes.hh>
-#include <paludis/resolver/serialise-fwd.hh>
namespace paludis
{
diff --git a/paludis/resolver/resolution.cc b/paludis/resolver/resolution.cc
index a3841c0..c7a524c 100644
--- a/paludis/resolver/resolution.cc
+++ b/paludis/resolver/resolution.cc
@@ -21,13 +21,13 @@
#include <paludis/resolver/constraint.hh>
#include <paludis/resolver/arrow.hh>
#include <paludis/resolver/decision.hh>
-#include <paludis/resolver/serialise-impl.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/join.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/serialise-impl.hh>
#include <sstream>
using namespace paludis;
diff --git a/paludis/resolver/resolutions-fwd.hh b/paludis/resolver/resolutions-fwd.hh
index 715c1d1..506dfaa 100644
--- a/paludis/resolver/resolutions-fwd.hh
+++ b/paludis/resolver/resolutions-fwd.hh
@@ -21,7 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_RESOLVER_RESOLUTIONS_FWD_HH 1
#include <paludis/util/attributes.hh>
-#include <paludis/resolver/serialise-fwd.hh>
+#include <paludis/serialise-fwd.hh>
namespace paludis
{
diff --git a/paludis/resolver/resolutions.cc b/paludis/resolver/resolutions.cc
index 80a8f63..4f3b5fb 100644
--- a/paludis/resolver/resolutions.cc
+++ b/paludis/resolver/resolutions.cc
@@ -19,12 +19,12 @@
#include <paludis/resolver/resolutions.hh>
#include <paludis/resolver/resolution.hh>
-#include <paludis/resolver/serialise-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/serialise-impl.hh>
using namespace paludis;
using namespace paludis::resolver;
diff --git a/paludis/resolver/resolvent.cc b/paludis/resolver/resolvent.cc
index d820e01..79ca129 100644
--- a/paludis/resolver/resolvent.cc
+++ b/paludis/resolver/resolvent.cc
@@ -18,7 +18,6 @@
*/
#include <paludis/resolver/resolvent.hh>
-#include <paludis/resolver/serialise-impl.hh>
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/make_named_values.hh>
@@ -27,6 +26,7 @@
#include <paludis/filter.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
+#include <paludis/serialise-impl.hh>
using namespace paludis;
using namespace paludis::resolver;
diff --git a/paludis/resolver/resolvent.hh b/paludis/resolver/resolvent.hh
index 77c0238..9d67cff 100644
--- a/paludis/resolver/resolvent.hh
+++ b/paludis/resolver/resolvent.hh
@@ -22,7 +22,7 @@
#include <paludis/resolver/resolvent-fwd.hh>
#include <paludis/resolver/destination_types-fwd.hh>
-#include <paludis/resolver/serialise-fwd.hh>
+#include <paludis/serialise-fwd.hh>
#include <paludis/util/named_value.hh>
#include <paludis/name.hh>
#include <paludis/dep_spec-fwd.hh>
diff --git a/paludis/resolver/resolver.cc b/paludis/resolver/resolver.cc
index 72dcb38..b474876 100644
--- a/paludis/resolver/resolver.cc
+++ b/paludis/resolver/resolver.cc
@@ -28,7 +28,6 @@
#include <paludis/resolver/resolver_functions.hh>
#include <paludis/resolver/suggest_restart.hh>
#include <paludis/resolver/resolutions.hh>
-#include <paludis/resolver/serialise.hh>
#include <paludis/resolver/destination.hh>
#include <paludis/resolver/unsuitable_candidates.hh>
#include <paludis/util/stringify.hh>
@@ -57,6 +56,7 @@
#include <paludis/repository.hh>
#include <paludis/choice.hh>
#include <paludis/spec_tree.hh>
+#include <paludis/serialise.hh>
#include <iostream>
#include <iomanip>
#include <list>
diff --git a/paludis/resolver/resolver_TEST_serialisation.cc b/paludis/resolver/resolver_TEST_serialisation.cc
index eb83133..38bcad6 100644
--- a/paludis/resolver/resolver_TEST_serialisation.cc
+++ b/paludis/resolver/resolver_TEST_serialisation.cc
@@ -25,7 +25,6 @@
#include <paludis/resolver/constraint.hh>
#include <paludis/resolver/resolvent.hh>
#include <paludis/resolver/suggest_restart.hh>
-#include <paludis/resolver/serialise.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/options.hh>
@@ -38,6 +37,7 @@
#include <paludis/user_dep_spec.hh>
#include <paludis/repository_factory.hh>
#include <paludis/package_database.hh>
+#include <paludis/serialise.hh>
#include <paludis/resolver/resolver_test.hh>
#include <test/test_runner.hh>
diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc
index fb9f745..e889e5f 100644
--- a/paludis/resolver/sanitised_dependencies.cc
+++ b/paludis/resolver/sanitised_dependencies.cc
@@ -20,7 +20,6 @@
#include <paludis/resolver/sanitised_dependencies.hh>
#include <paludis/resolver/resolver.hh>
#include <paludis/resolver/resolvent.hh>
-#include <paludis/resolver/serialise-impl.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/save.hh>
#include <paludis/util/stringify.hh>
@@ -32,6 +31,7 @@
#include <paludis/metadata_key.hh>
#include <paludis/package_id.hh>
#include <paludis/elike_package_dep_spec.hh>
+#include <paludis/serialise-impl.hh>
#include <set>
#include <list>
diff --git a/paludis/resolver/sanitised_dependencies.hh b/paludis/resolver/sanitised_dependencies.hh
index 69cdad9..2d69e4b 100644
--- a/paludis/resolver/sanitised_dependencies.hh
+++ b/paludis/resolver/sanitised_dependencies.hh
@@ -22,13 +22,13 @@
#include <paludis/resolver/sanitised_dependencies-fwd.hh>
#include <paludis/resolver/resolver-fwd.hh>
-#include <paludis/resolver/serialise-fwd.hh>
#include <paludis/resolver/resolvent-fwd.hh>
#include <paludis/util/named_value.hh>
#include <paludis/dep_label-fwd.hh>
#include <paludis/dep_spec.hh>
#include <paludis/spec_tree-fwd.hh>
#include <paludis/metadata_key-fwd.hh>
+#include <paludis/serialise-fwd.hh>
namespace paludis
{
diff --git a/paludis/resolver/serialise-impl.hh b/paludis/resolver/serialise-impl.hh
deleted file mode 100644
index c2c05c6..0000000
--- a/paludis/resolver/serialise-impl.hh
+++ /dev/null
@@ -1,283 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 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_RESOLVER_SERIALISE_IMPL_HH
-#define PALUDIS_GUARD_PALUDIS_RESOLVER_SERIALISE_IMPL_HH 1
-
-#include <paludis/resolver/serialise.hh>
-#include <paludis/util/remove_shared_ptr.hh>
-#include <paludis/util/destringify.hh>
-#include <paludis/util/make_shared_ptr.hh>
-#include <paludis/util/options.hh>
-#include <paludis/util/tokeniser.hh>
-#include <paludis/package_id-fwd.hh>
-#include <paludis/dep_spec-fwd.hh>
-#include <tr1/type_traits>
-#include <list>
-#include <ostream>
-#include <istream>
-
-namespace paludis
-{
- namespace resolver
- {
- template <
- typename Flags_,
- typename Flag_>
- struct SerialiserFlagsInclude
- {
- static const bool value =
- std::tr1::is_same<typename Flags_::Flag1, Flag_>::value ||
- std::tr1::is_same<typename Flags_::Flag2, Flag_>::value ||
- std::tr1::is_same<typename Flags_::Flag3, Flag_>::value;
- };
-
- template <
- bool is_container_,
- bool might_be_null_,
- typename T_>
- struct SerialiserObjectWriterHandler;
-
- template <>
- struct SerialiserObjectWriterHandler<false, false, bool>
- {
- static void write(Serialiser & s, const bool t);
- };
-
- template <>
- struct SerialiserObjectWriterHandler<false, false, int>
- {
- static void write(Serialiser & s, const int t);
- };
-
- template <>
- struct SerialiserObjectWriterHandler<false, false, std::string>
- {
- static void write(Serialiser & s, const std::string & t);
- };
-
- template <>
- struct SerialiserObjectWriterHandler<false, false, const PackageID>
- {
- static void write(Serialiser & s, const PackageID & t);
- };
-
- template <
- typename T_>
- struct SerialiserObjectWriterHandler<false, false, Options<T_> >
- {
- static void write(Serialiser & s, const Options<T_> & t)
- {
- std::stringstream ss;
- for (T_ i(static_cast<T_>(0)), i_end(t.highest_bit()) ;
- i != i_end ; i = static_cast<T_>(static_cast<int>(i) + 1))
- {
- if (! t[i])
- continue;
- if (! ss.str().empty())
- ss << ",";
- ss << i;
- }
-
- s.raw_stream() << "\"";
- s.escape_write(ss.str());
- s.raw_stream() << "\";";
- }
- };
-
- template <
- typename T_>
- struct SerialiserObjectWriterHandler<false, false, const T_>
- {
- static void write(Serialiser & s, const T_ & t)
- {
- SerialiserObjectWriterHandler<false, false, T_>::write(s, t);
- }
- };
-
- template <
- typename T_>
- struct SerialiserObjectWriterHandler<false, false, T_>
- {
- static void write(Serialiser & s, const T_ & t)
- {
- t.serialise(s);
- }
- };
-
- template <
- bool is_container_,
- typename T_>
- struct SerialiserObjectWriterHandler<is_container_, true, T_>
- {
- static void write(Serialiser & s, const T_ & t)
- {
- if (t)
- SerialiserObjectWriterHandler<is_container_, false, typename RemoveSharedPtr<T_>::Type>::write(
- s, *t);
- else
- s.raw_stream() << "null;";
- }
- };
-
- template <
- typename T_>
- struct SerialiserObjectWriterHandler<true, false, T_>
- {
- static void write(Serialiser & s, const T_ & t)
- {
- s.raw_stream() << "c(";
- unsigned n(0);
- for (typename T_::ConstIterator i(t.begin()), i_end(t.end()) ;
- i != i_end ; ++i)
- {
- typedef typename std::iterator_traits<typename T_::ConstIterator>::value_type ItemValueType;
- typedef typename std::tr1::remove_reference<ItemValueType>::type ItemType;
-
- s.raw_stream() << ++n << "=";
- SerialiserObjectWriterHandler<
- false,
- ! std::tr1::is_same<ItemType, typename RemoveSharedPtr<ItemType>::Type>::value,
- ItemType
- >::write(s, *i);
- }
-
- s.raw_stream() << "count=";
- SerialiserObjectWriterHandler<false, false, int>::write(s, n);
-
- s.raw_stream() << ");";
- }
- };
-
- template <
- typename Flags_,
- typename T_>
- SerialiserObjectWriter &
- SerialiserObjectWriter::member(
- const Flags_ &,
- const std::string & item_name,
- const T_ & t)
- {
- _serialiser.raw_stream() << item_name << "=";
-
- SerialiserObjectWriterHandler<
- SerialiserFlagsInclude<Flags_, serialise::container>::value,
- SerialiserFlagsInclude<Flags_, serialise::might_be_null>::value,
- T_
- >::write(_serialiser, t);
-
- return *this;
- }
-
- template <typename T_>
- struct DeserialisatorHandler;
-
- template <>
- struct DeserialisatorHandler<bool>
- {
- static bool handle(Deserialisation & v)
- {
- return destringify<bool>(v.string_value());
- }
- };
-
- template <>
- struct DeserialisatorHandler<int>
- {
- static int handle(Deserialisation & v)
- {
- return destringify<int>(v.string_value());
- }
- };
-
- template <>
- struct DeserialisatorHandler<std::string>
- {
- static std::string handle(Deserialisation & v)
- {
- return v.string_value();
- }
- };
-
- template <>
- struct DeserialisatorHandler<std::tr1::shared_ptr<const PackageID> >
- {
- static std::tr1::shared_ptr<const PackageID> handle(Deserialisation & v);
- };
-
- template <typename T_>
- struct DeserialisatorHandler<std::tr1::shared_ptr<T_> >
- {
- static std::tr1::shared_ptr<T_> handle(Deserialisation & v)
- {
- if (v.null())
- return make_null_shared_ptr();
- else
- return T_::deserialise(v);
- }
- };
-
- template <typename T_>
- struct DeserialisatorHandler<Options<T_> >
- {
- static Options<T_> handle(Deserialisation & v)
- {
- Options<T_> result;
- std::list<std::string> tokens;
- tokenise<delim_kind::AnyOfTag, delim_mode::BoundaryTag>(v.string_value(),
- ",", "", std::back_inserter(tokens));
-
- for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
- t != t_end ; ++t)
- result += destringify<T_>(*t);
-
- return result;
- }
- };
-
- template <typename T_>
- struct DeserialisatorHandler
- {
- static T_ handle(Deserialisation & v)
- {
- return T_::deserialise(v);
- }
- };
-
- template <typename T_>
- T_
- Deserialisator::member(const std::string & key_name)
- {
- return DeserialisatorHandler<T_>::handle(*find_remove_member(key_name));
- }
-
- template <typename T_>
- std::tr1::shared_ptr<T_> deserialise(
- const Environment * const env,
- const std::string & str,
- const std::string & class_name)
- {
- Deserialiser d(env, str);
- Deserialisation dd(class_name, d);
- return T_::deserialise(dd);
- }
- }
-}
-
-#endif
diff --git a/paludis/resolver/serialise.hh b/paludis/resolver/serialise.hh
deleted file mode 100644
index 14f0fee..0000000
--- a/paludis/resolver/serialise.hh
+++ /dev/null
@@ -1,162 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 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_RESOLVER_SERIALISE_HH
-#define PALUDIS_GUARD_PALUDIS_RESOLVER_SERIALISE_HH 1
-
-#include <paludis/resolver/serialise-fwd.hh>
-#include <paludis/util/attributes.hh>
-#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/simple_parser-fwd.hh>
-#include <paludis/util/wrapped_forward_iterator-fwd.hh>
-#include <paludis/environment-fwd.hh>
-#include <tr1/memory>
-#include <string>
-#include <ostream>
-
-namespace paludis
-{
- namespace resolver
- {
- namespace serialise
- {
- struct container;
- struct might_be_null;
- }
-
- template <
- typename Flag1_ = void,
- typename Flag2_ = void,
- typename Flag3_ = void
- >
- struct SerialiserFlags
- {
- typedef Flag1_ Flag1;
- typedef Flag2_ Flag2;
- typedef Flag3_ Flag3;
- };
-
- class PALUDIS_VISIBLE SerialiserObjectWriter
- {
- private:
- Serialiser & _serialiser;
-
- public:
- SerialiserObjectWriter(Serialiser &);
- ~SerialiserObjectWriter();
-
- template <
- typename Flags_,
- typename T_>
- SerialiserObjectWriter & member(
- const Flags_ &,
- const std::string & item_name,
- const T_ &);
- };
-
- class PALUDIS_VISIBLE Serialiser
- {
- private:
- std::ostream & _stream;
-
- public:
- Serialiser(std::ostream &);
- ~Serialiser();
-
- SerialiserObjectWriter object(const std::string & class_name)
- PALUDIS_ATTRIBUTE((warn_unused_result));
-
- std::ostream & raw_stream() PALUDIS_ATTRIBUTE((warn_unused_result));
-
- void escape_write(const std::string &);
- };
-
- class PALUDIS_VISIBLE Deserialiser :
- private PrivateImplementationPattern<Deserialiser>
- {
- public:
- Deserialiser(const Environment * const, const std::string &);
- ~Deserialiser();
-
- const Environment * environment() const PALUDIS_ATTRIBUTE((warn_unused_result));
- SimpleParser & parser() PALUDIS_ATTRIBUTE((warn_unused_result));
- };
-
- class PALUDIS_VISIBLE Deserialisation :
- private PrivateImplementationPattern<Deserialisation>
- {
- public:
- Deserialisation(
- const std::string & class_name,
- Deserialiser &);
- ~Deserialisation();
-
- const Deserialiser & deserialiser() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- const std::string item_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- const std::string class_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- const std::string raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- const std::string string_value() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- bool null() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- struct ConstIteratorTag;
- typedef WrappedForwardIterator<ConstIteratorTag,
- const std::tr1::shared_ptr<Deserialisation> > ConstIterator;
- ConstIterator begin_children() const PALUDIS_ATTRIBUTE((warn_unused_result));
- ConstIterator end_children() const PALUDIS_ATTRIBUTE((warn_unused_result));
- };
-
- class PALUDIS_VISIBLE Deserialisator :
- private PrivateImplementationPattern<Deserialisator>
- {
- public:
- Deserialisator(
- Deserialisation &,
- const std::string & class_name);
-
- ~Deserialisator();
-
- const Deserialisation & deserialisation() const PALUDIS_ATTRIBUTE((warn_unused_result));
-
- template <typename T_> T_ member(const std::string & key_name);
-
- const std::tr1::shared_ptr<Deserialisation> find_remove_member(
- const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result));
-
- };
-
- template <typename T_>
- std::tr1::shared_ptr<T_> deserialise(
- const Environment * const,
- const std::string &,
- const std::string &) PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
- }
-
-#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
- extern template class PrivateImplementationPattern<resolver::Deserialiser>;
- extern template class PrivateImplementationPattern<resolver::Deserialisation>;
- extern template class PrivateImplementationPattern<resolver::Deserialisator>;
-#endif
-}
-
-#endif
diff --git a/paludis/resolver/unsuitable_candidates.cc b/paludis/resolver/unsuitable_candidates.cc
index 5dafd3f..b8ed9d3 100644
--- a/paludis/resolver/unsuitable_candidates.cc
+++ b/paludis/resolver/unsuitable_candidates.cc
@@ -18,11 +18,11 @@
*/
#include <paludis/resolver/unsuitable_candidates.hh>
-#include <paludis/resolver/serialise-impl.hh>
#include <paludis/resolver/constraint.hh>
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/serialise-impl.hh>
using namespace paludis;
using namespace paludis::resolver;
diff --git a/paludis/resolver/unsuitable_candidates.hh b/paludis/resolver/unsuitable_candidates.hh
index f3d57d4..4384506 100644
--- a/paludis/resolver/unsuitable_candidates.hh
+++ b/paludis/resolver/unsuitable_candidates.hh
@@ -21,10 +21,10 @@
#define PALUDIS_GUARD_PALUDIS_RESOLVER_UNSUITABLE_CANDIDATES_HH 1
#include <paludis/resolver/unsuitable_candidates-fwd.hh>
-#include <paludis/resolver/serialise-fwd.hh>
#include <paludis/resolver/constraint-fwd.hh>
#include <paludis/util/named_value.hh>
#include <paludis/package_id-fwd.hh>
+#include <paludis/serialise-fwd.hh>
namespace paludis
{
diff --git a/paludis/resolver/serialise-fwd.hh b/paludis/serialise-fwd.hh
index c84d4ae..045517e 100644
--- a/paludis/resolver/serialise-fwd.hh
+++ b/paludis/serialise-fwd.hh
@@ -17,18 +17,15 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef PALUDIS_GUARD_PALUDIS_RESOLVER_SERIALISE_FWD_HH
-#define PALUDIS_GUARD_PALUDIS_RESOLVER_SERIALISE_FWD_HH 1
+#ifndef PALUDIS_GUARD_PALUDIS_SERIALISE_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_SERIALISE_FWD_HH 1
namespace paludis
{
- namespace resolver
- {
- struct Serialiser;
+ struct Serialiser;
- struct Deserialiser;
- struct Deserialisation;
- }
+ struct Deserialiser;
+ struct Deserialisation;
}
#endif
diff --git a/paludis/serialise-impl.hh b/paludis/serialise-impl.hh
new file mode 100644
index 0000000..c8652bb
--- /dev/null
+++ b/paludis/serialise-impl.hh
@@ -0,0 +1,280 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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_SERIALISE_IMPL_HH
+#define PALUDIS_GUARD_PALUDIS_SERIALISE_IMPL_HH 1
+
+#include <paludis/serialise.hh>
+#include <paludis/util/remove_shared_ptr.hh>
+#include <paludis/util/destringify.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/options.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/dep_spec-fwd.hh>
+#include <tr1/type_traits>
+#include <list>
+#include <ostream>
+#include <istream>
+
+namespace paludis
+{
+ template <
+ typename Flags_,
+ typename Flag_>
+ struct SerialiserFlagsInclude
+ {
+ static const bool value =
+ std::tr1::is_same<typename Flags_::Flag1, Flag_>::value ||
+ std::tr1::is_same<typename Flags_::Flag2, Flag_>::value ||
+ std::tr1::is_same<typename Flags_::Flag3, Flag_>::value;
+ };
+
+ template <
+ bool is_container_,
+ bool might_be_null_,
+ typename T_>
+ struct SerialiserObjectWriterHandler;
+
+ template <>
+ struct PALUDIS_VISIBLE SerialiserObjectWriterHandler<false, false, bool>
+ {
+ static void write(Serialiser & s, const bool t);
+ };
+
+ template <>
+ struct PALUDIS_VISIBLE SerialiserObjectWriterHandler<false, false, int>
+ {
+ static void write(Serialiser & s, const int t);
+ };
+
+ template <>
+ struct PALUDIS_VISIBLE SerialiserObjectWriterHandler<false, false, std::string>
+ {
+ static void write(Serialiser & s, const std::string & t);
+ };
+
+ template <>
+ struct PALUDIS_VISIBLE SerialiserObjectWriterHandler<false, false, const PackageID>
+ {
+ static void write(Serialiser & s, const PackageID & t);
+ };
+
+ template <
+ typename T_>
+ struct SerialiserObjectWriterHandler<false, false, Options<T_> >
+ {
+ static void write(Serialiser & s, const Options<T_> & t)
+ {
+ std::stringstream ss;
+ for (T_ i(static_cast<T_>(0)), i_end(t.highest_bit()) ;
+ i != i_end ; i = static_cast<T_>(static_cast<int>(i) + 1))
+ {
+ if (! t[i])
+ continue;
+ if (! ss.str().empty())
+ ss << ",";
+ ss << i;
+ }
+
+ s.raw_stream() << "\"";
+ s.escape_write(ss.str());
+ s.raw_stream() << "\";";
+ }
+ };
+
+ template <
+ typename T_>
+ struct SerialiserObjectWriterHandler<false, false, const T_>
+ {
+ static void write(Serialiser & s, const T_ & t)
+ {
+ SerialiserObjectWriterHandler<false, false, T_>::write(s, t);
+ }
+ };
+
+ template <
+ typename T_>
+ struct SerialiserObjectWriterHandler<false, false, T_>
+ {
+ static void write(Serialiser & s, const T_ & t)
+ {
+ t.serialise(s);
+ }
+ };
+
+ template <
+ bool is_container_,
+ typename T_>
+ struct SerialiserObjectWriterHandler<is_container_, true, T_>
+ {
+ static void write(Serialiser & s, const T_ & t)
+ {
+ if (t)
+ SerialiserObjectWriterHandler<is_container_, false, typename RemoveSharedPtr<T_>::Type>::write(
+ s, *t);
+ else
+ s.raw_stream() << "null;";
+ }
+ };
+
+ template <
+ typename T_>
+ struct SerialiserObjectWriterHandler<true, false, T_>
+ {
+ static void write(Serialiser & s, const T_ & t)
+ {
+ s.raw_stream() << "c(";
+ unsigned n(0);
+ for (typename T_::ConstIterator i(t.begin()), i_end(t.end()) ;
+ i != i_end ; ++i)
+ {
+ typedef typename std::iterator_traits<typename T_::ConstIterator>::value_type ItemValueType;
+ typedef typename std::tr1::remove_reference<ItemValueType>::type ItemType;
+
+ s.raw_stream() << ++n << "=";
+ SerialiserObjectWriterHandler<
+ false,
+ ! std::tr1::is_same<ItemType, typename RemoveSharedPtr<ItemType>::Type>::value,
+ ItemType
+ >::write(s, *i);
+ }
+
+ s.raw_stream() << "count=";
+ SerialiserObjectWriterHandler<false, false, int>::write(s, n);
+
+ s.raw_stream() << ");";
+ }
+ };
+
+ template <
+ typename Flags_,
+ typename T_>
+ SerialiserObjectWriter &
+ SerialiserObjectWriter::member(
+ const Flags_ &,
+ const std::string & item_name,
+ const T_ & t)
+ {
+ _serialiser.raw_stream() << item_name << "=";
+
+ SerialiserObjectWriterHandler<
+ SerialiserFlagsInclude<Flags_, serialise::container>::value,
+ SerialiserFlagsInclude<Flags_, serialise::might_be_null>::value,
+ T_
+ >::write(_serialiser, t);
+
+ return *this;
+ }
+
+ template <typename T_>
+ struct DeserialisatorHandler;
+
+ template <>
+ struct DeserialisatorHandler<bool>
+ {
+ static bool handle(Deserialisation & v)
+ {
+ return destringify<bool>(v.string_value());
+ }
+ };
+
+ template <>
+ struct DeserialisatorHandler<int>
+ {
+ static int handle(Deserialisation & v)
+ {
+ return destringify<int>(v.string_value());
+ }
+ };
+
+ template <>
+ struct DeserialisatorHandler<std::string>
+ {
+ static std::string handle(Deserialisation & v)
+ {
+ return v.string_value();
+ }
+ };
+
+ template <>
+ struct PALUDIS_VISIBLE DeserialisatorHandler<std::tr1::shared_ptr<const PackageID> >
+ {
+ static std::tr1::shared_ptr<const PackageID> handle(Deserialisation & v);
+ };
+
+ template <typename T_>
+ struct PALUDIS_VISIBLE DeserialisatorHandler<std::tr1::shared_ptr<T_> >
+ {
+ static std::tr1::shared_ptr<T_> handle(Deserialisation & v)
+ {
+ if (v.null())
+ return make_null_shared_ptr();
+ else
+ return T_::deserialise(v);
+ }
+ };
+
+ template <typename T_>
+ struct DeserialisatorHandler<Options<T_> >
+ {
+ static Options<T_> handle(Deserialisation & v)
+ {
+ Options<T_> result;
+ std::list<std::string> tokens;
+ tokenise<delim_kind::AnyOfTag, delim_mode::BoundaryTag>(v.string_value(),
+ ",", "", std::back_inserter(tokens));
+
+ for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
+ t != t_end ; ++t)
+ result += destringify<T_>(*t);
+
+ return result;
+ }
+ };
+
+ template <typename T_>
+ struct DeserialisatorHandler
+ {
+ static T_ handle(Deserialisation & v)
+ {
+ return T_::deserialise(v);
+ }
+ };
+
+ template <typename T_>
+ T_
+ Deserialisator::member(const std::string & key_name)
+ {
+ return DeserialisatorHandler<T_>::handle(*find_remove_member(key_name));
+ }
+
+ template <typename T_>
+ std::tr1::shared_ptr<T_> deserialise(
+ const Environment * const env,
+ const std::string & str,
+ const std::string & class_name)
+ {
+ Deserialiser d(env, str);
+ Deserialisation dd(class_name, d);
+ return T_::deserialise(dd);
+ }
+}
+
+#endif
diff --git a/paludis/resolver/serialise.cc b/paludis/serialise.cc
index 877234f..a976ccd 100644
--- a/paludis/resolver/serialise.cc
+++ b/paludis/serialise.cc
@@ -17,7 +17,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <paludis/resolver/serialise-impl.hh>
+#include <paludis/serialise-impl.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/stringify.hh>
#include <paludis/util/simple_parser.hh>
@@ -27,17 +27,15 @@
#include <paludis/util/member_iterator-impl.hh>
#include <paludis/package_id.hh>
#include <paludis/dep_spec.hh>
-#include <paludis/environment.hh>
-#include <paludis/elike_package_dep_spec.hh>
#include <paludis/selection.hh>
-#include <paludis/filter.hh>
#include <paludis/generator.hh>
#include <paludis/filtered_generator.hh>
+#include <paludis/environment.hh>
+#include <paludis/elike_package_dep_spec.hh>
#include <list>
#include <map>
using namespace paludis;
-using namespace paludis::resolver;
SerialiserObjectWriter::SerialiserObjectWriter(Serialiser & s) :
_serialiser(s)
diff --git a/paludis/serialise.hh b/paludis/serialise.hh
new file mode 100644
index 0000000..087b817
--- /dev/null
+++ b/paludis/serialise.hh
@@ -0,0 +1,159 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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_SERIALISE_HH
+#define PALUDIS_GUARD_PALUDIS_SERIALISE_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/simple_parser-fwd.hh>
+#include <paludis/util/wrapped_forward_iterator-fwd.hh>
+#include <paludis/serialise-fwd.hh>
+#include <paludis/environment-fwd.hh>
+#include <tr1/memory>
+#include <string>
+#include <ostream>
+
+namespace paludis
+{
+ namespace serialise
+ {
+ struct container;
+ struct might_be_null;
+ }
+
+ template <
+ typename Flag1_ = void,
+ typename Flag2_ = void,
+ typename Flag3_ = void
+ >
+ struct SerialiserFlags
+ {
+ typedef Flag1_ Flag1;
+ typedef Flag2_ Flag2;
+ typedef Flag3_ Flag3;
+ };
+
+ class PALUDIS_VISIBLE SerialiserObjectWriter
+ {
+ private:
+ Serialiser & _serialiser;
+
+ public:
+ SerialiserObjectWriter(Serialiser &);
+ ~SerialiserObjectWriter();
+
+ template <
+ typename Flags_,
+ typename T_>
+ SerialiserObjectWriter & member(
+ const Flags_ &,
+ const std::string & item_name,
+ const T_ &);
+ };
+
+ class PALUDIS_VISIBLE Serialiser
+ {
+ private:
+ std::ostream & _stream;
+
+ public:
+ Serialiser(std::ostream &);
+ ~Serialiser();
+
+ SerialiserObjectWriter object(const std::string & class_name)
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ std::ostream & raw_stream() PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ void escape_write(const std::string &);
+ };
+
+ class PALUDIS_VISIBLE Deserialiser :
+ private PrivateImplementationPattern<Deserialiser>
+ {
+ public:
+ Deserialiser(const Environment * const, const std::string &);
+ ~Deserialiser();
+
+ const Environment * environment() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ SimpleParser & parser() PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ class PALUDIS_VISIBLE Deserialisation :
+ private PrivateImplementationPattern<Deserialisation>
+ {
+ public:
+ Deserialisation(
+ const std::string & class_name,
+ Deserialiser &);
+ ~Deserialisation();
+
+ const Deserialiser & deserialiser() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ const std::string item_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ const std::string class_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ const std::string raw_string() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ const std::string string_value() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ bool null() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ struct ConstIteratorTag;
+ typedef WrappedForwardIterator<ConstIteratorTag,
+ const std::tr1::shared_ptr<Deserialisation> > ConstIterator;
+ ConstIterator begin_children() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ ConstIterator end_children() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ class PALUDIS_VISIBLE Deserialisator :
+ private PrivateImplementationPattern<Deserialisator>
+ {
+ public:
+ Deserialisator(
+ Deserialisation &,
+ const std::string & class_name);
+
+ ~Deserialisator();
+
+ const Deserialisation & deserialisation() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ template <typename T_> T_ member(const std::string & key_name);
+
+ const std::tr1::shared_ptr<Deserialisation> find_remove_member(
+ const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ };
+
+ template <typename T_>
+ std::tr1::shared_ptr<T_> deserialise(
+ const Environment * const,
+ const std::string &,
+ const std::string &) PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<Deserialiser>;
+ extern template class PrivateImplementationPattern<Deserialisation>;
+ extern template class PrivateImplementationPattern<Deserialisator>;
+#endif
+}
+
+#endif
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index f60ab5f..ea41496 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -35,7 +35,6 @@
#include <paludis/util/set.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/resolver/resolutions.hh>
-#include <paludis/resolver/serialise.hh>
#include <paludis/resolver/reason.hh>
#include <paludis/resolver/sanitised_dependencies.hh>
#include <paludis/resolver/resolution.hh>
@@ -59,6 +58,7 @@
#include <paludis/selection.hh>
#include <paludis/environment.hh>
#include <paludis/mask.hh>
+#include <paludis/serialise.hh>
#include <set>
#include <iterator>
diff --git a/src/clients/cave/cmd_execute_resolution.cc b/src/clients/cave/cmd_execute_resolution.cc
index c395582..236ebe8 100644
--- a/src/clients/cave/cmd_execute_resolution.cc
+++ b/src/clients/cave/cmd_execute_resolution.cc
@@ -35,7 +35,6 @@
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/resolver/resolutions.hh>
-#include <paludis/resolver/serialise.hh>
#include <paludis/resolver/reason.hh>
#include <paludis/resolver/sanitised_dependencies.hh>
#include <paludis/resolver/resolution.hh>
@@ -54,6 +53,7 @@
#include <paludis/environment.hh>
#include <paludis/action.hh>
#include <paludis/package_dep_spec_properties.hh>
+#include <paludis/serialise.hh>
#include <set>
#include <iterator>
diff --git a/src/clients/cave/cmd_resolve.cc b/src/clients/cave/cmd_resolve.cc
index 4e09104..15003f7 100644
--- a/src/clients/cave/cmd_resolve.cc
+++ b/src/clients/cave/cmd_resolve.cc
@@ -41,7 +41,6 @@
#include <paludis/resolver/resolvent.hh>
#include <paludis/resolver/constraint.hh>
#include <paludis/resolver/sanitised_dependencies.hh>
-#include <paludis/resolver/serialise-impl.hh>
#include <paludis/resolver/resolutions.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/notifier_callback.hh>
@@ -54,6 +53,7 @@
#include <paludis/environment.hh>
#include <paludis/match_package.hh>
#include <paludis/package_database.hh>
+#include <paludis/serialise-impl.hh>
#include <algorithm>
#include <iostream>