1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2025-06-02 18:22:03 -04:00

refactor(core): Clean-up

- use "#pragma once" instead of the regular include guard
- fix errors and warnings reported by cppcheck
This commit is contained in:
Michael Carlberg 2016-05-31 05:58:58 +02:00
parent d0499d4d15
commit 39d3f61497
81 changed files with 588 additions and 730 deletions

View file

@ -1,5 +1,4 @@
#ifndef _DRAWTYPES_ANIMATION_HPP_
#define _DRAWTYPES_ANIMATION_HPP_
#pragma once
#include <string>
#include <vector>
@ -21,7 +20,7 @@ namespace drawtypes
public:
Animation(std::vector<std::unique_ptr<Icon>> &&frames, int framerate_ms = 1);
Animation(int framerate_ms)
explicit Animation(int framerate_ms)
: framerate_ms(framerate_ms){}
void add(std::unique_ptr<Icon> &&frame);
@ -37,5 +36,3 @@ namespace drawtypes
std::unique_ptr<Animation> get_config_animation(const std::string& config_path, const std::string& animation_name = "animation", bool required = true);
}
#endif

View file

@ -1,5 +1,4 @@
#ifndef _DRAWTYPES_BAR_HPP_
#define _DRAWTYPES_BAR_HPP_
#pragma once
#include <string>
#include <memory>
@ -16,7 +15,7 @@ namespace drawtypes
protected:
std::unique_ptr<Builder> builder;
std::vector<std::string> colors;
bool gradient;
bool gradient = false;
unsigned int width;
std::string format;
@ -25,7 +24,7 @@ namespace drawtypes
std::unique_ptr<Icon> indicator;
public:
Bar(int width, const std::string& format, bool lazy_builder_closing = true);
Bar(int width, const std::string& fmt, bool lazy_builder_closing = true);
Bar(int width, bool lazy_builder_closing = true)
: Bar(width, "<fill><indicator><empty>", lazy_builder_closing){}
@ -41,5 +40,3 @@ namespace drawtypes
std::unique_ptr<Bar> get_config_bar(const std::string& config_path, const std::string& bar_name = "bar", bool lazy_builder_closing = true);
}
#endif

View file

@ -1,5 +1,4 @@
#ifndef _DRAWTYPES_ICON_HPP_
#define _DRAWTYPES_ICON_HPP_
#pragma once
#include <string>
#include <vector>
@ -37,5 +36,3 @@ namespace drawtypes
std::unique_ptr<Icon> get_config_icon(const std::string& module_name, const std::string& icon_name = "icon", bool required = true, const std::string& def = "");
std::unique_ptr<Icon> get_optional_config_icon(const std::string& module_name, const std::string& icon_name = "icon", const std::string& def = "");
}
#endif

View file

@ -1,5 +1,4 @@
#ifndef _DRAWTYPES_LABEL_HPP_
#define _DRAWTYPES_LABEL_HPP_
#pragma once
#include <string>
#include <memory>
@ -29,5 +28,3 @@ namespace drawtypes
std::unique_ptr<Label> get_config_label(const std::string& module_name, const std::string& label_name = "label", bool required = true, const std::string& def = "");
std::unique_ptr<Label> get_optional_config_label(const std::string& module_name, const std::string& label_name = "label", const std::string& def = "");
}
#endif

View file

@ -1,5 +1,4 @@
#ifndef _DRAWTYPES_RAMP_HPP_
#define _DRAWTYPES_RAMP_HPP_
#pragma once
#include <string>
#include <vector>
@ -17,7 +16,7 @@ namespace drawtypes
public:
Ramp(){}
Ramp(std::vector<std::unique_ptr<Icon>> icons);
explicit Ramp(std::vector<std::unique_ptr<Icon>> icons);
void add(std::unique_ptr<Icon> &&icon);
std::unique_ptr<Icon> &get(int idx);
@ -30,5 +29,3 @@ namespace drawtypes
std::unique_ptr<Ramp> get_config_ramp(const std::string& module_name, const std::string& ramp_name = "ramp", bool required = true);
}
#endif