aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-07-14 20:23:35 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-07-14 20:23:35 +0100
commitd14c32052a3e4d6c3d16669aa6760d0b0955de3c (patch)
tree727184ef20a1423807b689aecdeca2715276604b
parent33e7bdf8d35762559eb5b162f9ee46bcf6cad0e9 (diff)
downloadpaludis-d14c32052a3e4d6c3d16669aa6760d0b0955de3c.tar.gz
paludis-d14c32052a3e4d6c3d16669aa6760d0b0955de3c.tar.xz
Add PartiallyMadePackageDepSpec ctor from PackageDepSpec.
-rw-r--r--paludis/dep_spec.cc47
-rw-r--r--paludis/dep_spec.hh6
2 files changed, 48 insertions, 5 deletions
diff --git a/paludis/dep_spec.cc b/paludis/dep_spec.cc
index b026d76..8b074a5 100644
--- a/paludis/dep_spec.cc
+++ b/paludis/dep_spec.cc
@@ -600,6 +600,12 @@ PackageDepSpec::_as_string() const
return _imp->data->as_string();
}
+std::tr1::shared_ptr<const PackageDepSpecData>
+PackageDepSpec::data() const
+{
+ return _imp->data;
+}
+
AdditionalPackageDepSpecRequirement::~AdditionalPackageDepSpecRequirement()
{
}
@@ -615,14 +621,14 @@ namespace
struct PartiallyMadePackageDepSpecData :
PackageDepSpecData
{
- std::tr1::shared_ptr<QualifiedPackageName> package;
- std::tr1::shared_ptr<PackageNamePart> package_name_part;
- std::tr1::shared_ptr<CategoryNamePart> category_name_part;
+ std::tr1::shared_ptr<const QualifiedPackageName> package;
+ std::tr1::shared_ptr<const PackageNamePart> package_name_part;
+ std::tr1::shared_ptr<const CategoryNamePart> category_name_part;
std::tr1::shared_ptr<VersionRequirements> version_requirements;
VersionRequirementsMode version_requirements_mode_v;
std::tr1::shared_ptr<const SlotRequirement> slot;
- std::tr1::shared_ptr<RepositoryName> from_repository;
- std::tr1::shared_ptr<RepositoryName> in_repository;
+ std::tr1::shared_ptr<const RepositoryName> from_repository;
+ std::tr1::shared_ptr<const RepositoryName> in_repository;
std::tr1::shared_ptr<AdditionalPackageDepSpecRequirements> additional_requirements;
PartiallyMadePackageDepSpecData() :
@@ -631,6 +637,27 @@ namespace
{
}
+ PartiallyMadePackageDepSpecData(const PackageDepSpecData & other) :
+ PackageDepSpecData(other),
+ package(other.package_ptr()),
+ package_name_part(other.package_name_part_ptr()),
+ category_name_part(other.category_name_part_ptr()),
+ version_requirements(other.version_requirements_ptr() ? new VersionRequirements : 0),
+ version_requirements_mode_v(other.version_requirements_mode()),
+ slot(other.slot_requirement_ptr()),
+ from_repository(other.from_repository_ptr()),
+ in_repository(other.in_repository_ptr()),
+ additional_requirements(other.additional_requirements_ptr() ? new AdditionalPackageDepSpecRequirements : 0)
+ {
+ if (version_requirements)
+ std::copy(other.version_requirements_ptr()->begin(), other.version_requirements_ptr()->end(),
+ version_requirements->back_inserter());
+
+ if (additional_requirements)
+ std::copy(other.additional_requirements_ptr()->begin(), other.additional_requirements_ptr()->end(),
+ additional_requirements->back_inserter());
+ }
+
PartiallyMadePackageDepSpecData(const PartiallyMadePackageDepSpecData & other) :
PackageDepSpecData(other),
package(other.package),
@@ -826,6 +853,11 @@ namespace paludis
data(new PartiallyMadePackageDepSpecData(*other.data))
{
}
+
+ Implementation(const PackageDepSpec & other) :
+ data(new PartiallyMadePackageDepSpecData(*other.data()))
+ {
+ }
};
}
@@ -839,6 +871,11 @@ PartiallyMadePackageDepSpec::PartiallyMadePackageDepSpec(const PartiallyMadePack
{
}
+PartiallyMadePackageDepSpec::PartiallyMadePackageDepSpec(const PackageDepSpec & other) :
+ PrivateImplementationPattern<PartiallyMadePackageDepSpec>(new Implementation<PartiallyMadePackageDepSpec>(other))
+{
+}
+
PartiallyMadePackageDepSpec::~PartiallyMadePackageDepSpec()
{
}
diff --git a/paludis/dep_spec.hh b/paludis/dep_spec.hh
index 3b370fc..60d43a2 100644
--- a/paludis/dep_spec.hh
+++ b/paludis/dep_spec.hh
@@ -309,6 +309,7 @@ namespace paludis
PartiallyMadePackageDepSpec();
~PartiallyMadePackageDepSpec();
+ PartiallyMadePackageDepSpec(const PackageDepSpec &);
PartiallyMadePackageDepSpec(const PartiallyMadePackageDepSpec &);
///\}
@@ -480,6 +481,11 @@ namespace paludis
*/
std::tr1::shared_ptr<PackageDepSpec> without_additional_requirements() const;
+ /**
+ * Access to our data.
+ */
+ std::tr1::shared_ptr<const PackageDepSpecData> data() const;
+
virtual const PackageDepSpec * as_package_dep_spec() const;
};