refactor(clang-tidy): Apply fixes

This commit is contained in:
Michael Carlberg 2016-12-04 04:11:47 +01:00
parent 0cfddf7d72
commit 44da14755d
11 changed files with 25 additions and 19 deletions

View File

@ -32,7 +32,7 @@ class builder {
void node(string str, bool add_space = false); void node(string str, bool add_space = false);
void node(string str, int font_index, bool add_space = false); void node(string str, int font_index, bool add_space = false);
void node(const label_t& label, bool add_space = false); void node(const label_t& label, bool add_space = false);
void node_repeat(string str, size_t n, bool add_space = false); void node_repeat(const string& str, size_t n, bool add_space = false);
void node_repeat(const label_t& label, size_t n, bool add_space = false); void node_repeat(const label_t& label, size_t n, bool add_space = false);
void offset(int pixels = 0); void offset(int pixels = 0);
void space(int width = DEFAULT_SPACING); void space(int width = DEFAULT_SPACING);

View File

@ -16,9 +16,9 @@ namespace string_util {
string upper(const string& s); string upper(const string& s);
string lower(const string& s); string lower(const string& s);
bool compare(const string& s1, const string& s2); bool compare(const string& s1, const string& s2);
string replace(const string& haystack, const string& needle, const string& replacement, size_t start = 0, string replace(const string& haystack, const string& needle, const string& reply, size_t start = 0,
size_t end = string::npos); size_t end = string::npos);
string replace_all(const string& haystack, const string& needle, const string& replacement, size_t start = 0, string replace_all(const string& haystack, const string& needle, const string& reply, size_t start = 0,
size_t end = string::npos); size_t end = string::npos);
string squeeze(const string& haystack, char needle); string squeeze(const string& haystack, char needle);
string strip(const string& haystack, char needle); string strip(const string& haystack, char needle);

View File

@ -130,7 +130,7 @@ class tray_manager : public xpp::event::sink<evt::expose, evt::visibility_notify
void track_selection_owner(xcb_window_t owner); void track_selection_owner(xcb_window_t owner);
void process_docking_request(xcb_window_t win); void process_docking_request(xcb_window_t win);
void bar_visibility_change(bool state); void bar_visibility_change(bool visible);
int16_t calculate_x(uint16_t width) const; int16_t calculate_x(uint16_t width) const;
int16_t calculate_y() const; int16_t calculate_y() const;

View File

@ -61,7 +61,7 @@ class keyboard {
: layouts(forward<decltype(layouts)>(layouts_)), indicators(forward<decltype(indicators)>(indicators_)) {} : layouts(forward<decltype(layouts)>(layouts_)), indicators(forward<decltype(indicators)>(indicators_)) {}
const indicator& get(const indicator::type& i) const; const indicator& get(const indicator::type& i) const;
void set(uint32_t indicator_state); void set(uint32_t state);
bool on(const indicator::type&) const; bool on(const indicator::type&) const;
const string group_name(size_t index = 0) const; const string group_name(size_t index = 0) const;

View File

@ -250,7 +250,7 @@ void builder::node(const label_t& label, bool add_space) {
/** /**
* Repeat text string n times * Repeat text string n times
*/ */
void builder::node_repeat(string str, size_t n, bool add_space) { void builder::node_repeat(const string& str, size_t n, bool add_space) {
string text; string text;
while (n--) { while (n--) {
text += str; text += str;

View File

@ -1,8 +1,8 @@
#include <csignal> #include <csignal>
#include "components/eventloop.hpp" #include "components/eventloop.hpp"
#include "components/types.hpp"
#include "components/signals.hpp" #include "components/signals.hpp"
#include "components/types.hpp"
#include "utils/string.hpp" #include "utils/string.hpp"
#include "utils/time.hpp" #include "utils/time.hpp"
#include "x11/color.hpp" #include "x11/color.hpp"

View File

@ -2,11 +2,11 @@
#include <thread> #include <thread>
#include "components/config.hpp" #include "components/config.hpp"
#include "components/eventloop.hpp"
#include "components/logger.hpp" #include "components/logger.hpp"
#include "components/screen.hpp" #include "components/screen.hpp"
#include "components/types.hpp"
#include "components/signals.hpp" #include "components/signals.hpp"
#include "components/eventloop.hpp" #include "components/types.hpp"
#include "x11/connection.hpp" #include "x11/connection.hpp"
#include "x11/randr.hpp" #include "x11/randr.hpp"
#include "x11/winspec.hpp" #include "x11/winspec.hpp"

View File

@ -15,10 +15,12 @@ namespace {
uint32_t make_mask(bspwm_state s1, bspwm_state s2 = bspwm_state::NONE) { uint32_t make_mask(bspwm_state s1, bspwm_state s2 = bspwm_state::NONE) {
uint32_t mask{0U}; uint32_t mask{0U};
if (static_cast<uint32_t>(s1)) if (static_cast<uint32_t>(s1)) {
mask |= 1 << (static_cast<uint32_t>(s1) - 1); mask |= 1 << (static_cast<uint32_t>(s1) - 1);
if (static_cast<uint32_t>(s2)) }
if (static_cast<uint32_t>(s2)) {
mask |= 1 << (static_cast<uint32_t>(s2) - 1); mask |= 1 << (static_cast<uint32_t>(s2) - 1);
}
return mask; return mask;
} }
@ -327,16 +329,21 @@ namespace modules {
auto label = m_statelabels.at(workspace_mask)->clone(); auto label = m_statelabels.at(workspace_mask)->clone();
if (!m_monitors.back()->focused) { if (!m_monitors.back()->focused) {
if (m_statelabels[make_mask(state::DIMMED)]) if (m_statelabels[make_mask(state::DIMMED)]) {
label->replace_defined_values(m_statelabels[make_mask(state::DIMMED)]); label->replace_defined_values(m_statelabels[make_mask(state::DIMMED)]);
if (workspace_mask & make_mask(state::EMPTY)) }
if (workspace_mask & make_mask(state::EMPTY)) {
label->replace_defined_values(m_statelabels[make_mask(state::DIMMED, state::EMPTY)]); label->replace_defined_values(m_statelabels[make_mask(state::DIMMED, state::EMPTY)]);
if (workspace_mask & make_mask(state::OCCUPIED)) }
if (workspace_mask & make_mask(state::OCCUPIED)) {
label->replace_defined_values(m_statelabels[make_mask(state::DIMMED, state::OCCUPIED)]); label->replace_defined_values(m_statelabels[make_mask(state::DIMMED, state::OCCUPIED)]);
if (workspace_mask & make_mask(state::FOCUSED)) }
if (workspace_mask & make_mask(state::FOCUSED)) {
label->replace_defined_values(m_statelabels[make_mask(state::DIMMED, state::FOCUSED)]); label->replace_defined_values(m_statelabels[make_mask(state::DIMMED, state::FOCUSED)]);
if (workspace_mask & make_mask(state::URGENT)) }
if (workspace_mask & make_mask(state::URGENT)) {
label->replace_defined_values(m_statelabels[make_mask(state::DIMMED, state::URGENT)]); label->replace_defined_values(m_statelabels[make_mask(state::DIMMED, state::URGENT)]);
}
} }
label->reset_tokens(); label->reset_tokens();

View File

@ -1,8 +1,8 @@
#include <utility> #include <utility>
#include "components/builder.hpp" #include "components/builder.hpp"
#include "modules/meta/base.hpp"
#include "drawtypes/label.hpp" #include "drawtypes/label.hpp"
#include "modules/meta/base.hpp"
POLYBAR_NS POLYBAR_NS

View File

@ -3,9 +3,9 @@
#include "drawtypes/iconset.hpp" #include "drawtypes/iconset.hpp"
#include "drawtypes/label.hpp" #include "drawtypes/label.hpp"
#include "modules/xworkspaces.hpp" #include "modules/xworkspaces.hpp"
#include "utils/math.hpp"
#include "x11/atoms.hpp" #include "x11/atoms.hpp"
#include "x11/connection.hpp" #include "x11/connection.hpp"
#include "utils/math.hpp"
#include "modules/meta/base.inl" #include "modules/meta/base.inl"
#include "modules/meta/static_module.inl" #include "modules/meta/static_module.inl"

View File

@ -677,7 +677,6 @@ void tray_manager::notify_clients_delayed(chrono::duration<double, std::milli> d
this_thread::sleep_for(delay); this_thread::sleep_for(delay);
notify_clients(); notify_clients();
}); });
} }
/** /**