From dceb3606b1799a0194377b9b9031d36832af339a Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Fri, 13 Jan 2017 13:51:16 +0100 Subject: [PATCH] refactor(stringstream): Shorten to sstream --- include/utils/string.hpp | 8 ++++---- src/adapters/net.cpp | 4 ++-- src/modules/bspwm.cpp | 2 +- src/x11/connection.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/utils/string.hpp b/include/utils/string.hpp index df56611c..02dcc5e5 100644 --- a/include/utils/string.hpp +++ b/include/utils/string.hpp @@ -29,17 +29,17 @@ namespace { } } -class stringstream { +class sstream { public: - stringstream() : m_stream() {} + sstream() : m_stream() {} template - stringstream& operator<<(const T& object) { + sstream& operator<<(const T& object) { m_stream << object; return *this; } - stringstream& operator<<(const char* cz) { + sstream& operator<<(const char* cz) { m_stream << cz; return *this; } diff --git a/src/adapters/net.cpp b/src/adapters/net.cpp index 992e0579..3418e3bf 100644 --- a/src/adapters/net.cpp +++ b/src/adapters/net.cpp @@ -193,8 +193,8 @@ namespace net { suffixes.pop_back(); } - return stringstream() << std::setw(minwidth) << std::setfill(' ') << std::setprecision(0) << std::fixed << speedrate - << " " << suffix << "/s"; + return sstream() << std::setw(minwidth) << std::setfill(' ') << std::setprecision(0) << std::fixed << speedrate + << " " << suffix << "/s"; } // }}} diff --git a/src/modules/bspwm.cpp b/src/modules/bspwm.cpp index 21da9f18..3018ec23 100644 --- a/src/modules/bspwm.cpp +++ b/src/modules/bspwm.cpp @@ -394,7 +394,7 @@ namespace modules { workspace_n++; if (m_click) { - builder->cmd(mousebtn::LEFT, stringstream() << EVENT_CLICK << m_index << "+" << workspace_n, ws.second); + builder->cmd(mousebtn::LEFT, sstream() << EVENT_CLICK << m_index << "+" << workspace_n, ws.second); } else { builder->node(ws.second); } diff --git a/src/x11/connection.cpp b/src/x11/connection.cpp index e75328b7..9ba95c65 100644 --- a/src/x11/connection.cpp +++ b/src/x11/connection.cpp @@ -107,7 +107,7 @@ Visual* connection::visual(uint8_t depth) { * Create X window id string */ string connection::id(xcb_window_t w) const { - return stringstream() << "0x" << std::hex << std::setw(7) << std::setfill('0') << w; + return sstream() << "0x" << std::hex << std::setw(7) << std::setfill('0') << w; } /**