forked from MyHush/SilentDragonLite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from MyHush/denio
Some improvements and updates
- Loading branch information
Showing
15 changed files
with
1,637 additions
and
1,587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.