aboutsummaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-05-19 14:20:48 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-05-19 20:52:24 +0100
commite52571861104efe6139b78b22557211f08025f11 (patch)
tree634bec98491886d12f8f5a25b24f4cacf8d69de5 /doc/api
parent80bf4ad14bfd8ab74a9c0d5f203ad5a370351def (diff)
downloadpaludis-e52571861104efe6139b78b22557211f08025f11.tar.gz
paludis-e52571861104efe6139b78b22557211f08025f11.tar.xz
Revert the package dep spec changes
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/cplusplus/examples/example_dep_spec.cc86
-rw-r--r--doc/api/cplusplus/examples/example_match_package.cc2
-rw-r--r--doc/api/cplusplus/examples/example_selection.cc8
3 files changed, 71 insertions, 25 deletions
diff --git a/doc/api/cplusplus/examples/example_dep_spec.cc b/doc/api/cplusplus/examples/example_dep_spec.cc
index 3a2cc5476..081b201ed 100644
--- a/doc/api/cplusplus/examples/example_dep_spec.cc
+++ b/doc/api/cplusplus/examples/example_dep_spec.cc
@@ -59,39 +59,85 @@ int main(int argc, char * argv[])
/* Display information about the PackageDepSpec. */
cout << "Information about '" << spec << "':" << endl;
- if (spec.package_name_requirement())
- cout << " " << left << setw(24) << "Package:" << " " << spec.package_name_requirement()->name() << endl;
+ if (spec.package_ptr())
+ cout << " " << left << setw(24) << "Package:" << " " << *spec.package_ptr() << endl;
- if (spec.category_name_part_requirement())
- cout << " " << left << setw(24) << "Category part:" << " " << spec.category_name_part_requirement()->name_part() << endl;
+ if (spec.category_name_part_ptr())
+ cout << " " << left << setw(24) << "Category part:" << " " << *spec.category_name_part_ptr() << endl;
- if (spec.package_name_part_requirement())
- cout << " " << left << setw(24) << "Package part:" << " " << spec.package_name_part_requirement()->name_part() << endl;
+ if (spec.package_name_part_ptr())
+ cout << " " << left << setw(24) << "Package part:" << " " << *spec.package_name_part_ptr() << endl;
- if (spec.exact_slot_requirement())
- cout << " " << left << setw(24) << "Slot:" << " " << spec.exact_slot_requirement()->name() << endl;
+ if (spec.version_requirements_ptr() && ! spec.version_requirements_ptr()->empty())
+ {
+ cout << " " << left << setw(24) << "Version requirements:" << " ";
+ bool need_join(false);
+ for (VersionRequirements::ConstIterator r(spec.version_requirements_ptr()->begin()),
+ r_end(spec.version_requirements_ptr()->end()) ; r != r_end ; ++r)
+ {
+ if (need_join)
+ {
+ switch (spec.version_requirements_mode())
+ {
+ case vr_and:
+ cout << " and ";
+ break;
+
+ case vr_or:
+ cout << " or ";
+ break;
+
+ case last_vr:
+ throw InternalError(PALUDIS_HERE, "Bad version_requirements_mode");
+ }
+ }
+
+ cout << r->version_operator() << r->version_spec();
+ need_join = true;
+ }
+ cout << endl;
+ }
+
+ if (spec.slot_requirement_ptr())
+ cout << " " << left << setw(24) << "Slot:" << " " << *spec.slot_requirement_ptr() << endl;
- if (spec.in_repository_requirement())
+ if (spec.in_repository_ptr())
cout << " " << left << setw(24) << "In repository:" << " " <<
- spec.in_repository_requirement()->name() << endl;
+ *spec.in_repository_ptr() << endl;
- if (spec.from_repository_requirement())
+ if (spec.from_repository_ptr())
cout << " " << left << setw(24) << "From repository:" << " " <<
- spec.from_repository_requirement()->name() << endl;
+ *spec.from_repository_ptr() << endl;
- if (spec.installed_at_path_requirement())
+ if (spec.installed_at_path_ptr())
cout << " " << left << setw(24) << "Installed at path:" << " " <<
- spec.installed_at_path_requirement()->path() << endl;
+ *spec.installed_at_path_ptr() << endl;
- if (spec.installable_to_path_requirement())
+ if (spec.installable_to_path_ptr())
cout << " " << left << setw(24) << "Installable to path:" << " " <<
- spec.installable_to_path_requirement()->path() << ", " <<
- spec.installable_to_path_requirement()->include_masked() << endl;
+ spec.installable_to_path_ptr()->path() << ", " <<
+ spec.installable_to_path_ptr()->include_masked() << endl;
- if (spec.installable_to_repository_requirement())
+ if (spec.installable_to_repository_ptr())
cout << " " << left << setw(24) << "Installable to repository:" << " " <<
- spec.installable_to_repository_requirement()->name() << ", " <<
- spec.installable_to_repository_requirement()->include_masked() << endl;
+ spec.installable_to_repository_ptr()->repository() << ", " <<
+ spec.installable_to_repository_ptr()->include_masked() << endl;
+
+ if (spec.additional_requirements_ptr() && ! spec.additional_requirements_ptr()->empty())
+ {
+ cout << " " << left << setw(24) << "Additional requirements:" << " ";
+ bool need_join(false);
+ for (AdditionalPackageDepSpecRequirements::ConstIterator u(spec.additional_requirements_ptr()->begin()),
+ u_end(spec.additional_requirements_ptr()->end()) ; u != u_end ; ++u)
+ {
+ if (need_join)
+ cout << " and ";
+
+ cout << (*u)->as_raw_string() + " (meaning: " + (*u)->as_human_string(make_null_shared_ptr()) + ")";
+ need_join = true;
+ }
+ cout << endl;
+ }
/* And display packages matching that spec */
cout << " " << left << setw(24) << "Matches:" << " ";
diff --git a/doc/api/cplusplus/examples/example_match_package.cc b/doc/api/cplusplus/examples/example_match_package.cc
index 94abb4cfc..c308f8dcd 100644
--- a/doc/api/cplusplus/examples/example_match_package.cc
+++ b/doc/api/cplusplus/examples/example_match_package.cc
@@ -54,7 +54,7 @@ int main(int argc, char * argv[])
i != i_end ; ++i)
{
/* Is it paludis? */
- if (match_package(*env, MutablePackageDepSpecData({ }).require_package(
+ if (match_package(*env, make_package_dep_spec({ }).package(
QualifiedPackageName("sys-apps/paludis")), *i, make_null_shared_ptr(), { }))
cout << left << setw(50) << (stringify(**i) + ":") << " " << "paludis" << endl;
diff --git a/doc/api/cplusplus/examples/example_selection.cc b/doc/api/cplusplus/examples/example_selection.cc
index f71a6ba0c..ad60e36b0 100644
--- a/doc/api/cplusplus/examples/example_selection.cc
+++ b/doc/api/cplusplus/examples/example_selection.cc
@@ -62,13 +62,13 @@ int main(int argc, char * argv[])
* object used determines the number and ordering of results. In the
* simplest form, it takes a Generator as a parameter. */
show_selection(env, selection::AllVersionsSorted(
- generator::Matches(MutablePackageDepSpecData({ }).require_package(
+ generator::Matches(make_package_dep_spec({ }).package(
QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { })));
/* Generators can be passed through a Filter. The Selection optimises
* the code internally to avoid doing excess work. */
show_selection(env, selection::AllVersionsSorted(
- generator::Matches(MutablePackageDepSpecData({ }).require_package(
+ generator::Matches(make_package_dep_spec({ }).package(
QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }) |
filter::InstalledAtSlash()));
@@ -76,7 +76,7 @@ int main(int argc, char * argv[])
* with filter::SupportsAction<InstallAction>, since installed packages
* aren't masked. */
show_selection(env, selection::AllVersionsSorted(
- generator::Matches(MutablePackageDepSpecData({ }).require_package(
+ generator::Matches(make_package_dep_spec({ }).package(
QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }) |
filter::SupportsAction<InstallAction>() |
filter::NotMasked()));
@@ -85,7 +85,7 @@ int main(int argc, char * argv[])
* is no metadata cache. Consider using other Selection objects if
* you only need the best matching or some arbitrary matching ID. */
show_selection(env, selection::BestVersionOnly(
- generator::Matches(MutablePackageDepSpecData({ }).require_package(
+ generator::Matches(make_package_dep_spec({ }).package(
QualifiedPackageName("sys-apps/paludis")), make_null_shared_ptr(), { }) |
filter::SupportsAction<InstallAction>() |
filter::NotMasked()));