aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/rescuableartifactdata.h
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-02-12 14:53:42 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2018-02-16 11:34:20 +0000
commitbca41151f08e2b198bd6ac1da1603d6933c9166a (patch)
tree3d835697679d793ee5bc4434bf760929d50641fa /src/lib/corelib/buildgraph/rescuableartifactdata.h
parent21c5ea0f79ad0e89eaa29ab5b91387b8454c4e3e (diff)
Get rid of redundancies between load() and store() methods
It's silly that we have to mention each serializable data member in both the load and the store methods. Instead, whenever possible, forward these methods to a template that calls the right function in the persistence backend based on its parameter. Change-Id: I00e2dee8cdf55405f447cee27190bc97df8673e3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/rescuableartifactdata.h')
-rw-r--r--src/lib/corelib/buildgraph/rescuableartifactdata.h37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/lib/corelib/buildgraph/rescuableartifactdata.h b/src/lib/corelib/buildgraph/rescuableartifactdata.h
index b4bf56911..b1c6ba8c4 100644
--- a/src/lib/corelib/buildgraph/rescuableartifactdata.h
+++ b/src/lib/corelib/buildgraph/rescuableartifactdata.h
@@ -48,7 +48,9 @@
#include <language/filetags.h>
#include <language/forward_decls.h>
#include <language/property.h>
+#include <language/propertymapinternal.h>
#include <tools/filetime.h>
+#include <tools/persistence.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
@@ -57,15 +59,28 @@
namespace qbs {
namespace Internal {
-class PersistentPool;
class QBS_AUTOTEST_EXPORT RescuableArtifactData
{
public:
~RescuableArtifactData();
+ template<PersistentPool::OpType opType> void serializationOp(PersistentPool &pool)
+ {
+ pool.serializationOp<opType>(timeStamp, children, fileDependencies,
+ propertiesRequestedInPrepareScript,
+ propertiesRequestedInCommands,
+ propertiesRequestedFromArtifactInPrepareScript,
+ propertiesRequestedFromArtifactInCommands,
+ importedFilesUsedInPrepareScript, importedFilesUsedInCommands,
+ depsRequestedInPrepareScript, depsRequestedInCommands,
+ commands, artifactsMapRequestedInPrepareScript,
+ artifactsMapRequestedInCommands,
+ lastPrepareScriptExecutionTime,
+ lastCommandExecutionTime, fileTags, properties);
+ }
void load(PersistentPool &pool);
- void store(PersistentPool &pool) const;
+ void store(PersistentPool &pool);
bool isValid() const { return !!properties; }
@@ -76,21 +91,13 @@ public:
: productName(n), productMultiplexId(m), childFilePath(c), addedByScanner(byScanner)
{}
- void load(PersistentPool &pool)
- {
- pool.load(productName);
- pool.load(productMultiplexId);
- pool.load(childFilePath);
- pool.load(addedByScanner);
- }
-
- void store(PersistentPool &pool) const
+ template<PersistentPool::OpType opType> void serializationOp(PersistentPool &pool)
{
- pool.store(productName);
- pool.store(productMultiplexId);
- pool.store(childFilePath);
- pool.store(addedByScanner);
+ pool.serializationOp<opType>(productName, productMultiplexId, childFilePath,
+ addedByScanner);
}
+ void load(PersistentPool &pool) { serializationOp<PersistentPool::Load>(pool); }
+ void store(PersistentPool &pool) { serializationOp<PersistentPool::Store>(pool); }
QString productName;
QString productMultiplexId;