update// reformated datastore and changed storage chatmodel to store with datastore
This commit is contained in:
42
src/DataStore/ChatDataStore.cpp
Normal file
42
src/DataStore/ChatDataStore.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "ChatDataStore.h"
|
||||
|
||||
ChatDataStore* ChatDataStore::getInstance()
|
||||
{
|
||||
if(!ChatDataStore::instanced)
|
||||
{
|
||||
ChatDataStore::instanced = true;
|
||||
ChatDataStore::instance = new ChatDataStore();
|
||||
}
|
||||
|
||||
return ChatDataStore::instance;
|
||||
}
|
||||
|
||||
void ChatDataStore::clear()
|
||||
{
|
||||
this->data.clear();
|
||||
}
|
||||
|
||||
|
||||
void ChatDataStore::setData(QString key, ChatItem value)
|
||||
{
|
||||
this->data[key] = value;
|
||||
}
|
||||
|
||||
ChatItem ChatDataStore::getData(QString key)
|
||||
{
|
||||
return this->data[key];
|
||||
}
|
||||
|
||||
QString ChatDataStore::dump()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
std::map<QString, ChatItem> ChatDataStore::getAllRawChatItems()
|
||||
{
|
||||
return this->data;
|
||||
}
|
||||
|
||||
|
||||
ChatDataStore* ChatDataStore::instance = nullptr;
|
||||
bool ChatDataStore::instanced = false;
|
||||
Reference in New Issue
Block a user