Clean up virtual, override, default, and void params. NFC.

Found by clang-tidy.
pull/487/head
Ryan Pavlik 2019-09-10 12:47:34 -05:00 committed by whitequark
parent ae417fc14c
commit a0e992374d
7 changed files with 31 additions and 30 deletions

View File

@ -45,7 +45,7 @@ public:
Expr *b;
};
Expr() { }
Expr() = default;
Expr(double val) : op(Op::CONSTANT) { v = val; }
static inline Expr *AllocExpr()

View File

@ -49,7 +49,7 @@ bool Group::IsVisible() {
return true;
}
size_t Group::GetNumConstraints(void) {
size_t Group::GetNumConstraints() {
return SK.constraint.CountIf([&](Constraint const & c) { return c.group == h; });
}

View File

@ -107,7 +107,7 @@ void FatalError(std::string message);
// A native settings store.
class Settings {
public:
virtual ~Settings() {}
virtual ~Settings() = default;
virtual void FreezeInt(const std::string &key, uint32_t value) = 0;
virtual uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) = 0;
@ -135,7 +135,7 @@ class Timer {
public:
std::function<void()> onTimeout;
virtual ~Timer() {}
virtual ~Timer() = default;
virtual void RunAfter(unsigned milliseconds) = 0;
virtual void RunAfterNextFrame() { RunAfter(1); }
@ -157,7 +157,7 @@ public:
std::function<void()> onTrigger;
virtual ~MenuItem() {}
virtual ~MenuItem() = default;
virtual void SetAccelerator(KeyboardEvent accel) = 0;
virtual void SetIndicator(Indicator type) = 0;
@ -170,7 +170,7 @@ typedef std::shared_ptr<MenuItem> MenuItemRef;
// A native menu.
class Menu {
public:
virtual ~Menu() {}
virtual ~Menu() = default;
virtual std::shared_ptr<MenuItem> AddItem(
const std::string &label, std::function<void()> onTrigger = std::function<void()>(),
@ -188,7 +188,7 @@ typedef std::shared_ptr<Menu> MenuRef;
// A native menu bar.
class MenuBar {
public:
virtual ~MenuBar() {}
virtual ~MenuBar() = default;
virtual std::shared_ptr<Menu> AddSubMenu(const std::string &label) = 0;
@ -222,7 +222,7 @@ public:
std::function<void(double)> onScrollbarAdjusted;
std::function<void()> onRender;
virtual ~Window() {}
virtual ~Window() = default;
// Returns physical display DPI.
virtual double GetPixelDensity() = 0;
@ -299,7 +299,7 @@ public:
std::function<void(Response)> onResponse;
virtual ~MessageDialog() {}
virtual ~MessageDialog() = default;
virtual void SetType(Type type) = 0;
virtual void SetTitle(std::string title) = 0;
@ -347,7 +347,7 @@ extern std::vector<FileFilter> CsvFileFilters;
// A native dialog that asks to choose a file.
class FileDialog {
public:
virtual ~FileDialog() {}
virtual ~FileDialog() = default;
virtual void SetTitle(std::string title) = 0;
virtual void SetCurrentName(std::string name) = 0;

View File

@ -124,7 +124,7 @@ public:
}
}
~SettingsImplGtk() {
~SettingsImplGtk() override {
if(!_path.IsEmpty()) {
// json-c <0.12 has the first argument non-const
if(json_object_to_file_ext((char *)_path.raw.c_str(), _json,

View File

@ -53,22 +53,24 @@ void FatalError(std::string message) {
class SettingsImplDummy final : public Settings {
public:
void FreezeInt(const std::string &key, uint32_t value) {}
void FreezeInt(const std::string &key, uint32_t value) override {
}
uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) {
uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) override {
return defaultValue;
}
void FreezeFloat(const std::string &key, double value) {}
void FreezeFloat(const std::string &key, double value) override {
}
double ThawFloat(const std::string &key, double defaultValue = 0.0) {
double ThawFloat(const std::string &key, double defaultValue = 0.0) override {
return defaultValue;
}
void FreezeString(const std::string &key, const std::string &value) {}
void FreezeString(const std::string &key, const std::string &value) override {
}
std::string ThawString(const std::string &key,
const std::string &defaultValue = "") {
std::string ThawString(const std::string &key, const std::string &defaultValue = "") override {
return defaultValue;
}
};

View File

@ -54,8 +54,7 @@ void *AllocTemporary(size_t n)
return (void *)&h[1];
}
void FreeAllTemporary(void)
{
void FreeAllTemporary() {
AllocTempHeader *h = Head;
while(h) {
AllocTempHeader *f = h;

View File

@ -727,8 +727,8 @@ public:
// Data
EdgeRenderer::Handle handle;
virtual Canvas::Layer GetLayer() const override { return stroke.layer; };
virtual int GetZIndex() const override { return stroke.zIndex; };
Canvas::Layer GetLayer() const override { return stroke.layer; }
int GetZIndex() const override { return stroke.zIndex; }
static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SEdgeList &el,
Canvas::Stroke *stroke) {
@ -757,8 +757,8 @@ public:
OutlineRenderer::Handle handle;
Canvas::DrawOutlinesAs drawAs;
virtual Canvas::Layer GetLayer() const override { return stroke.layer; };
virtual int GetZIndex() const override { return stroke.zIndex; };
Canvas::Layer GetLayer() const override { return stroke.layer; }
int GetZIndex() const override { return stroke.zIndex; }
static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SOutlineList &ol,
Canvas::Stroke *stroke,
@ -788,8 +788,8 @@ public:
// Data
IndexedMeshRenderer::Handle handle;
virtual Canvas::Layer GetLayer() const override { return stroke.layer; };
virtual int GetZIndex() const override { return stroke.zIndex; };
Canvas::Layer GetLayer() const override { return stroke.layer; }
int GetZIndex() const override { return stroke.zIndex; }
static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SIndexedMesh &mesh,
Canvas::Stroke *stroke) {
@ -817,8 +817,8 @@ public:
// Data
IndexedMeshRenderer::Handle handle;
virtual Canvas::Layer GetLayer() const override { return fill.layer; };
virtual int GetZIndex() const override { return fill.zIndex; };
Canvas::Layer GetLayer() const override { return fill.layer; }
int GetZIndex() const override { return fill.zIndex; }
static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SIndexedMesh &mesh,
Canvas::Fill *fill) {
@ -856,8 +856,8 @@ public:
bool hasFillBack;
bool isShaded;
virtual Canvas::Layer GetLayer() const override { return fillFront.layer; };
virtual int GetZIndex() const override { return fillFront.zIndex; };
Canvas::Layer GetLayer() const override { return fillFront.layer; }
int GetZIndex() const override { return fillFront.zIndex; }
static std::shared_ptr<DrawCall> Create(OpenGl3Renderer *renderer, const SMesh &m,
Canvas::Fill *fillFront, Canvas::Fill *fillBack = NULL,