summaryrefslogtreecommitdiff
path: root/src/lib/buildgraph/artifact.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2013-08-02 09:37:45 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2013-08-02 10:57:40 +0200
commitb47da5be0461aeaf54b16025430bf604938dd6fb (patch)
tree42ebce6104dee23183ae7628b4f4567adf374ea7 /src/lib/buildgraph/artifact.cpp
parent7893c2b986c8f767e2cc747e98efcc6b48aec05f (diff)
downloadqbs-b47da5be0461aeaf54b16025430bf604938dd6fb.tar.gz
unmystify the serialization of artifacts
Move the serialization responsibility to Artifact itself. Do not store parents. They are merely backpointers that can be restored after loading. Change-Id: I82b07f6ac07bd74b638985d86635894330743558 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src/lib/buildgraph/artifact.cpp')
-rw-r--r--src/lib/buildgraph/artifact.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/buildgraph/artifact.cpp b/src/lib/buildgraph/artifact.cpp
index 28fd44dd9..9583f5f02 100644
--- a/src/lib/buildgraph/artifact.cpp
+++ b/src/lib/buildgraph/artifact.cpp
@@ -76,6 +76,13 @@ void Artifact::initialize()
void Artifact::load(PersistentPool &pool)
{
FileResourceBase::load(pool);
+ pool.loadContainer(children);
+
+ // restore parents of the loaded children
+ for (ArtifactList::const_iterator it = children.constBegin(); it != children.constEnd(); ++it)
+ (*it)->parents.insert(this);
+
+ pool.loadContainer(fileDependencies);
properties = pool.idLoadS<PropertyMapInternal>();
transformer = pool.idLoadS<Transformer>();
unsigned char c;
@@ -90,6 +97,9 @@ void Artifact::load(PersistentPool &pool)
void Artifact::store(PersistentPool &pool) const
{
FileResourceBase::store(pool);
+ // Do not store parents to avoid recursion.
+ pool.storeContainer(children);
+ pool.storeContainer(fileDependencies);
pool.store(properties);
pool.store(transformer);
pool.stream()