From aa671cf18f5a0b2847bef673c0a6e2a17c7b1baf Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 1 Nov 2021 11:09:46 +0200 Subject: [PATCH] Remove the obsolete LoadableTypeRegistry class --- source/loadabletyperegistry.h | 89 ----------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 source/loadabletyperegistry.h diff --git a/source/loadabletyperegistry.h b/source/loadabletyperegistry.h deleted file mode 100644 index 2cf7d6f..0000000 --- a/source/loadabletyperegistry.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef MSP_DATAFILE_LOADABLETYPEREGISTRY_H_ -#define MSP_DATAFILE_LOADABLETYPEREGISTRY_H_ - -#include -#include -#include -#include -#include -#include - -namespace Msp { -namespace DataFile { - -/** -Associates types with keywords for adding to a Loader. The target Loader class -must be given as a template parameter, as well as a helper template struct to -handle the actual adding of keywords. - -Deprecated; use TypeRegistry from mspcore instead. -*/ -template class A> -class DEPRECATED LoadableTypeRegistry: private NonCopyable -{ -private: - class TypeBase - { - protected: - std::string keyword; - - TypeBase(const std::string &kw): keyword(kw) { } - public: - virtual ~TypeBase() { } - - virtual void add(L &) const = 0; - }; - - template - class RegisteredType: public TypeBase - { - public: - RegisteredType(const std::string &kw): TypeBase(kw) { } - - virtual void add(L &ldr) const { A::add(ldr, this->keyword); } - }; - - typedef std::map TypeMap; - - TypeMap types; - -public: - ~LoadableTypeRegistry(); - - template - void register_type(const std::string &); - - void add_all(L &) const; -}; - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -template class A> -LoadableTypeRegistry::~LoadableTypeRegistry() -{ - for(typename TypeMap::iterator i=types.begin(); i!=types.end(); ++i) - delete i->second; -} - -template class A> -template -void LoadableTypeRegistry::register_type(const std::string &kw) -{ - if(types.count(kw)) - throw key_error(kw); - - types[kw] = new RegisteredType(kw); -} - -template class A> -void LoadableTypeRegistry::add_all(L &ldr) const -{ - for(typename TypeMap::const_iterator i=types.begin(); i!=types.end(); ++i) - i->second->add(ldr); -} -#pragma GCC diagnostic pop - -} // namespace DataFile -} // namespace Msp - -#endif -- 2.45.2