25#include "storagefactory.h"
26#include "storagefactoryregistry.h"
28#include <kstaticdeleter.h>
32#include <tqstringlist.h>
37class StorageFactoryRegistry::StorageFactoryRegistryPrivate
40 TQMap<TQString, StorageFactory*> map;
43StorageFactoryRegistry* StorageFactoryRegistry::m_instance = 0;
44static KStaticDeleter<StorageFactoryRegistry> storagefactoryregistrysd;
46StorageFactoryRegistry* StorageFactoryRegistry::self()
49 m_instance = storagefactoryregistrysd.setObject(m_instance, new StorageFactoryRegistry);
53bool StorageFactoryRegistry::registerFactory(StorageFactory* factory, const TQString& typestr)
55 if (containsFactory(typestr))
57 d->map[typestr] = factory;
61void StorageFactoryRegistry::unregisterFactory( const TQString& typestr)
63 d->map.remove(typestr);
66StorageFactory* StorageFactoryRegistry::getFactory( const TQString& typestr)
68 return d->map[typestr];
71bool StorageFactoryRegistry::containsFactory( const TQString& typestr) const
73 return d->map.contains(typestr);
76TQStringList StorageFactoryRegistry::list() const
81StorageFactoryRegistry::StorageFactoryRegistry() : d(new StorageFactoryRegistryPrivate)
85StorageFactoryRegistry::~StorageFactoryRegistry()
|