Skip to content

Commit 91cf509

Browse files
authored
Merge pull request #270 from Libvisual/c++11-override-final
Core (lv-tool): Apply 'override' and 'final' to classes.
2 parents d2b207b + 95f913b commit 91cf509

File tree

6 files changed

+53
-52
lines changed

6 files changed

+53
-52
lines changed

libvisual/tools/lv-tool/display/display.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131

3232
class DisplayDriver;
3333

34-
class Display {
34+
class Display final
35+
{
3536
public:
3637

3738
explicit Display (std::string const& driver_name);
@@ -74,7 +75,7 @@ class Display {
7475
const std::unique_ptr<Impl> m_impl;
7576
};
7677

77-
class DisplayLock
78+
class DisplayLock final
7879
{
7980
public:
8081

libvisual/tools/lv-tool/display/display_driver_factory.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ typedef std::function<DisplayDriver* (Display& display)> DisplayDriverCreator;
3434

3535
typedef std::vector<std::string> DisplayDriverList;
3636

37-
class DisplayDriverFactory
37+
class DisplayDriverFactory final
3838
{
3939
public:
4040

libvisual/tools/lv-tool/display/sdl_driver.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace {
5555

5656
void get_nearest_resolution (int& width, int& height);
5757

58-
class SDLDriver
58+
class SDLDriver final
5959
: public DisplayDriver
6060
{
6161
public:
@@ -72,16 +72,16 @@ namespace {
7272
, m_running (false)
7373
{}
7474

75-
virtual ~SDLDriver ()
75+
~SDLDriver () override
7676
{
7777
close ();
7878
}
7979

80-
virtual LV::VideoPtr create (VisVideoDepth depth,
81-
VisVideoAttrOptions const* vidoptions,
82-
unsigned int width,
83-
unsigned int height,
84-
bool resizable)
80+
LV::VideoPtr create (VisVideoDepth depth,
81+
VisVideoAttrOptions const* vidoptions,
82+
unsigned int width,
83+
unsigned int height,
84+
bool resizable) override
8585
{
8686

8787
int videoflags = 0;
@@ -151,7 +151,7 @@ namespace {
151151
return m_screen_video;
152152
}
153153

154-
virtual void close ()
154+
void close () override
155155
{
156156
if (!m_running)
157157
return;
@@ -163,24 +163,24 @@ namespace {
163163
m_running = false;
164164
}
165165

166-
virtual void lock ()
166+
void lock () override
167167
{
168168
if (SDL_MUSTLOCK (m_screen))
169169
SDL_LockSurface (m_screen);
170170
}
171171

172-
virtual void unlock ()
172+
void unlock () override
173173
{
174174
if (SDL_MUSTLOCK (m_screen) == SDL_TRUE)
175175
SDL_UnlockSurface (m_screen);
176176
}
177177

178-
virtual bool is_fullscreen () const
178+
bool is_fullscreen () const override
179179
{
180180
return m_screen->flags & SDL_FULLSCREEN;
181181
}
182182

183-
virtual void set_fullscreen (bool fullscreen, bool autoscale)
183+
void set_fullscreen (bool fullscreen, bool autoscale) override
184184
{
185185
if (fullscreen) {
186186
if (!(m_screen->flags & SDL_FULLSCREEN)) {
@@ -211,17 +211,17 @@ namespace {
211211
}
212212
}
213213

214-
virtual LV::VideoPtr get_video () const
214+
LV::VideoPtr get_video () const override
215215
{
216216
return m_screen_video;
217217
}
218218

219-
virtual void set_title(std::string const& title)
219+
void set_title(std::string const& title) override
220220
{
221221
SDL_WM_SetCaption (title.c_str(), nullptr);
222222
}
223223

224-
virtual void update_rect (LV::Rect const& rect)
224+
void update_rect (LV::Rect const& rect) override
225225
{
226226
if (m_screen->format->BitsPerPixel == 8) {
227227
auto const& pal = m_display.get_video ()->get_palette ();
@@ -246,7 +246,7 @@ namespace {
246246
SDL_UpdateRect (m_screen, rect.x, rect.y, rect.width, rect.height);
247247
}
248248

249-
virtual void drain_events (VisEventQueue& eventqueue)
249+
void drain_events (VisEventQueue& eventqueue) override
250250
{
251251
// Visible or not
252252

libvisual/tools/lv-tool/display/stdout_driver.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
namespace {
3838

39-
class StdoutDriver
39+
class StdoutDriver final
4040
: public DisplayDriver
4141
{
4242
public:
@@ -46,16 +46,16 @@ namespace {
4646
(void)display;
4747
}
4848

49-
virtual ~StdoutDriver ()
49+
~StdoutDriver () override
5050
{
5151
close ();
5252
}
5353

54-
virtual LV::VideoPtr create (VisVideoDepth depth,
55-
VisVideoAttrOptions const* vidoptions,
56-
unsigned int width,
57-
unsigned int height,
58-
bool resizable)
54+
LV::VideoPtr create (VisVideoDepth depth,
55+
VisVideoAttrOptions const* vidoptions,
56+
unsigned int width,
57+
unsigned int height,
58+
bool resizable) override
5959
{
6060
(void)vidoptions;
6161
(void)resizable;
@@ -71,55 +71,55 @@ namespace {
7171
return m_screen_video;
7272
}
7373

74-
virtual void close ()
74+
void close () override
7575
{
7676
m_screen_video.reset ();
7777
}
7878

79-
virtual void lock ()
79+
void lock () override
8080
{
8181
// nothing to do
8282
}
8383

84-
virtual void unlock ()
84+
void unlock () override
8585
{
8686
// nothing to do
8787
}
8888

89-
virtual bool is_fullscreen () const
89+
bool is_fullscreen () const override
9090
{
9191
return false;
9292
}
9393

94-
virtual void set_fullscreen (bool fullscreen, bool autoscale)
94+
void set_fullscreen (bool fullscreen, bool autoscale) override
9595
{
9696
(void)fullscreen;
9797
(void)autoscale;
9898

9999
// nothing to do
100100
}
101101

102-
virtual LV::VideoPtr get_video () const
102+
LV::VideoPtr get_video () const override
103103
{
104104
return m_screen_video;
105105
}
106106

107-
virtual void set_title(std::string const& title)
107+
void set_title(std::string const& title) override
108108
{
109109
(void)title;
110110

111111
// nothing to do
112112
}
113113

114-
virtual void update_rect (LV::Rect const& rect)
114+
void update_rect (LV::Rect const& rect) override
115115
{
116116
(void)rect;
117117

118118
if (write (STDOUT_FILENO, m_screen_video->get_pixels (), m_screen_video->get_size ()) == -1)
119119
visual_log (VISUAL_LOG_ERROR, "Failed to write pixels to stdout");
120120
}
121121

122-
virtual void drain_events (VisEventQueue& eventqueue)
122+
void drain_events (VisEventQueue& eventqueue) override
123123
{
124124
(void)eventqueue;
125125

libvisual/tools/lv-tool/display/stdout_sdl_driver.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace {
6666

6767
void get_nearest_resolution (int& width, int& height);
6868

69-
class StdoutSDLDriver
69+
class StdoutSDLDriver final
7070
: public DisplayDriver
7171
{
7272
public:
@@ -83,16 +83,16 @@ namespace {
8383
, m_running (false)
8484
{}
8585

86-
virtual ~StdoutSDLDriver ()
86+
~StdoutSDLDriver () override
8787
{
8888
close ();
8989
}
9090

91-
virtual LV::VideoPtr create (VisVideoDepth depth,
92-
VisVideoAttrOptions const* vidoptions,
93-
unsigned int width,
94-
unsigned int height,
95-
bool resizable)
91+
LV::VideoPtr create (VisVideoDepth depth,
92+
VisVideoAttrOptions const* vidoptions,
93+
unsigned int width,
94+
unsigned int height,
95+
bool resizable) override
9696
{
9797

9898
int videoflags = 0;
@@ -170,7 +170,7 @@ namespace {
170170
return m_screen_video;
171171
}
172172

173-
virtual void close ()
173+
void close () override
174174
{
175175
if (!m_running)
176176
return;
@@ -180,24 +180,24 @@ namespace {
180180
m_running = false;
181181
}
182182

183-
virtual void lock ()
183+
void lock () override
184184
{
185185
if (SDL_MUSTLOCK (m_screen))
186186
SDL_LockSurface (m_screen);
187187
}
188188

189-
virtual void unlock ()
189+
void unlock () override
190190
{
191191
if (SDL_MUSTLOCK (m_screen) == SDL_TRUE)
192192
SDL_UnlockSurface (m_screen);
193193
}
194194

195-
virtual bool is_fullscreen () const
195+
bool is_fullscreen () const override
196196
{
197197
return m_screen->flags & SDL_FULLSCREEN;
198198
}
199199

200-
virtual void set_fullscreen (bool fullscreen, bool autoscale)
200+
void set_fullscreen (bool fullscreen, bool autoscale) override
201201
{
202202
if (fullscreen) {
203203
if (!(m_screen->flags & SDL_FULLSCREEN)) {
@@ -228,17 +228,17 @@ namespace {
228228
}
229229
}
230230

231-
virtual LV::VideoPtr get_video () const
231+
LV::VideoPtr get_video () const override
232232
{
233233
return m_screen_video;
234234
}
235235

236-
virtual void set_title(std::string const& title)
236+
void set_title(std::string const& title) override
237237
{
238238
SDL_WM_SetCaption (title.c_str(), nullptr);
239239
}
240240

241-
virtual void update_rect (LV::Rect const& rect)
241+
void update_rect (LV::Rect const& rect) override
242242
{
243243
if (m_screen->format->BitsPerPixel == 8) {
244244
auto const& pal = m_display.get_video ()->get_palette ();
@@ -291,7 +291,7 @@ namespace {
291291
}
292292
}
293293

294-
virtual void drain_events (VisEventQueue& eventqueue)
294+
void drain_events (VisEventQueue& eventqueue) override
295295
{
296296
// Visible or not
297297

libvisual/tools/lv-tool/lv-tool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ namespace {
9090
};
9191

9292
/** Class to manage LV's lifecycle */
93-
class Libvisual
93+
class Libvisual final
9494
{
9595
public:
9696

0 commit comments

Comments
 (0)