More utos() cleanups

I found a few other places where I can use utos() instead of
stringstreams.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-01-27 14:02:47 -05:00
parent 12260a3de9
commit ed43fd3689
3 changed files with 11 additions and 16 deletions

View File

@ -2,17 +2,15 @@
* @file * @file
* Copyright 2014 (c) Anna Schumaker. * Copyright 2014 (c) Anna Schumaker.
*/ */
#include <core/string.h>
#include <core/tags/album.h> #include <core/tags/album.h>
#include <sstream>
static Database<Album> album_db("album.db", true); static Database<Album> album_db("album.db", true);
static const std::string make_key(const std::string &name, unsigned int year) static const std::string make_key(const std::string &name, unsigned int year)
{ {
std::stringstream ss; return string :: utos(year) + "/" + name;
ss << year << "/" << name;
return ss.str();
} }

View File

@ -6,7 +6,6 @@
#include <core/string.h> #include <core/string.h>
#include <core/tags/track.h> #include <core/tags/track.h>
#include <sstream>
#include <stdlib.h> #include <stdlib.h>
@ -81,10 +80,9 @@ const std::string Track :: path() const
const std::string Track :: primary_key() const const std::string Track :: primary_key() const
{ {
std::stringstream ss;
if (_library) if (_library)
ss << _library->index() << "/" << _path; return string :: utos(_library->index()) + "/" + _path;
return ss.str(); return "";
} }
void Track :: played() void Track :: played()

View File

@ -3,10 +3,9 @@
*/ */
#include <core/callback.h> #include <core/callback.h>
#include <core/deck.h> #include <core/deck.h>
#include <core/string.h>
#include <gui/tabs.h> #include <gui/tabs.h>
#include <map>
static unsigned int q_col_width[] = { 20, 300, 60, 100, 100, 45, 100, 60, 1 }; 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() void QueueTab :: tab_set_size()
{ {
std::stringstream ss; std::string span = "<span size='x-large'>";
ss << "<span size='x-large'>" << tab_pq->size() << "</span>"; span += string :: utos(tab_pq->size()) + "</span>";
q_tab_size.set_markup(ss.str()); q_tab_size.set_markup(span);
} }
void QueueTab :: queue_set_number(unsigned int num) void QueueTab :: queue_set_number(unsigned int num)
{ {
std::stringstream ss; std::string span = "<span size='x-large'>";
ss << "<span size='x-large'>" << num << ". </span>"; span += string :: utos(num) + ". </span>";
q_tab_number.set_markup(ss.str()); q_tab_number.set_markup(span);
} }
void QueueTab :: on_tab_reordered() void QueueTab :: on_tab_reordered()