Cockatrice
2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Toggle main menu visibility
Loading...
Searching...
No Matches
lazy_properties_hash.h
Go to the documentation of this file.
1
#ifndef COCKATRICE_LAZY_PROPERTIES_HASH_H
2
#define COCKATRICE_LAZY_PROPERTIES_HASH_H
3
4
#include <QByteArray>
5
#include <QHash>
6
#include <QMutex>
7
#include <QString>
8
18
class
LazyPropertiesHash
19
{
20
21
mutable
QByteArray
blob
;
22
mutable
QHash<QString, QString>
properties
;
23
mutable
QMutex
propertiesMutex
;
24
mutable
bool
isMaterialized
=
false
;
25
30
void
ensureMaterialized
()
const
;
31
32
public
:
36
LazyPropertiesHash
();
37
42
explicit
LazyPropertiesHash
(
const
QByteArray &
blob
);
43
48
explicit
LazyPropertiesHash
(
const
QHash<QString, QString>
&
properties
);
49
50
// Override copy constructor and copy-assignment because mutex isn't copiable
51
LazyPropertiesHash
(
const
LazyPropertiesHash
&other);
52
LazyPropertiesHash
&
operator=
(
const
LazyPropertiesHash
&other);
53
59
QString
value
(
const
QString &key)
const
;
60
67
bool
insert
(
const
QString &key,
const
QString &
value
);
68
73
const
QHash<QString, QString>
&
getProperties
()
const
;
74
};
75
76
#endif
// COCKATRICE_LAZY_PROPERTIES_HASH_H
LazyPropertiesHash::LazyPropertiesHash
LazyPropertiesHash()
Default constructor.
Definition
lazy_properties_hash.cpp:7
LazyPropertiesHash::isMaterialized
bool isMaterialized
Whether propertiesCache is valid.
Definition
lazy_properties_hash.h:24
LazyPropertiesHash::getProperties
const QHash< QString, QString > & getProperties() const
Gets a view of the materialized properties hash.
Definition
lazy_properties_hash.cpp:93
LazyPropertiesHash::operator=
LazyPropertiesHash & operator=(const LazyPropertiesHash &other)
Definition
lazy_properties_hash.cpp:35
LazyPropertiesHash::blob
QByteArray blob
Serialized properties (load form).
Definition
lazy_properties_hash.h:21
LazyPropertiesHash::value
QString value(const QString &key) const
Gets the value from the materialized properties hash.
Definition
lazy_properties_hash.cpp:75
LazyPropertiesHash::propertiesMutex
QMutex propertiesMutex
Guards lazy materialization.
Definition
lazy_properties_hash.h:23
LazyPropertiesHash::ensureMaterialized
void ensureMaterialized() const
Materializes properties from blob if not already done. Clears blob afterward. Safe to call from const...
Definition
lazy_properties_hash.cpp:56
LazyPropertiesHash::properties
QHash< QString, QString > properties
Materialized properties (query form).
Definition
lazy_properties_hash.h:22
LazyPropertiesHash::insert
bool insert(const QString &key, const QString &value)
Inserts a value into the materialized properties hash.
Definition
lazy_properties_hash.cpp:81
QHash
Definition
mana_curve_category_widget.h:11
libcockatrice_card
libcockatrice
card
lazy_properties_hash.h
Generated by
1.18.0