diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2012-10-04 22:33:17 +0200 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2012-10-18 16:59:57 +0200 |
commit | 8db773cfeca87f797486a37a5cadd385896b6460 (patch) | |
tree | 60d6e9d91ece00e1d62a43553e4b68db1822187c /src/song.cpp | |
parent | 5908250c18b77a0a0b1d80cc078174e497b66fb9 (diff) |
replace a few string algorithms with boost utilities
Diffstat (limited to 'src/song.cpp')
-rw-r--r-- | src/song.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/song.cpp b/src/song.cpp index 7894224d..cbbbd765 100644 --- a/src/song.cpp +++ b/src/song.cpp @@ -20,11 +20,12 @@ #include <cassert> #include <cstring> +#include <boost/format.hpp> +#include <boost/lexical_cast.hpp> #include <iostream> #include <memory> #include "song.h" -#include "utility/numeric_conversions.h" #include "utility/type_conversions.h" #include "utility/wide_string.h" #include "window.h" @@ -193,7 +194,7 @@ std::string Song::getPriority(unsigned idx) const assert(m_song); if (idx > 0) return ""; - return unsignedIntTo<std::string>::apply(getPrio()); + return boost::lexical_cast<std::string>(getPrio()); } std::string MPD::Song::getTags(GetFunction f, const std::string &tags_separator) const @@ -281,9 +282,9 @@ std::string Song::ShowTime(unsigned length) std::string result; if (hours > 0) - result = print<32, std::string>::apply("%d:%02d:%02d", hours, minutes, seconds); + result = (boost::format("%d:%02d:%02d") % hours % minutes % seconds).str(); else - result = print<32, std::string>::apply("%d:%02d", minutes, seconds); + result = (boost::format("%d:%02d") % minutes % seconds).str(); return result; } @@ -309,7 +310,7 @@ bool MPD::Song::isFormatOk(const std::string &type, const std::string &fmt) while (isdigit(fmt[++i])) { } if (!charToGetFunction(fmt[i])) { - std::cerr << type << ": invalid character at position " << unsignedLongIntTo<std::string>::apply(i+1) << ": '" << fmt[i] << "'\n"; + std::cerr << type << ": invalid character at position " << boost::lexical_cast<std::string>(i+1) << ": '" << fmt[i] << "'\n"; return false; } } |