einstein/cpp-source/storage.cpp
2015-11-03 15:56:09 +01:00

49 lines
617 B
C++

#include "storage.h"
#ifndef WIN32
#include "tablestorage.h"
#else
#include "regstorage.h"
#endif
class StorageHolder
{
private:
Storage *storage;
public:
StorageHolder();
~StorageHolder();
public:
Storage* getStorage() { return storage; };
};
StorageHolder::StorageHolder()
{
#ifndef WIN32
storage = new TableStorage();
#else
storage = new RegistryStorage();
#endif
}
StorageHolder::~StorageHolder()
{
if (storage)
delete storage;
}
static StorageHolder storageHolder;
Storage* getStorage()
{
return storageHolder.getStorage();
}