refactor(stringstream): Shorten to sstream

This commit is contained in:
Michael Carlberg 2017-01-13 13:51:16 +01:00
parent 977efd15e5
commit dceb3606b1
4 changed files with 8 additions and 8 deletions

View File

@ -29,17 +29,17 @@ namespace {
} }
} }
class stringstream { class sstream {
public: public:
stringstream() : m_stream() {} sstream() : m_stream() {}
template <typename T> template <typename T>
stringstream& operator<<(const T& object) { sstream& operator<<(const T& object) {
m_stream << object; m_stream << object;
return *this; return *this;
} }
stringstream& operator<<(const char* cz) { sstream& operator<<(const char* cz) {
m_stream << cz; m_stream << cz;
return *this; return *this;
} }

View File

@ -193,8 +193,8 @@ namespace net {
suffixes.pop_back(); suffixes.pop_back();
} }
return stringstream() << std::setw(minwidth) << std::setfill(' ') << std::setprecision(0) << std::fixed << speedrate return sstream() << std::setw(minwidth) << std::setfill(' ') << std::setprecision(0) << std::fixed << speedrate
<< " " << suffix << "/s"; << " " << suffix << "/s";
} }
// }}} // }}}

View File

@ -394,7 +394,7 @@ namespace modules {
workspace_n++; workspace_n++;
if (m_click) { 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 { } else {
builder->node(ws.second); builder->node(ws.second);
} }

View File

@ -107,7 +107,7 @@ Visual* connection::visual(uint8_t depth) {
* Create X window id string * Create X window id string
*/ */
string connection::id(xcb_window_t w) const { 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;
} }
/** /**