Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
attachment_data_store.h
Go to the documentation of this file.
1#ifndef ATTACHMENT_DATA_STORE_H
2#define ATTACHMENT_DATA_STORE_H
3
4#include <QMap>
5#include <QMutex>
6#include <QString>
7
16public:
22 static AttachmentDataStore instance;
23 return &instance;
24 }
25
33 QString StoreAttachmentData(const QString &base64_data);
34
41 QString GetAttachmentData(const QString &attachment_id);
42
49 void RemoveAttachmentData(const QString &attachment_id);
50
51private:
56
61
66
72 QMap<QString, QString> attachment_data_{};
73
77 QMutex mutex_{};
78};
79
80#endif //ATTACHMENT_DATA_STORE_H
AttachmentDataStore(const AttachmentDataStore &)=delete
Deleted copy constructor to prevent copying.
AttachmentDataStore & operator=(const AttachmentDataStore &)=delete
Deleted assignment operator to prevent assignment.
AttachmentDataStore()=default
Private default constructor to enforce the singleton pattern.
static AttachmentDataStore * GetInstance()
Gets the singleton instance of the AttachmentDataStore.
Definition attachment_data_store.h:21
void RemoveAttachmentData(const QString &attachment_id)
Removes the attachment data associated with the given ID from the store. Used to free up memory once ...
Definition attachment_data_store.cpp:20
QString StoreAttachmentData(const QString &base64_data)
Stores base64-encoded attachment data and returns a unique ID. Generates a UUID for the attachment an...
Definition attachment_data_store.cpp:5
QMutex mutex_
Mutex ensuring thread-safe access to the attachment_data_ map.
Definition attachment_data_store.h:77
QString GetAttachmentData(const QString &attachment_id)
Retrieves the base64-encoded attachment data associated with a given ID. This operation is thread-saf...
Definition attachment_data_store.cpp:12
QMap< QString, QString > attachment_data_
Map storing the attachment data. Key: Attachment ID (QString UUID). Value: Base64-encoded attachment ...
Definition attachment_data_store.h:72