update// removed reformats & refactored DataStore.h to store the sietches outside of lambdas as needed, reformated the controller.cpp

This commit is contained in:
Strider
2020-04-11 22:15:35 +02:00
parent 5d91a76839
commit 1f6b4e0f31
2 changed files with 693 additions and 472 deletions

58
src/DataStore.h Normal file
View File

@@ -0,0 +1,58 @@
#ifndef DATASTORE_H
#define DATASTORE_H
#include <QString>
#include <map>
template <class T>
class DataStore
{
private:
static bool instanced;
static DataStore<T>* instance;
std::map<QString, T> data;
DataStore()
{
}
public:
static DataStore<T>* getInstance()
{
if(!DataStore<T>::instanced)
{
DataStore<T>::instanced = true;
DataStore<T>::instance = new DataStore<T>();
}
return DataStore<T>::instance;
}
void clear();
void setData(QString key, T value);
QString getData(QString key);
~DataStore()
{
DataStore<T>::instanced = false;
}
};
template <class T>
void DataStore<T>::clear()
{
this->data.clear();
}
template <class T>
void DataStore<T>::setData(QString key, T value)
{
this->data[key] = value;
}
template <class T>
QString DataStore<T>::getData(QString key)
{
return this->data[key];
}
#endif

File diff suppressed because it is too large Load Diff