From 160e1299ef3d95f8e8c48706d7f61dd3dc6c6b60 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 11 Feb 2020 11:29:07 +0800 Subject: =?UTF-8?q?*=E4=BF=AE=E6=94=B9=20tab=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/common/singleton.hpp | 126 ++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 63 deletions(-) (limited to 'src/libjin/common/singleton.hpp') diff --git a/src/libjin/common/singleton.hpp b/src/libjin/common/singleton.hpp index 015c9b0..f66d6e6 100644 --- a/src/libjin/common/singleton.hpp +++ b/src/libjin/common/singleton.hpp @@ -7,77 +7,77 @@ namespace JinEngine { - /// - /// Singleton base class. - /// - template - class Singleton : public Object - { - public: - /// - /// Get singleton. - /// - /// @param Singleton instance of class. - /// - static T* get() - { - if (_instance == nullptr) - _instance = new T; - return _instance; - } + /// + /// Singleton base class. + /// + template + class Singleton : public Object + { + public: + /// + /// Get singleton. + /// + /// @param Singleton instance of class. + /// + static T* get() + { + if (_instance == nullptr) + _instance = new T; + return _instance; + } - /// - /// Destroy instance of singleton. - /// - static void destroy() - { - delete _instance; - _instance = nullptr; - } + /// + /// Destroy instance of singleton. + /// + static void destroy() + { + delete _instance; + _instance = nullptr; + } - protected: - /// - /// Singleton constructor. - /// - Singleton() - { - // Check singleton. - if (_instance) - throw Exception("This is a singleton."); - }; + protected: + /// + /// Singleton constructor. + /// + Singleton() + { + // Check singleton. + if (_instance) + throw Exception("This is a singleton."); + }; - /// - /// Singleton destructor. - /// - virtual ~Singleton() {}; + /// + /// Singleton destructor. + /// + virtual ~Singleton() {}; - /// - /// Singleton instance. - /// - static T* _instance; + /// + /// Singleton instance. + /// + static T* _instance; - private: - /// - /// Singleton copy constructor. - /// - /// @param singleton Singleton of class. - /// - Singleton(const Singleton& singleton); + private: + /// + /// Singleton copy constructor. + /// + /// @param singleton Singleton of class. + /// + Singleton(const Singleton& singleton); - /// - /// Singleton assignment. - /// - /// @param singleton Singleton of class. - /// - Singleton& operator = (const Singleton& singleton); + /// + /// Singleton assignment. + /// + /// @param singleton Singleton of class. + /// + Singleton& operator = (const Singleton& singleton); - }; + }; - /// - /// Singleton instance. - /// - template - T* Singleton::_instance = nullptr; + /// + /// Singleton instance. + /// + template + T* Singleton::_instance = nullptr; } // namespace JinEngine -- cgit v1.1-26-g67d0