summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hartwig <mandyke@gmail.com>2012-06-08 13:13:38 +0800
committerDaniel Hartwig <mandyke@gmail.com>2012-06-08 13:13:38 +0800
commit992891d756518a92a6c7cca34424b925320c32c0 (patch)
tree1803fb0a81368534fdcf49053e659f064d807f4b
parent6d6a9dc7f48b691de315bb01736beafc15d46020 (diff)
downloadaptitude-992891d756518a92a6c7cca34424b925320c32c0.tar.gz
Add typedefs for vectors of package, version search results
typedef vector<pair<PkgIterator,ref_ptr<structural_match> > > pkg_results_list; typedef vector<pair<VerIterator,ref_ptr<structural_match> > > ver_results_list;
-rw-r--r--src/cmdline/cmdline_action.cc7
-rw-r--r--src/cmdline/cmdline_download.cc7
-rw-r--r--src/cmdline/cmdline_extract_cache_subset.cc7
-rw-r--r--src/cmdline/cmdline_search.cc7
-rw-r--r--src/cmdline/cmdline_show.cc7
-rw-r--r--src/cmdline/cmdline_user_tag.cc7
-rw-r--r--src/generic/apt/matching/match.cc4
-rw-r--r--src/generic/apt/matching/match.h12
-rw-r--r--src/gtk/pkgview.cc7
9 files changed, 36 insertions, 29 deletions
diff --git a/src/cmdline/cmdline_action.cc b/src/cmdline/cmdline_action.cc
index a499d19a..574a0efe 100644
--- a/src/cmdline/cmdline_action.cc
+++ b/src/cmdline/cmdline_action.cc
@@ -608,13 +608,14 @@ bool cmdline_applyaction(string s,
return false;
}
- std::vector<std::pair<pkgCache::PkgIterator, cw::util::ref_ptr<structural_match> > > matches;
+ pkg_results_list matches;
cw::util::ref_ptr<search_cache> search_info(search_cache::create());
search(p, search_info, matches,
*apt_cache_file,
*apt_package_records);
- for(std::vector<std::pair<pkgCache::PkgIterator, cw::util::ref_ptr<structural_match> > >::const_iterator
- it = matches.begin(); it != matches.end(); ++it)
+ for(pkg_results_list::const_iterator it = matches.begin();
+ it != matches.end();
+ ++it)
{
if(!cmdline_applyaction(action, it->first,
seen_virtual_packages,
diff --git a/src/cmdline/cmdline_download.cc b/src/cmdline/cmdline_download.cc
index 655d6337..879e4985 100644
--- a/src/cmdline/cmdline_download.cc
+++ b/src/cmdline/cmdline_download.cc
@@ -111,15 +111,16 @@ int cmdline_download(int argc, char *argv[])
return false;
}
- std::vector<std::pair<pkgCache::PkgIterator, ref_ptr<structural_match> > > matches;
+ pkg_results_list matches;
ref_ptr<search_cache> search_info(search_cache::create());
search(p, search_info,
matches,
*apt_cache_file,
*apt_package_records);
- for(std::vector<std::pair<pkgCache::PkgIterator, ref_ptr<structural_match> > >::const_iterator
- it = matches.begin(); it != matches.end(); ++it)
+ for(pkg_results_list::const_iterator it = matches.begin();
+ it != matches.end();
+ ++it)
packages.push_back(it->first);
// Maybe there should be a warning here if packages is
diff --git a/src/cmdline/cmdline_extract_cache_subset.cc b/src/cmdline/cmdline_extract_cache_subset.cc
index 2a2a3836..a5cc2086 100644
--- a/src/cmdline/cmdline_extract_cache_subset.cc
+++ b/src/cmdline/cmdline_extract_cache_subset.cc
@@ -110,15 +110,16 @@ namespace aptitude
}
else
{
- std::vector<std::pair<pkgCache::PkgIterator, ref_ptr<structural_match> > > matches;
+ pkg_results_list matches;
ref_ptr<search_cache> search_info(search_cache::create());
search(p, search_info,
matches,
*apt_cache_file,
*apt_package_records);
- for(std::vector<std::pair<pkgCache::PkgIterator, ref_ptr<structural_match> > >::const_iterator
- it = matches.begin(); it != matches.end(); ++it)
+ for(pkg_results_list::const_iterator it = matches.begin();
+ it != matches.end();
+ ++it)
packages.insert(it->first);
}
}
diff --git a/src/cmdline/cmdline_search.cc b/src/cmdline/cmdline_search.cc
index 6e811db9..cae90e9f 100644
--- a/src/cmdline/cmdline_search.cc
+++ b/src/cmdline/cmdline_search.cc
@@ -98,15 +98,12 @@ namespace
const shared_ptr<terminal_metrics> &term_metrics,
const shared_ptr<terminal_output> &term_output)
{
- typedef std::vector<std::pair<pkgCache::PkgIterator, ref_ptr<structural_match> > >
- results_list;
-
const shared_ptr<progress> search_progress_display =
create_progress_display(term_locale, term_metrics, term_output);
const shared_ptr<throttle> search_progress_throttle =
create_throttle();
- results_list output;
+ pkg_results_list output;
ref_ptr<search_cache> search_info(search_cache::create());
for(std::vector<ref_ptr<pattern> >::const_iterator pIt = patterns.begin();
pIt != patterns.end(); ++pIt)
@@ -137,7 +134,7 @@ namespace
aptitude::cmdline::package_results_eq(sort_policy)),
output.end());
- for(results_list::const_iterator it = output.begin(); it != output.end(); ++it)
+ for(pkg_results_list::const_iterator it = output.begin(); it != output.end(); ++it)
{
column_parameters *p =
new aptitude::cmdline::search_result_column_parameters(it->second);
diff --git a/src/cmdline/cmdline_show.cc b/src/cmdline/cmdline_show.cc
index 287404ac..443eaf28 100644
--- a/src/cmdline/cmdline_show.cc
+++ b/src/cmdline/cmdline_show.cc
@@ -604,15 +604,16 @@ bool do_cmdline_show(string s, int verbose, const shared_ptr<terminal_metrics> &
return false;
}
- std::vector<std::pair<pkgCache::PkgIterator, ref_ptr<structural_match> > > matches;
+ pkg_results_list matches;
ref_ptr<search_cache> search_info(search_cache::create());
search(p, search_info,
matches,
*apt_cache_file,
*apt_package_records);
- for(std::vector<std::pair<pkgCache::PkgIterator, ref_ptr<structural_match> > >::const_iterator
- it = matches.begin(); it != matches.end(); ++it)
+ for(pkg_results_list::const_iterator it = matches.begin();
+ it != matches.end();
+ ++it)
{
if(!do_cmdline_show_target(it->first,
source,
diff --git a/src/cmdline/cmdline_user_tag.cc b/src/cmdline/cmdline_user_tag.cc
index e3cd7726..3cc29618 100644
--- a/src/cmdline/cmdline_user_tag.cc
+++ b/src/cmdline/cmdline_user_tag.cc
@@ -149,15 +149,16 @@ namespace aptitude
}
else
{
- std::vector<std::pair<pkgCache::PkgIterator, ref_ptr<structural_match> > > matches;
+ pkg_results_list matches;
ref_ptr<search_cache> search_info(search_cache::create());
search(p, search_info,
matches,
*apt_cache_file,
*apt_package_records);
- for(std::vector<std::pair<pkgCache::PkgIterator, ref_ptr<structural_match> > >::const_iterator
- it = matches.begin(); it != matches.end(); ++it)
+ for(pkg_results_list::const_iterator it = matches.begin();
+ it != matches.end();
+ ++it)
do_user_tag(action, tag, it->first, verbose);
}
}
diff --git a/src/generic/apt/matching/match.cc b/src/generic/apt/matching/match.cc
index 6e3a1763..0fc2e191 100644
--- a/src/generic/apt/matching/match.cc
+++ b/src/generic/apt/matching/match.cc
@@ -3082,7 +3082,7 @@ namespace aptitude
void search(const ref_ptr<pattern> &p,
const ref_ptr<search_cache> &search_info,
- std::vector<std::pair<pkgCache::PkgIterator, ref_ptr<structural_match> > > &matches,
+ pkg_results_list &matches,
aptitudeDepCache &cache,
pkgRecords &records,
bool debug,
@@ -3193,7 +3193,7 @@ namespace aptitude
void search_versions(const ref_ptr<pattern> &p,
const ref_ptr<search_cache> &search_info,
- std::vector<std::pair<pkgCache::VerIterator, ref_ptr<structural_match> > > &matches,
+ ver_results_list &matches,
aptitudeDepCache &cache,
pkgRecords &records,
bool debug,
diff --git a/src/generic/apt/matching/match.h b/src/generic/apt/matching/match.h
index 8be78aa8..c4fe77ba 100644
--- a/src/generic/apt/matching/match.h
+++ b/src/generic/apt/matching/match.h
@@ -47,6 +47,12 @@ namespace aptitude
namespace matching
{
+ class structural_match;
+ typedef std::vector< std::pair< pkgCache::PkgIterator,
+ cwidget::util::ref_ptr<structural_match> > > pkg_results_list;
+ typedef std::vector< std::pair< pkgCache::VerIterator,
+ cwidget::util::ref_ptr<structural_match> > > ver_results_list;
+
/** \brief Represents the atomic values that are selected by search
* patterns.
*
@@ -120,8 +126,6 @@ namespace aptitude
}
};
- class structural_match;
-
/** \brief Represents information about how a package was matched.
*
* This only represents the information that can't be derived
@@ -703,7 +707,7 @@ namespace aptitude
*/
void search(const cwidget::util::ref_ptr<pattern> &p,
const cwidget::util::ref_ptr<search_cache> &search_info,
- std::vector<std::pair<pkgCache::PkgIterator, cwidget::util::ref_ptr<structural_match> > > &matches,
+ pkg_results_list &matches,
aptitudeDepCache &cache,
pkgRecords &records,
bool debug = false,
@@ -727,7 +731,7 @@ namespace aptitude
*/
void search_versions(const cwidget::util::ref_ptr<pattern> &p,
const cwidget::util::ref_ptr<search_cache> &search_info,
- std::vector<std::pair<pkgCache::VerIterator, cwidget::util::ref_ptr<structural_match> > > &matches,
+ ver_results_list &matches,
aptitudeDepCache &cache,
pkgRecords &records,
bool debug = false,
diff --git a/src/gtk/pkgview.cc b/src/gtk/pkgview.cc
index 4f0a6741..c8fd0abc 100644
--- a/src/gtk/pkgview.cc
+++ b/src/gtk/pkgview.cc
@@ -514,7 +514,7 @@ namespace gui
bool limited = limit.valid();
- std::vector<std::pair<pkgCache::PkgIterator, ref_ptr<structural_match> > > matches;
+ pkg_results_list matches;
ref_ptr<search_cache> search_info(search_cache::create());
if(limited)
{
@@ -523,8 +523,9 @@ namespace gui
int num = 0;
const int total = static_cast<int>(matches.size());
- for(std::vector<std::pair<pkgCache::PkgIterator, ref_ptr<structural_match> > >::const_iterator
- it = matches.begin(); it != matches.end(); ++it)
+ for(pkg_results_list::const_iterator it = matches.begin();
+ it != matches.end();
+ ++it)
{
if(canceled->is_canceled())
return;