aboutsummaryrefslogtreecommitdiff
path: root/events/receiptevent.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-02-23 14:42:33 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-02-23 14:42:33 +0900
commitc82198c9d35a2a91a7440851b6e7d7a71f662c68 (patch)
tree90cb9301f289c6ea97b784c8d35a28427b9245d9 /events/receiptevent.h
parent0a653e0e1c6c050f54df12663539cdb2e02717d8 (diff)
downloadlibquotient-c82198c9d35a2a91a7440851b6e7d7a71f662c68.tar.gz
libquotient-c82198c9d35a2a91a7440851b6e7d7a71f662c68.zip
Receipts internal handling improved
Instead of QHash, use QVector< QPair<> > because it's more efficient and we don't really need a hashmap functions, only direct iteration over the list of event-to-receipt pairs. Also, iteration over QJsonObjects is more efficient (and better conveys the intention) than collecting keys() and then finding a value() for each of them. Also, fixed accidental allocation of empty Receipt structures instead of reserving space for them.
Diffstat (limited to 'events/receiptevent.h')
-rw-r--r--events/receiptevent.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/events/receiptevent.h b/events/receiptevent.h
index 5ca33f75..a7e1debf 100644
--- a/events/receiptevent.h
+++ b/events/receiptevent.h
@@ -36,6 +36,7 @@ Q_DECLARE_TYPEINFO(QMatrixClient::Receipt, Q_MOVABLE_TYPE);
namespace QMatrixClient
{
using Receipts = QVector<Receipt>;
+ using EventsToReceipts = QVector< QPair<QString, Receipts> >;
class ReceiptEvent: public Event
{
@@ -43,9 +44,7 @@ namespace QMatrixClient
ReceiptEvent();
virtual ~ReceiptEvent();
- Receipts receiptsForEvent(QString eventId) const;
-
- QStringList events() const;
+ EventsToReceipts events() const;
static ReceiptEvent* fromJson(const QJsonObject& obj);