From 40abeaac2cea226f351ded5732b519ab9610a4c4 Mon Sep 17 00:00:00 2001 From: unK Date: Sun, 21 Sep 2008 23:53:22 +0200 Subject: [PATCH] make use of std::make_pair --- configure.in | 2 +- src/ncmpcpp.cpp | 2 +- src/ncmpcpp.h | 1 + src/search_engine.cpp | 26 +++++++++++++------------- src/tag_editor.cpp | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/configure.in b/configure.in index e9532954..1adbfbbc 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ AC_INIT(configure.in) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(ncmpcpp, 0.2.3) +AM_INIT_AUTOMAKE(ncmpcpp, 0.2.4_pre) AC_PREREQ(2.59) diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index ed8d970f..7b086361 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -1160,7 +1160,7 @@ int main(int argc, char *argv[]) int found = mSearcher->Size()-search_engine_static_options; found += 3; // don't count options inserted below mSearcher->InsertSeparator(14); - mSearcher->Insert(15, std::pair("[." + Config.color1 + "]Search results:[/" + Config.color1 + "] [." + Config.color2 + "]Found " + IntoStr(found) + (found > 1 ? " songs" : " song") + "[/" + Config.color2 + "]", Song()), 1, 1); + mSearcher->Insert(15, make_pair("[." + Config.color1 + "]Search results:[/" + Config.color1 + "] [." + Config.color2 + "]Found " + IntoStr(found) + (found > 1 ? " songs" : " song") + "[/" + Config.color2 + "]", Song()), 1, 1); mSearcher->InsertSeparator(16); UpdateFoundList(); ShowMessage("Searching finished!"); diff --git a/src/ncmpcpp.h b/src/ncmpcpp.h index 542903ad..61f3a1cb 100644 --- a/src/ncmpcpp.h +++ b/src/ncmpcpp.h @@ -43,6 +43,7 @@ #include "misc.h" typedef std::pair StringPair; +using std::make_pair; enum NcmpcppScreen { diff --git a/src/search_engine.cpp b/src/search_engine.cpp index ff18bd1f..b46df812 100644 --- a/src/search_engine.cpp +++ b/src/search_engine.cpp @@ -58,20 +58,20 @@ void PrepareSearchEngine(Song &s) s.Clear(); mSearcher->Clear(); mSearcher->Reset(); - mSearcher->AddOption(std::pair("[.b]Filename:[/b] " + s.GetShortFilename(), Song())); - mSearcher->AddOption(std::pair("[.b]Title:[/b] " + s.GetTitle(), Song())); - mSearcher->AddOption(std::pair("[.b]Artist:[/b] " + s.GetArtist(), Song())); - mSearcher->AddOption(std::pair("[.b]Album:[/b] " + s.GetAlbum(), Song())); - mSearcher->AddOption(std::pair("[.b]Year:[/b] " + s.GetYear(), Song())); - mSearcher->AddOption(std::pair("[.b]Track:[/b] " + s.GetTrack(), Song())); - mSearcher->AddOption(std::pair("[.b]Genre:[/b] " + s.GetGenre(), Song())); - mSearcher->AddOption(std::pair("[.b]Comment:[/b] " + s.GetComment(), Song())); + mSearcher->AddOption(make_pair("[.b]Filename:[/b] " + s.GetShortFilename(), Song())); + mSearcher->AddOption(make_pair("[.b]Title:[/b] " + s.GetTitle(), Song())); + mSearcher->AddOption(make_pair("[.b]Artist:[/b] " + s.GetArtist(), Song())); + mSearcher->AddOption(make_pair("[.b]Album:[/b] " + s.GetAlbum(), Song())); + mSearcher->AddOption(make_pair("[.b]Year:[/b] " + s.GetYear(), Song())); + mSearcher->AddOption(make_pair("[.b]Track:[/b] " + s.GetTrack(), Song())); + mSearcher->AddOption(make_pair("[.b]Genre:[/b] " + s.GetGenre(), Song())); + mSearcher->AddOption(make_pair("[.b]Comment:[/b] " + s.GetComment(), Song())); mSearcher->AddSeparator(); - mSearcher->AddOption(std::pair("[.b]Search mode:[/b] " + (search_match_to_pattern ? search_mode_normal : search_mode_strict), Song())); - mSearcher->AddOption(std::pair("[.b]Case sensitive:[/b] " + (string)(search_case_sensitive ? "Yes" : "No"), Song())); + mSearcher->AddOption(make_pair("[.b]Search mode:[/b] " + (search_match_to_pattern ? search_mode_normal : search_mode_strict), Song())); + mSearcher->AddOption(make_pair("[.b]Case sensitive:[/b] " + (string)(search_case_sensitive ? "Yes" : "No"), Song())); mSearcher->AddSeparator(); - mSearcher->AddOption(std::pair("Search", Song())); - mSearcher->AddOption(std::pair("Reset", Song())); + mSearcher->AddOption(make_pair("Search", Song())); + mSearcher->AddOption(make_pair("Reset", Song())); } void Search(Song &s) @@ -188,7 +188,7 @@ void Search(Song &s) } if (found) - mSearcher->AddOption(std::pair(".", **it)); + mSearcher->AddOption(make_pair(".", **it)); found = 1; } FreeSongList(list); diff --git a/src/tag_editor.cpp b/src/tag_editor.cpp index fd8677d2..9ecff8f7 100644 --- a/src/tag_editor.cpp +++ b/src/tag_editor.cpp @@ -201,7 +201,7 @@ string ParseFilename(Song &s, string mask, bool preview) { for (int i = mask.find("%"); i != string::npos; i = mask.find("%")) { - tags.push_back(std::pair(mask.at(i+1), "")); + tags.push_back(make_pair(mask.at(i+1), "")); mask = mask.substr(i+2); i = mask.find("%"); if (!mask.empty())