summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkaccesscache.cpp
diff options
context:
space:
mode:
authorMate Barany <mate.barany@qt.io>2024-07-05 14:41:02 +0200
committerMate Barany <mate.barany@qt.io>2024-07-29 14:29:46 +0200
commit36aa5fc3fa361ecb6f7bb035c3cace3dd14735e0 (patch)
tree99be8903cec4ea76ce352fe83fd137985e5f7972 /src/network/access/qnetworkaccesscache.cpp
parent0c0f57dd1ea27239255e77820e10f598d0f72551 (diff)
Initialize all data members in QNetworkAccessCache::CacheableObject
Address the "A constructor must initialize all data members of the class" warning. The class should accept initial values as argument of a (possibly protected) constructor if it expects them to be set by a derived class. Add an enum Option and a protected constructor that can be called by the derived classes with the enum values. This makes setExpires and setShareable redundant so remove them. Found by an Axivion scan. Pick-to: 6.8 6.7 6.5 Task-number: QTBUG-125026 Change-Id: Ia8a2a19469a2c0185b5d2e6b2a0895e897f33f28 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/network/access/qnetworkaccesscache.cpp')
-rw-r--r--src/network/access/qnetworkaccesscache.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/network/access/qnetworkaccesscache.cpp b/src/network/access/qnetworkaccesscache.cpp
index b92bd69826c..e4f3aab1b19 100644
--- a/src/network/access/qnetworkaccesscache.cpp
+++ b/src/network/access/qnetworkaccesscache.cpp
@@ -31,10 +31,11 @@ struct QNetworkAccessCache::Node
int useCount = 0;
};
-QNetworkAccessCache::CacheableObject::CacheableObject()
+QNetworkAccessCache::CacheableObject::CacheableObject(Options options)
+ : expires(options & Option::Expires),
+ shareable(options & Option::Shareable)
{
- // leave the members uninitialized
- // they must be initialized by the derived class's constructor
+
}
QNetworkAccessCache::CacheableObject::~CacheableObject()
@@ -46,16 +47,6 @@ QNetworkAccessCache::CacheableObject::~CacheableObject()
#endif
}
-void QNetworkAccessCache::CacheableObject::setExpires(bool enable)
-{
- expires = enable;
-}
-
-void QNetworkAccessCache::CacheableObject::setShareable(bool enable)
-{
- shareable = enable;
-}
-
QNetworkAccessCache::~QNetworkAccessCache()
{
clear();