diff --git a/Juliet/include/Core/Common/NonCopyable.h b/Juliet/include/Core/Common/NonCopyable.h deleted file mode 100644 index ec3d169..0000000 --- a/Juliet/include/Core/Common/NonCopyable.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -namespace Juliet -{ - class NonCopyable - { - public: - NonCopyable() = default; - virtual ~NonCopyable() = default; - - NonCopyable(const NonCopyable&) = delete; - const NonCopyable& operator=(const NonCopyable&) = delete; - }; -} // namespace Juliet diff --git a/Juliet/include/Core/Common/NonMovable.h b/Juliet/include/Core/Common/NonMovable.h deleted file mode 100644 index b80185f..0000000 --- a/Juliet/include/Core/Common/NonMovable.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -namespace Juliet -{ - class NonMovable - { - public: - NonMovable() = default; - virtual ~NonMovable() = default; - - NonMovable(const NonMovable&&) = delete; - const NonMovable& operator=(const NonMovable&&) = delete; - }; -} // namespace Juliet diff --git a/Juliet/include/Core/Common/Singleton.h b/Juliet/include/Core/Common/Singleton.h deleted file mode 100644 index 63b0b20..0000000 --- a/Juliet/include/Core/Common/Singleton.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace Juliet -{ - // Two usages : Inherit from Singleton or use the static methods to register to it when you want. - // 1) - // class IThing {}; - // class Thing : public Singleton::AutoRegister {}; - template - class Singleton final : public NonMovable, public NonCopyable - { - public: - static void Register(NonNullPtr type); - static void Unregister(NonNullPtr type); - static Type* Get(); - - class AutoRegister : public Type - { - public: - AutoRegister(); - virtual ~AutoRegister(); - }; - - private: - static Type* sInstance; - static bool sIsRegistered; - }; - - template - bool Singleton::sIsRegistered = false; - - template - Type* Singleton::sInstance = nullptr; - - template - void Singleton::Register(NonNullPtr type) - { - Assert(!Get() && "Singleton is already registered. Make sure to only register it once"); - sInstance = type.Get(); - sIsRegistered = true; - } - - template - void Singleton::Unregister(NonNullPtr type) - { - Assert(sIsRegistered && "Trying to unregister a singleton that is not registered"); - Assert(sInstance == type && - "Trying to unregister an instance that is different from the one currently registered"); - - sInstance = nullptr; - sIsRegistered = false; - } - - template - Type* Singleton::Get() - { - if (sIsRegistered) - { - return sInstance; - } - return nullptr; - } - - template - Singleton::AutoRegister::AutoRegister() - { - Singleton::Register(this); - } - - template - Singleton::AutoRegister::~AutoRegister() - { - Singleton::Unregister(this); - } -} // namespace Juliet diff --git a/Juliet/include/Core/Networking/Socket.h b/Juliet/include/Core/Networking/Socket.h index a73495e..d7a3f4d 100644 --- a/Juliet/include/Core/Networking/Socket.h +++ b/Juliet/include/Core/Networking/Socket.h @@ -1,19 +1,18 @@ #pragma once -#include #include namespace Juliet { - class Socket : NonCopyable + class Socket { public: - ~Socket() override; + virtual ~Socket(); Socket(Socket&& other) noexcept; Socket& operator=(Socket&& socket) noexcept; - Socket(const Socket&) = delete; + Socket(const Socket&) = delete; Socket& operator=(const Socket&) = delete; bool IsValid() const;