diff --git a/core/include/cubos/core/data/des/deserializer.hpp b/core/include/cubos/core/data/des/deserializer.hpp index b10c208d93..dbfd86a216 100644 --- a/core/include/cubos/core/data/des/deserializer.hpp +++ b/core/include/cubos/core/data/des/deserializer.hpp @@ -32,11 +32,11 @@ namespace cubos::core::data /// @brief Constructs. Deserializer() = default; - /// @name Deleted copy and move constructors. + /// @name Forbid any kind of copying. /// @brief Deleted as the hooks may contain references to the deserializer. /// @{ - Deserializer(Deserializer&&) = delete; Deserializer(const Deserializer&) = delete; + Deserializer& operator=(const Deserializer&) = delete; /// @} /// @brief Function type for deserialization hooks. diff --git a/core/include/cubos/core/data/ser/serializer.hpp b/core/include/cubos/core/data/ser/serializer.hpp index 734e3d3dfa..e82e872781 100644 --- a/core/include/cubos/core/data/ser/serializer.hpp +++ b/core/include/cubos/core/data/ser/serializer.hpp @@ -32,11 +32,12 @@ namespace cubos::core::data /// @brief Default constructs. Serializer() = default; - /// @brief Forbids copying. + /// @name Forbid any kind of copying. + /// @brief Deleted as the hooks may contain references to the serializer. + /// @{ Serializer(const Serializer&) = delete; - - /// @brief Forbids copy assignment. Serializer& operator=(const Serializer&) = delete; + /// @} /// @brief Function type for serialization hooks. using Hook = memory::Function; diff --git a/core/include/cubos/core/ecs/cubos.hpp b/core/include/cubos/core/ecs/cubos.hpp index f226ae03dc..1f71643d8e 100644 --- a/core/include/cubos/core/ecs/cubos.hpp +++ b/core/include/cubos/core/ecs/cubos.hpp @@ -57,6 +57,12 @@ namespace cubos::core::ecs /// @return Reference to this object, for chaining. TagBuilder(World& world, core::ecs::Dispatcher& dispatcher, std::vector& tags); + /// @name Forbid copying. + /// @{ + TagBuilder(const TagBuilder&) = delete; + TagBuilder& operator=(const TagBuilder&) = delete; + /// @} + /// @brief Sets the current tag to be executed before another tag. /// @param tag Tag to be executed before. /// @return Reference to this object, for chaining. @@ -114,6 +120,12 @@ namespace cubos::core::ecs /// @param argv Argument array. Cubos(int argc, char** argv); + /// @name Forbid copying. + /// @{ + Cubos(const Cubos&) = delete; + Cubos& operator=(const Cubos&) = delete; + /// @} + /// @brief Adds a new plugin to the engine. If the plugin had already been added, nothing /// happens. A plugin is just a function that operates on the Cubos object, further /// configuring it. It is useful for separating the code into modules. @@ -210,6 +222,12 @@ namespace cubos::core::ecs /// @param name Debug name. SystemBuilder(World& world, Dispatcher& dispatcher, std::string name); + /// @name Forbid copying. + /// @{ + SystemBuilder(const SystemBuilder&) = delete; + SystemBuilder& operator=(const SystemBuilder&) = delete; + /// @} + /// @brief Adds a tag to the system. /// @param tag Tag. /// @return Builder. @@ -339,6 +357,12 @@ namespace cubos::core::ecs /// @param name Debug name. ObserverBuilder(World& world, std::string name); + /// @name Forbid copying. + /// @{ + ObserverBuilder(const ObserverBuilder&) = delete; + ObserverBuilder& operator=(const ObserverBuilder&) = delete; + /// @} + /// @brief Triggers the observer whenever the given component is added to an entity. /// @param type Component type. /// @param target Target index. By default, the last specified target or 0. diff --git a/core/include/cubos/core/ecs/resource/manager.hpp b/core/include/cubos/core/ecs/resource/manager.hpp index 4ac40bf4dc..f7c543a03b 100644 --- a/core/include/cubos/core/ecs/resource/manager.hpp +++ b/core/include/cubos/core/ecs/resource/manager.hpp @@ -79,9 +79,17 @@ namespace cubos::core::ecs class CUBOS_CORE_API ResourceManager final { public: - ResourceManager() = default; ~ResourceManager(); + /// @brief Constructs. + ResourceManager() = default; + + /// @name Forbid copying. + /// @{ + ResourceManager(const ResourceManager&) = delete; + ResourceManager& operator=(const ResourceManager&) = delete; + /// @} + /// @brief Registers a new resource type in the resource manager. /// /// This function is not thread-safe and should be called before any other function. diff --git a/core/include/cubos/core/ecs/system/dispatcher.hpp b/core/include/cubos/core/ecs/system/dispatcher.hpp index 50df8b9c2c..935d0ddf52 100644 --- a/core/include/cubos/core/ecs/system/dispatcher.hpp +++ b/core/include/cubos/core/ecs/system/dispatcher.hpp @@ -57,6 +57,15 @@ namespace cubos::core::ecs public: ~Dispatcher(); + /// @brief Constructs. + Dispatcher() = default; + + /// @name Forbid copying. + /// @{ + Dispatcher(const Dispatcher&) = delete; + Dispatcher& operator=(const Dispatcher&) = delete; + /// @} + /// @brief Adds a tag, and sets it as the current tag for further settings. /// @param tag Tag to add. void addTag(const std::string& tag); diff --git a/core/include/cubos/core/ecs/table/dense/registry.hpp b/core/include/cubos/core/ecs/table/dense/registry.hpp index eadb1b41ea..2003b159e9 100644 --- a/core/include/cubos/core/ecs/table/dense/registry.hpp +++ b/core/include/cubos/core/ecs/table/dense/registry.hpp @@ -20,6 +20,12 @@ namespace cubos::core::ecs /// @brief Constructs. DenseTableRegistry(); + /// @name Forbid any kind of copying. + /// @{ + DenseTableRegistry(const DenseTableRegistry&) = delete; + DenseTableRegistry& operator=(const DenseTableRegistry&) = delete; + /// @} + /// @brief Checks if the given archetype has a dense table. /// @param archetype Archetype identifier. /// @return WHether it contains a table or not. diff --git a/core/include/cubos/core/ecs/table/dense/table.hpp b/core/include/cubos/core/ecs/table/dense/table.hpp index 6037ad3da9..ab288855fc 100644 --- a/core/include/cubos/core/ecs/table/dense/table.hpp +++ b/core/include/cubos/core/ecs/table/dense/table.hpp @@ -20,8 +20,11 @@ namespace cubos::core::ecs /// @brief Constructs a table without columns. DenseTable() = default; - /// @brief Forbid move construction. - DenseTable(DenseTable&&) noexcept = delete; + /// @name Forbid any kind of copying. + /// @{ + DenseTable(const DenseTable&) = delete; + DenseTable& operator=(const DenseTable&) = delete; + /// @} /// @brief Adds a new column to the table. /// diff --git a/core/include/cubos/core/ecs/table/sparse_relation/registry.hpp b/core/include/cubos/core/ecs/table/sparse_relation/registry.hpp index 89c2a7ed27..1c724fdc57 100644 --- a/core/include/cubos/core/ecs/table/sparse_relation/registry.hpp +++ b/core/include/cubos/core/ecs/table/sparse_relation/registry.hpp @@ -63,6 +63,12 @@ namespace cubos::core::ecs /// @brief Constructs. SparseRelationTableRegistry(); + /// @name Forbid any kind of copying. + /// @{ + SparseRelationTableRegistry(const SparseRelationTableRegistry&) = delete; + SparseRelationTableRegistry& operator=(const SparseRelationTableRegistry&) = delete; + /// @} + /// @brief Checks if there's a table with the given identifier. /// @param id Identifier. /// @return Whether it contains the table or not. diff --git a/core/include/cubos/core/ecs/table/tables.hpp b/core/include/cubos/core/ecs/table/tables.hpp index 8fb5fb6ce0..378cdddef8 100644 --- a/core/include/cubos/core/ecs/table/tables.hpp +++ b/core/include/cubos/core/ecs/table/tables.hpp @@ -14,6 +14,15 @@ namespace cubos::core::ecs class CUBOS_CORE_API Tables final { public: + /// @brief Constructs. + Tables() = default; + + /// @name Forbid any kind of copying. + /// @{ + Tables(const Tables&) = delete; + Tables& operator=(const Tables&) = delete; + /// @} + /// @brief Gets a reference to the dense table registry. /// @return Reference to dense table registry. DenseTableRegistry& dense(); diff --git a/core/include/cubos/core/ecs/world.hpp b/core/include/cubos/core/ecs/world.hpp index 7f6c46f3ba..48c6f54623 100644 --- a/core/include/cubos/core/ecs/world.hpp +++ b/core/include/cubos/core/ecs/world.hpp @@ -31,9 +31,15 @@ namespace cubos::core::ecs public: ~World(); - /// @brief World constructor. + /// @brief Constructs. World(); + /// @name Forbid copying. + /// @{ + World(const World&) = delete; + World& operator=(const World&) = delete; + /// @} + /// @brief Used to access the components in an entity. class Components; diff --git a/core/include/cubos/core/gl/render_device.hpp b/core/include/cubos/core/gl/render_device.hpp index 92247258fa..7fe7adf9a6 100644 --- a/core/include/cubos/core/gl/render_device.hpp +++ b/core/include/cubos/core/gl/render_device.hpp @@ -721,8 +721,11 @@ namespace cubos::core::gl virtual ~RenderDevice() = default; RenderDevice() = default; - /// @brief Forbid copy construction. + /// @name Forbid any kind of copying. + /// @{ RenderDevice(const RenderDevice&) = delete; + RenderDevice& operator=(const RenderDevice&) = delete; + /// @} /// @brief Creates a new framebuffer. /// @param desc Framebuffer description. diff --git a/core/include/cubos/core/memory/stream.hpp b/core/include/cubos/core/memory/stream.hpp index 5c181a0352..c21fe4ac9a 100644 --- a/core/include/cubos/core/memory/stream.hpp +++ b/core/include/cubos/core/memory/stream.hpp @@ -42,8 +42,11 @@ namespace cubos::core::memory /// @brief Move constructs. Stream(Stream&&) = default; - /// @brief Forbid copy construction. + /// @name Forbid any kind of copying. + /// @{ Stream(const Stream&) = delete; + Stream& operator=(const Stream&) = delete; + /// @} static Stream& stdIn; ///< Stream wrapper for `stdin`. static Stream& stdOut; ///< Stream wrapper for `stdout`. diff --git a/core/include/cubos/core/reflection/type.hpp b/core/include/cubos/core/reflection/type.hpp index 05f436fccb..f9442d3e37 100644 --- a/core/include/cubos/core/reflection/type.hpp +++ b/core/include/cubos/core/reflection/type.hpp @@ -23,8 +23,11 @@ namespace cubos::core::reflection class CUBOS_CORE_API Type final { public: + /// @name Forbid any kind of copying. + /// @{ Type(const Type&) = delete; - Type(Type&&) = delete; + Type& operator=(const Type&) = delete; + /// @} /// @brief Constructs with a type the given name. /// @param name Name of the type. diff --git a/core/include/cubos/core/thread_pool.hpp b/core/include/cubos/core/thread_pool.hpp index e2f50e2f9a..fce148eb21 100644 --- a/core/include/cubos/core/thread_pool.hpp +++ b/core/include/cubos/core/thread_pool.hpp @@ -27,11 +27,11 @@ namespace cubos::core /// @param numThreads Number of threads to create. ThreadPool(std::size_t numThreads); - /// @brief Forbid copy construction. + /// @name Forbid any kind of copying. + /// @{ ThreadPool(const ThreadPool&) = delete; - - /// @brief Forbid move construction. - ThreadPool(ThreadPool&&) = delete; + ThreadPool& operator=(const ThreadPool&) = delete; + /// @} /// @brief Adds a task to the thread pool. Starts when a thread becomes available. /// @param task Task to add. diff --git a/engine/include/cubos/engine/assets/assets.hpp b/engine/include/cubos/engine/assets/assets.hpp index a068f8e403..3781c4f1ea 100644 --- a/engine/include/cubos/engine/assets/assets.hpp +++ b/engine/include/cubos/engine/assets/assets.hpp @@ -62,11 +62,11 @@ namespace cubos::engine /// @brief Constructs an empty manager without any bridges or metadata. Assets(); - /// @brief Forbid copying. + /// @name Forbid any kind of copying. + /// @{ Assets(const Assets&) = delete; - - /// @brief Forbid moving. - Assets(Assets&&) = delete; + Assets& operator=(const Assets&) = delete; + /// @} /// @brief Registers a new bridge for the given extension. /// diff --git a/engine/include/cubos/engine/renderer/pps/pass.hpp b/engine/include/cubos/engine/renderer/pps/pass.hpp index 7508b362ce..75a972503e 100644 --- a/engine/include/cubos/engine/renderer/pps/pass.hpp +++ b/engine/include/cubos/engine/renderer/pps/pass.hpp @@ -31,8 +31,11 @@ namespace cubos::engine /// @param renderDevice Render device to use. PostProcessingPass(core::gl::RenderDevice& renderDevice); - /// @brief Deleted copy constructor. + /// @name Forbid any kind of copying. + /// @{ PostProcessingPass(const PostProcessingPass&) = delete; + PostProcessingPass& operator=(const PostProcessingPass&) = delete; + /// @} /// @brief Called when the window framebuffer size changes. /// @param size New size of the window. diff --git a/engine/include/cubos/engine/renderer/renderer.hpp b/engine/include/cubos/engine/renderer/renderer.hpp index b55578deaa..b9402c14d9 100644 --- a/engine/include/cubos/engine/renderer/renderer.hpp +++ b/engine/include/cubos/engine/renderer/renderer.hpp @@ -68,8 +68,11 @@ namespace cubos::engine /// @param size Size of the window. BaseRenderer(core::gl::RenderDevice& renderDevice, glm::uvec2 size); - /// @brief Deleted copy constructor. + /// @name Forbid any kind of copying. + /// @{ BaseRenderer(const BaseRenderer&) = delete; + BaseRenderer& operator=(const BaseRenderer&) = delete; + /// @} /// @brief Uploads a grid to the GPU and returns an handle which can be used to draw it. /// @param grid Grid to upload.