From 45c857f4394e6edbea59f189465e1f6802b89920 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Sat, 20 Mar 2021 11:50:39 +0200 Subject: [PATCH] Disable unwanted constructors and assignment operators. --- module/Core/Entity.hpp | 141 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) diff --git a/module/Core/Entity.hpp b/module/Core/Entity.hpp index 7fa486e4..3191cc85 100644 --- a/module/Core/Entity.hpp +++ b/module/Core/Entity.hpp @@ -33,11 +33,32 @@ struct BlipInst * Default constructor. */ BlipInst() = default; + + /* ---------------------------------------------------------------------------------------- + * Copy constructor (disabled). + */ + BlipInst(const BlipInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move constructor. + */ + BlipInst(BlipInst && o) noexcept = default; + /* ---------------------------------------------------------------------------------------- * Destructor. */ ~BlipInst(); + /* ---------------------------------------------------------------------------------------- + * Copy assignment operator (disabled). + */ + BlipInst & operator = (const BlipInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move assignment operator (disabled). + */ + BlipInst & operator = (BlipInst && o) = delete; + /* ---------------------------------------------------------------------------------------- * Destroy the entity instance from the server, if necessary. */ @@ -93,11 +114,31 @@ struct CheckpointInst */ CheckpointInst() = default; + /* ---------------------------------------------------------------------------------------- + * Copy constructor (disabled). + */ + CheckpointInst(const CheckpointInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move constructor. + */ + CheckpointInst(CheckpointInst && o) noexcept = default; + /* ---------------------------------------------------------------------------------------- * Destructor. */ ~CheckpointInst(); + /* ---------------------------------------------------------------------------------------- + * Copy assignment operator (disabled). + */ + CheckpointInst & operator = (const CheckpointInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move assignment operator (disabled). + */ + CheckpointInst & operator = (CheckpointInst && o) = delete; + /* ---------------------------------------------------------------------------------------- * Destroy the entity instance from the server, if necessary. */ @@ -156,11 +197,31 @@ struct KeyBindInst */ KeyBindInst() = default; + /* ---------------------------------------------------------------------------------------- + * Copy constructor (disabled). + */ + KeyBindInst(const KeyBindInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move constructor. + */ + KeyBindInst(KeyBindInst && o) noexcept = default; + /* ---------------------------------------------------------------------------------------- * Destructor. */ ~KeyBindInst(); + /* ---------------------------------------------------------------------------------------- + * Copy assignment operator (disabled). + */ + KeyBindInst & operator = (const KeyBindInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move assignment operator (disabled). + */ + KeyBindInst & operator = (KeyBindInst && o) = delete; + /* ---------------------------------------------------------------------------------------- * Destroy the entity instance from the server, if necessary. */ @@ -215,11 +276,31 @@ struct ObjectInst */ ObjectInst() = default; + /* ---------------------------------------------------------------------------------------- + * Copy constructor (disabled). + */ + ObjectInst(const ObjectInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move constructor. + */ + ObjectInst(ObjectInst && o) noexcept = default; + /* ---------------------------------------------------------------------------------------- * Destructor. */ ~ObjectInst(); + /* ---------------------------------------------------------------------------------------- + * Copy assignment operator (disabled). + */ + ObjectInst & operator = (const ObjectInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move assignment operator (disabled). + */ + ObjectInst & operator = (ObjectInst && o) = delete; + /* ---------------------------------------------------------------------------------------- * Destroy the entity instance from the server, if necessary. */ @@ -279,11 +360,31 @@ struct PickupInst */ PickupInst() = default; + /* ---------------------------------------------------------------------------------------- + * Copy constructor (disabled). + */ + PickupInst(const PickupInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move constructor. + */ + PickupInst(PickupInst && o) noexcept = default; + /* ---------------------------------------------------------------------------------------- * Destructor. */ ~PickupInst(); + /* ---------------------------------------------------------------------------------------- + * Copy assignment operator (disabled). + */ + PickupInst & operator = (const PickupInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move assignment operator (disabled). + */ + PickupInst & operator = (PickupInst && o) = delete; + /* ---------------------------------------------------------------------------------------- * Destroy the entity instance from the server, if necessary. */ @@ -346,11 +447,31 @@ struct PlayerInst */ PlayerInst() = default; + /* ---------------------------------------------------------------------------------------- + * Copy constructor (disabled). + */ + PlayerInst(const PlayerInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move constructor. + */ + PlayerInst(PlayerInst && o) noexcept = default; + /* ---------------------------------------------------------------------------------------- * Destructor. */ ~PlayerInst(); + /* ---------------------------------------------------------------------------------------- + * Copy assignment operator (disabled). + */ + PlayerInst & operator = (const PlayerInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move assignment operator (disabled). + */ + PlayerInst & operator = (PlayerInst && o) = delete; + /* ---------------------------------------------------------------------------------------- * Destroy the entity instance from the server, if necessary. */ @@ -507,11 +628,31 @@ struct VehicleInst */ VehicleInst() = default; + /* ---------------------------------------------------------------------------------------- + * Copy constructor (disabled). + */ + VehicleInst(const VehicleInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move constructor. + */ + VehicleInst(VehicleInst && o) noexcept = default; + /* ---------------------------------------------------------------------------------------- * Destructor. */ ~VehicleInst(); + /* ---------------------------------------------------------------------------------------- + * Copy assignment operator (disabled). + */ + VehicleInst & operator = (const VehicleInst & o) = delete; + + /* ---------------------------------------------------------------------------------------- + * Move assignment operator (disabled). + */ + VehicleInst & operator = (VehicleInst && o) = delete; + /* ---------------------------------------------------------------------------------------- * Destroy the entity instance from the server, if necessary. */