Mark classes as final

This may hint compiler to de-virtualise some calls.
This commit is contained in:
Michał Janiszewski 2016-10-04 19:14:29 +02:00 committed by Ted John
parent 4b92e5e820
commit 71d0861be1
35 changed files with 52 additions and 52 deletions

View File

@ -25,7 +25,7 @@ extern "C"
/**
* Class for enumerating and retrieving values for a set of command line arguments.
*/
class CommandLineArgEnumerator
class CommandLineArgEnumerator final
{
private:
const char * const * _arguments;

View File

@ -20,7 +20,7 @@
#include "../common.h"
struct file_info;
class FileEnumerator
class FileEnumerator final
{
private:
struct DirectoryState

View File

@ -30,7 +30,7 @@ enum
/**
* A stream for reading and writing to files. Wraps an SDL_RWops, SDL2's cross platform file stream.
*/
class FileStream : public IStream
class FileStream final : public IStream
{
private:
SDL_RWops * _file;

View File

@ -30,7 +30,7 @@ namespace Json
void WriteToFile(const utf8 * path, const json_t * json, size_t flags = 0);
}
class JsonException : public Exception
class JsonException final : public Exception
{
private:
json_error_t _jsonError = { 0 };

View File

@ -29,7 +29,7 @@ enum MEMORY_ACCESS
/**
* A stream for reading and writing to files. Wraps an SDL_RWops, SDL2's cross platform file stream.
*/
class MemoryStream : public IStream
class MemoryStream final : public IStream
{
private:
uint16 _access;

View File

@ -24,7 +24,7 @@ extern "C"
/**
* Class to accuately measure elapsed time with high precision.
*/
class Stopwatch
class Stopwatch final
{
private:
/** Number of ticks in a second. */

View File

@ -45,7 +45,7 @@ struct DirtyGrid
uint8 * Blocks;
};
class RainDrawer : public IRainDrawer
class RainDrawer final : public IRainDrawer
{
private:
struct RainPixel
@ -156,7 +156,7 @@ public:
}
};
class SoftwareDrawingContext : public IDrawingContext
class SoftwareDrawingContext final : public IDrawingContext
{
private:
SoftwareDrawingEngine * _engine;
@ -179,7 +179,7 @@ public:
void SetDPI(rct_drawpixelinfo * dpi);
};
class SoftwareDrawingEngine : public IDrawingEngine
class SoftwareDrawingEngine final : public IDrawingEngine
{
private:
bool _hardwareDisplay;

View File

@ -19,7 +19,7 @@
#include "GLSLTypes.h"
#include "OpenGLShaderProgram.h"
class CopyFramebufferShader : public OpenGLShaderProgram
class CopyFramebufferShader final : public OpenGLShaderProgram
{
private:
GLuint uScreenSize;

View File

@ -36,7 +36,7 @@ struct DrawImageInstance {
int mask;
};
class DrawImageShader : public OpenGLShaderProgram
class DrawImageShader final : public OpenGLShaderProgram
{
private:
GLuint uScreenSize;

View File

@ -19,7 +19,7 @@
#include "GLSLTypes.h"
#include "OpenGLShaderProgram.h"
class DrawLineShader : public OpenGLShaderProgram
class DrawLineShader final : public OpenGLShaderProgram
{
private:
GLuint uScreenSize;

View File

@ -21,7 +21,7 @@
class OpenGLFramebuffer;
class FillRectShader : public OpenGLShaderProgram
class FillRectShader final : public OpenGLShaderProgram
{
private:
GLuint uScreenSize;

View File

@ -30,7 +30,7 @@ class OpenGLFramebuffer;
* When you need to bind the current frame to a shader, call SwapCopy and
* then bind the value of GetSourceTexture to your shader.
*/
class SwapFramebuffer
class SwapFramebuffer final
{
private:
sint32 _width;

View File

@ -73,7 +73,7 @@ struct CachedTextureInfo
// Represents a texture atlas that images of a given maximum size can be allocated from
// Atlases are all stored in the same 2D texture array, occupying the specified index
// Slots in atlases are always squares.
class Atlas
class Atlas final
{
private:
GLuint _index;
@ -183,7 +183,7 @@ private:
}
};
class TextureCache
class TextureCache final
{
private:
bool _atlasesTextureInitialised = false;

View File

@ -61,7 +61,7 @@ struct ScenarioOverride
};
};
class LanguagePack : public ILanguagePack
class LanguagePack final : public ILanguagePack
{
private:
uint16 _id;

View File

@ -20,7 +20,7 @@
#include <string>
#include "../common.h"
class NetworkAction
class NetworkAction final
{
public:
rct_string_id Name;
@ -28,7 +28,7 @@ public:
std::vector<int> Commands;
};
class NetworkActions
class NetworkActions final
{
public:
static const std::vector<NetworkAction> Actions;

View File

@ -29,7 +29,7 @@
class NetworkPlayer;
class NetworkConnection
class NetworkConnection final
{
public:
ITcpSocket * Socket = nullptr;

View File

@ -21,7 +21,7 @@
#include "NetworkPacket.h"
#include "../common.h"
class NetworkGroup
class NetworkGroup final
{
public:
std::array<uint8, 8> ActionsAllowed;

View File

@ -27,7 +27,7 @@
typedef struct evp_pkey_st EVP_PKEY;
typedef struct evp_pkey_ctx_st EVP_PKEY_CTX;
class NetworkKey
class NetworkKey final
{
public:
NetworkKey();

View File

@ -21,7 +21,7 @@
#include "NetworkTypes.h"
#include "../common.h"
class NetworkPacket
class NetworkPacket final
{
public:
uint16 size;

View File

@ -26,7 +26,7 @@ extern "C"
class NetworkPacket;
class NetworkPlayer
class NetworkPlayer final
{
public:
uint8 id = 0;

View File

@ -23,7 +23,7 @@
#include <map>
#include <string>
class NetworkUser
class NetworkUser final
{
public:
std::string Hash;
@ -37,7 +37,7 @@ public:
json_t * ToJson(json_t * json) const;
};
class NetworkUserManager
class NetworkUserManager final
{
public:
~NetworkUserManager();

View File

@ -23,13 +23,13 @@ extern "C"
#include "../world/scenery.h"
}
class BannerObject : public SceneryObject
class BannerObject final : public SceneryObject
{
private:
rct_scenery_entry _legacyType = { 0 };
public:
explicit BannerObject(const rct_object_entry &entry) : SceneryObject(entry) { };
explicit BannerObject(const rct_object_entry &entry) : SceneryObject(entry) { }
void * GetLegacyData() override { return &_legacyType; }

View File

@ -23,13 +23,13 @@ extern "C"
#include "../world/entrance.h"
}
class EntranceObject : public Object
class EntranceObject final : public Object
{
private:
rct_entrance_type _legacyType = { 0 };
public:
explicit EntranceObject(const rct_object_entry &entry) : Object(entry) { };
explicit EntranceObject(const rct_object_entry &entry) : Object(entry) { }
void * GetLegacyData() override { return &_legacyType; }

View File

@ -23,13 +23,13 @@ extern "C"
#include "../world/scenery.h"
}
class FootpathItemObject : public SceneryObject
class FootpathItemObject final : public SceneryObject
{
private:
rct_scenery_entry _legacyType = { 0 };
public:
explicit FootpathItemObject(const rct_object_entry &entry) : SceneryObject(entry) { };
explicit FootpathItemObject(const rct_object_entry &entry) : SceneryObject(entry) { }
void * GetLegacyData() override { return &_legacyType; }

View File

@ -23,13 +23,13 @@ extern "C"
#include "../world/footpath.h"
}
class FootpathObject : public Object
class FootpathObject final : public Object
{
private:
rct_footpath_entry _legacyType = { 0 };
public:
explicit FootpathObject(const rct_object_entry &entry) : Object(entry) { };
explicit FootpathObject(const rct_object_entry &entry) : Object(entry) { }
void * GetLegacyData() override { return &_legacyType; }

View File

@ -39,5 +39,5 @@ public:
void Read(IReadObjectContext * context, IStream * stream);
const rct_g1_element * GetImages() const { return _entries.data(); }
uint32 GetCount() const { return (uint32)_entries.size(); };
};
uint32 GetCount() const { return (uint32)_entries.size(); }
};

View File

@ -23,7 +23,7 @@ extern "C"
#include "../world/scenery.h"
}
class LargeSceneryObject : public SceneryObject
class LargeSceneryObject final : public SceneryObject
{
private:
rct_scenery_entry _legacyType = { 0 };
@ -32,7 +32,7 @@ private:
rct_large_scenery_tile * _tiles = nullptr;
public:
explicit LargeSceneryObject(const rct_object_entry &entry) : SceneryObject(entry) { };
explicit LargeSceneryObject(const rct_object_entry &entry) : SceneryObject(entry) { }
~LargeSceneryObject();
void * GetLegacyData() override { return &_legacyType; }

View File

@ -23,7 +23,7 @@ extern "C"
#include "../ride/ride.h"
}
class RideObject : public Object
class RideObject final : public Object
{
private:
rct_ride_entry _legacyType = { 0 };
@ -31,7 +31,7 @@ private:
sint8 * _peepLoadingPositions[4] = { nullptr };
public:
explicit RideObject(const rct_object_entry &entry) : Object(entry) { };
explicit RideObject(const rct_object_entry &entry) : Object(entry) { }
~RideObject();
void * GetLegacyData() override { return &_legacyType; }

View File

@ -25,7 +25,7 @@ extern "C"
struct ObjectRepositoryItem;
class SceneryGroupObject : public Object
class SceneryGroupObject final : public Object
{
private:
rct_scenery_set_entry _legacyType = { 0 };
@ -33,7 +33,7 @@ private:
rct_object_entry * _items = nullptr;
public:
explicit SceneryGroupObject(const rct_object_entry &entry) : Object(entry) { };
explicit SceneryGroupObject(const rct_object_entry &entry) : Object(entry) { }
~SceneryGroupObject();
void * GetLegacyData() override { return &_legacyType; }

View File

@ -23,14 +23,14 @@ extern "C"
#include "../world/scenery.h"
}
class SmallSceneryObject : public SceneryObject
class SmallSceneryObject final : public SceneryObject
{
private:
rct_scenery_entry _legacyType = { 0 };
uint8 * _var10data = nullptr;
public:
explicit SmallSceneryObject(const rct_object_entry &entry) : SceneryObject(entry) { };
explicit SmallSceneryObject(const rct_object_entry &entry) : SceneryObject(entry) { }
~SmallSceneryObject();
void * GetLegacyData() override { return &_legacyType; }

View File

@ -23,13 +23,13 @@ extern "C"
#include "../scenario.h"
}
class StexObject : public Object
class StexObject final : public Object
{
private:
rct_stex_entry _legacyType = { 0 };
public:
explicit StexObject(const rct_object_entry &entry) : Object(entry) { };
explicit StexObject(const rct_object_entry &entry) : Object(entry) { }
void * GetLegacyData() override { return &_legacyType; }

View File

@ -23,13 +23,13 @@ extern "C"
#include "../world/scenery.h"
}
class WallObject : public SceneryObject
class WallObject final : public SceneryObject
{
private:
rct_scenery_entry _legacyType = { 0 };
public:
explicit WallObject(const rct_object_entry &entry) : SceneryObject(entry) { };
explicit WallObject(const rct_object_entry &entry) : SceneryObject(entry) { }
void * GetLegacyData() override { return &_legacyType; }

View File

@ -23,13 +23,13 @@ extern "C"
#include "../world/water.h"
}
class WaterObject : public Object
class WaterObject final : public Object
{
private:
rct_water_type _legacyType = { 0 };
public:
explicit WaterObject(const rct_object_entry &entry) : Object(entry) { };
explicit WaterObject(const rct_object_entry &entry) : Object(entry) { }
void * GetLegacyData() override { return &_legacyType; }

View File

@ -27,7 +27,7 @@ extern "C"
/**
* Class to export RollerCoaster Tycoon 2 scenarios (*.SC6) and saved games (*.SV6).
*/
class S6Exporter
class S6Exporter final
{
public:
bool ExportObjects;

View File

@ -26,7 +26,7 @@ extern "C"
/**
* Class to import RollerCoaster Tycoon 2 scenarios (*.SC6) and saved games (*.SV6).
*/
class S6Importer
class S6Importer final
{
public:
bool FixIssues;