From ed43fd3689428d67eb932a86c898c49a4db5c536 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Tue, 27 Jan 2015 14:02:47 -0500 Subject: [PATCH] More utos() cleanups I found a few other places where I can use utos() instead of stringstreams. Signed-off-by: Anna Schumaker --- core/tags/album.cpp | 6 ++---- core/tags/track.cpp | 6 ++---- gui/queue.cpp | 15 +++++++-------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/core/tags/album.cpp b/core/tags/album.cpp index ef54ac84..e8bea2fa 100644 --- a/core/tags/album.cpp +++ b/core/tags/album.cpp @@ -2,17 +2,15 @@ * @file * Copyright 2014 (c) Anna Schumaker. */ +#include #include -#include static Database album_db("album.db", true); static const std::string make_key(const std::string &name, unsigned int year) { - std::stringstream ss; - ss << year << "/" << name; - return ss.str(); + return string :: utos(year) + "/" + name; } diff --git a/core/tags/track.cpp b/core/tags/track.cpp index 09384381..a3bf800e 100644 --- a/core/tags/track.cpp +++ b/core/tags/track.cpp @@ -6,7 +6,6 @@ #include #include -#include #include @@ -81,10 +80,9 @@ const std::string Track :: path() const const std::string Track :: primary_key() const { - std::stringstream ss; if (_library) - ss << _library->index() << "/" << _path; - return ss.str(); + return string :: utos(_library->index()) + "/" + _path; + return ""; } void Track :: played() diff --git a/gui/queue.cpp b/gui/queue.cpp index 198ad424..c8019957 100644 --- a/gui/queue.cpp +++ b/gui/queue.cpp @@ -3,10 +3,9 @@ */ #include #include +#include #include -#include - static unsigned int q_col_width[] = { 20, 300, 60, 100, 100, 45, 100, 60, 1 }; @@ -252,16 +251,16 @@ bool QueueTab :: on_key_press_event(const std::string &key) void QueueTab :: tab_set_size() { - std::stringstream ss; - ss << "" << tab_pq->size() << ""; - q_tab_size.set_markup(ss.str()); + std::string span = ""; + span += string :: utos(tab_pq->size()) + ""; + q_tab_size.set_markup(span); } void QueueTab :: queue_set_number(unsigned int num) { - std::stringstream ss; - ss << "" << num << ". "; - q_tab_number.set_markup(ss.str()); + std::string span = ""; + span += string :: utos(num) + ". "; + q_tab_number.set_markup(span); } void QueueTab :: on_tab_reordered()