make use of std::make_pair

This commit is contained in:
unK
2008-09-21 23:53:22 +02:00
parent d992af15b0
commit 40abeaac2c
5 changed files with 17 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
AC_INIT(configure.in) AC_INIT(configure.in)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(ncmpcpp, 0.2.3) AM_INIT_AUTOMAKE(ncmpcpp, 0.2.4_pre)
AC_PREREQ(2.59) AC_PREREQ(2.59)

View File

@@ -1160,7 +1160,7 @@ int main(int argc, char *argv[])
int found = mSearcher->Size()-search_engine_static_options; int found = mSearcher->Size()-search_engine_static_options;
found += 3; // don't count options inserted below found += 3; // don't count options inserted below
mSearcher->InsertSeparator(14); mSearcher->InsertSeparator(14);
mSearcher->Insert(15, std::pair<string, Song>("[." + 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); mSearcher->InsertSeparator(16);
UpdateFoundList(); UpdateFoundList();
ShowMessage("Searching finished!"); ShowMessage("Searching finished!");

View File

@@ -43,6 +43,7 @@
#include "misc.h" #include "misc.h"
typedef std::pair<string, string> StringPair; typedef std::pair<string, string> StringPair;
using std::make_pair;
enum NcmpcppScreen enum NcmpcppScreen
{ {

View File

@@ -58,20 +58,20 @@ void PrepareSearchEngine(Song &s)
s.Clear(); s.Clear();
mSearcher->Clear(); mSearcher->Clear();
mSearcher->Reset(); mSearcher->Reset();
mSearcher->AddOption(std::pair<string, Song>("[.b]Filename:[/b] " + s.GetShortFilename(), Song())); mSearcher->AddOption(make_pair("[.b]Filename:[/b] " + s.GetShortFilename(), Song()));
mSearcher->AddOption(std::pair<string, Song>("[.b]Title:[/b] " + s.GetTitle(), Song())); mSearcher->AddOption(make_pair("[.b]Title:[/b] " + s.GetTitle(), Song()));
mSearcher->AddOption(std::pair<string, Song>("[.b]Artist:[/b] " + s.GetArtist(), Song())); mSearcher->AddOption(make_pair("[.b]Artist:[/b] " + s.GetArtist(), Song()));
mSearcher->AddOption(std::pair<string, Song>("[.b]Album:[/b] " + s.GetAlbum(), Song())); mSearcher->AddOption(make_pair("[.b]Album:[/b] " + s.GetAlbum(), Song()));
mSearcher->AddOption(std::pair<string, Song>("[.b]Year:[/b] " + s.GetYear(), Song())); mSearcher->AddOption(make_pair("[.b]Year:[/b] " + s.GetYear(), Song()));
mSearcher->AddOption(std::pair<string, Song>("[.b]Track:[/b] " + s.GetTrack(), Song())); mSearcher->AddOption(make_pair("[.b]Track:[/b] " + s.GetTrack(), Song()));
mSearcher->AddOption(std::pair<string, Song>("[.b]Genre:[/b] " + s.GetGenre(), Song())); mSearcher->AddOption(make_pair("[.b]Genre:[/b] " + s.GetGenre(), Song()));
mSearcher->AddOption(std::pair<string, Song>("[.b]Comment:[/b] " + s.GetComment(), Song())); mSearcher->AddOption(make_pair("[.b]Comment:[/b] " + s.GetComment(), Song()));
mSearcher->AddSeparator(); mSearcher->AddSeparator();
mSearcher->AddOption(std::pair<string, Song>("[.b]Search mode:[/b] " + (search_match_to_pattern ? search_mode_normal : search_mode_strict), Song())); mSearcher->AddOption(make_pair("[.b]Search mode:[/b] " + (search_match_to_pattern ? search_mode_normal : search_mode_strict), Song()));
mSearcher->AddOption(std::pair<string, Song>("[.b]Case sensitive:[/b] " + (string)(search_case_sensitive ? "Yes" : "No"), Song())); mSearcher->AddOption(make_pair("[.b]Case sensitive:[/b] " + (string)(search_case_sensitive ? "Yes" : "No"), Song()));
mSearcher->AddSeparator(); mSearcher->AddSeparator();
mSearcher->AddOption(std::pair<string, Song>("Search", Song())); mSearcher->AddOption(make_pair("Search", Song()));
mSearcher->AddOption(std::pair<string, Song>("Reset", Song())); mSearcher->AddOption(make_pair("Reset", Song()));
} }
void Search(Song &s) void Search(Song &s)
@@ -188,7 +188,7 @@ void Search(Song &s)
} }
if (found) if (found)
mSearcher->AddOption(std::pair<string, Song>(".", **it)); mSearcher->AddOption(make_pair(".", **it));
found = 1; found = 1;
} }
FreeSongList(list); FreeSongList(list);

View File

@@ -201,7 +201,7 @@ string ParseFilename(Song &s, string mask, bool preview)
{ {
for (int i = mask.find("%"); i != string::npos; i = mask.find("%")) for (int i = mask.find("%"); i != string::npos; i = mask.find("%"))
{ {
tags.push_back(std::pair<char, string>(mask.at(i+1), "")); tags.push_back(make_pair(mask.at(i+1), ""));
mask = mask.substr(i+2); mask = mask.substr(i+2);
i = mask.find("%"); i = mask.find("%");
if (!mask.empty()) if (!mask.empty())