aboutsummaryrefslogtreecommitdiff
path: root/paludis/resolver/sanitised_dependencies.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-12 20:54:16 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-12 20:54:16 +0100
commit3932fa2e349b8f673d60a9a8dfe4d34bdc722fa1 (patch)
tree7d96e38b8977e5d2cfc7879b97e622a0f5d9fd35 /paludis/resolver/sanitised_dependencies.cc
parentd0f0c51bc9f2e32436c17bb7ec1d27844d2b852e (diff)
downloadpaludis-3932fa2e349b8f673d60a9a8dfe4d34bdc722fa1.tar.gz
paludis-3932fa2e349b8f673d60a9a8dfe4d34bdc722fa1.tar.xz
Give PackageOrBlockDepSpec its own header
Diffstat (limited to 'paludis/resolver/sanitised_dependencies.cc')
-rw-r--r--paludis/resolver/sanitised_dependencies.cc125
1 files changed, 0 insertions, 125 deletions
diff --git a/paludis/resolver/sanitised_dependencies.cc b/paludis/resolver/sanitised_dependencies.cc
index c46a2a3..c525f52 100644
--- a/paludis/resolver/sanitised_dependencies.cc
+++ b/paludis/resolver/sanitised_dependencies.cc
@@ -488,128 +488,6 @@ SanitisedDependencies::end() const
return ConstIterator(_imp->sanitised_dependencies.end());
}
-std::ostream &
-paludis::resolver::operator<< (std::ostream & s, const PackageOrBlockDepSpec & d)
-{
- if (d.if_package())
- return s << *d.if_package();
- else
- return s << *d.if_block();
-}
-
-PackageOrBlockDepSpec::PackageOrBlockDepSpec(const BlockDepSpec & s) :
- if_block(n::if_block() = make_shared_ptr(new BlockDepSpec(s))),
- if_package(n::if_package() = make_null_shared_ptr())
-{
-}
-
-PackageOrBlockDepSpec::PackageOrBlockDepSpec(const PackageDepSpec & s) :
- if_block(n::if_block() = make_null_shared_ptr()),
- if_package(n::if_package() = make_shared_ptr(new PackageDepSpec(s)))
-{
-}
-
-void
-PackageOrBlockDepSpec::serialise(Serialiser & s) const
-{
- SerialiserObjectWriter w(s.object("PackageOrBlockDepSpec"));
-
- std::tr1::shared_ptr<DepSpec> spec;
- if (if_block())
- {
- spec = if_block();
- w
- .member(SerialiserFlags<>(), "block", true)
- .member(SerialiserFlags<>(), "spec", stringify(if_block()->blocking()))
- .member(SerialiserFlags<>(), "strong", if_block()->strong())
- .member(SerialiserFlags<>(), "text", if_block()->text())
- ;
- }
- else
- {
- spec = if_package();
- w
- .member(SerialiserFlags<>(), "block", false)
- .member(SerialiserFlags<>(), "spec", stringify(*if_package()))
- ;
- }
-
- if (! spec->annotations_key())
- w.member(SerialiserFlags<>(), "annotations_count", 0);
- else
- {
- int n(0);
- for (MetadataSectionKey::MetadataConstIterator m(spec->annotations_key()->begin_metadata()),
- m_end(spec->annotations_key()->end_metadata()) ;
- m != m_end ; ++m)
- {
- const MetadataValueKey<std::string> * k(
- simple_visitor_cast<const MetadataValueKey<std::string> >(**m));
- if (! k)
- {
- Log::get_instance()->message("resolver.sanitised_dependencies.not_a_string", ll_warning, lc_context)
- << "Annotation '" << (*m)->raw_name() << "' not a string. This is probably a bug.";
- continue;
- }
-
- w.member(SerialiserFlags<>(), "annotations_k_" + stringify(n), k->human_name());
- w.member(SerialiserFlags<>(), "annotations_v_" + stringify(n), k->value());
- ++n;
- }
-
- w.member(SerialiserFlags<>(), "annotations_count", stringify(n));
- }
-}
-
-PackageOrBlockDepSpec
-PackageOrBlockDepSpec::deserialise(Deserialisation & d, const std::tr1::shared_ptr<const PackageID> & for_id)
-{
- Context context("When deserialising:");
-
- Deserialisator v(d, "PackageOrBlockDepSpec");
-
- bool block(v.member<bool>("block"));
- PackageDepSpec spec(parse_elike_package_dep_spec(v.member<std::string>("spec"),
- ELikePackageDepSpecOptions() + epdso_allow_tilde_greater_deps + epdso_nice_equal_star +
- epdso_allow_ranged_deps + epdso_allow_use_deps + epdso_allow_use_deps_portage +
- epdso_allow_use_dep_defaults + epdso_allow_repository_deps + epdso_allow_slot_star_deps +
- epdso_allow_slot_equal_deps + epdso_allow_slot_deps + epdso_allow_key_requirements +
- epdso_allow_use_dep_question_defaults,
- VersionSpecOptions() + vso_flexible_dashes + vso_flexible_dots + vso_ignore_case +
- vso_letters_anywhere + vso_dotted_suffixes,
- for_id));
-
- std::tr1::shared_ptr<MetadataSectionKey> annotations;
-
- std::tr1::shared_ptr<Map<std::string, std::string> > m(new Map<std::string, std::string>);
- for (int a(0), a_end(v.member<int>("annotations_count")) ;
- a != a_end ; ++a)
- {
- std::string key(v.member<std::string>("annotations_k_" + stringify(a)));
- std::string value(v.member<std::string>("annotations_v_" + stringify(a)));
- m->insert(key, value);
- }
-
- if (! m->empty())
- annotations.reset(new ELikeAnnotations(m));
-
- if (block)
- {
- bool strong(v.member<bool>("strong"));
- std::string text(v.member<std::string>("text"));
- BlockDepSpec b_spec(text, spec, strong);
- if (annotations)
- b_spec.set_annotations_key(annotations);
- return PackageOrBlockDepSpec(b_spec);
- }
- else
- {
- if (annotations)
- spec.set_annotations_key(annotations);
- return PackageOrBlockDepSpec(spec);
- }
-}
-
void
SanitisedDependency::serialise(Serialiser & s) const
{
@@ -640,8 +518,5 @@ SanitisedDependency::deserialise(Deserialisation & d, const std::tr1::shared_ptr
);
}
-template class Sequence<PackageOrBlockDepSpec>;
-template class WrappedForwardIterator<Sequence<PackageOrBlockDepSpec>::ConstIteratorTag, const PackageOrBlockDepSpec>;
-
template class WrappedForwardIterator<SanitisedDependencies::ConstIteratorTag, const SanitisedDependency>;