diff options
author | kh1 <qt-info@nokia.com> | 2011-05-04 12:13:52 +0200 |
---|---|---|
committer | kh1 <qt-info@nokia.com> | 2011-05-04 12:13:52 +0200 |
commit | 024c744753e2db8801d8f7b784f3a9e7d8d54c0f (patch) | |
tree | 082c2446933c93f97045df8c230a6e0ad9354c0a /installerbuilder/common/binaryformat.cpp | |
parent | 288995149bb729873f31dc7db53bf4ec3591a3ed (diff) |
Reorder to match header file.
Diffstat (limited to 'installerbuilder/common/binaryformat.cpp')
-rw-r--r-- | installerbuilder/common/binaryformat.cpp | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/installerbuilder/common/binaryformat.cpp b/installerbuilder/common/binaryformat.cpp index 9c6e8dadc..72ec4494e 100644 --- a/installerbuilder/common/binaryformat.cpp +++ b/installerbuilder/common/binaryformat.cpp @@ -639,11 +639,6 @@ bool Component::operator==(const Component& other) const return m_name == other.m_name && m_binarySegment == other.m_binarySegment; } -Component ComponentIndex::componentByName(const QByteArray &id) const -{ - return m_components.value(id); -} - /*! Destroys this component. */ @@ -678,24 +673,31 @@ QSharedPointer<Archive> Component::archiveByName(const QByteArray &name) const return QSharedPointer<Archive>(); } -void ComponentIndex::insertComponent(const Component& c) -{ - m_components.insert(c.name(), c); -} -int ComponentIndex::componentCount() const +// -- ComponentIndex + +ComponentIndex::ComponentIndex() { - return m_components.size(); } -void ComponentIndex::removeComponent(const QByteArray &name) +ComponentIndex ComponentIndex::read(QIODevice *dev, qint64 offset) { - m_components.remove(name); + ComponentIndex result; + const qint64 size = retrieveInt64(dev); + for (int i = 0; i < size; ++i) + result.insertComponent(Component::readFromIndexEntry(dev, offset)); + retrieveInt64(dev); + return result; } -QVector<Component> ComponentIndex::components() const +void ComponentIndex::writeIndex(QIODevice *out, qint64 offset) const { - return m_components.values().toVector(); + // Q: why do we write the size twice? + // A: for us to be able to read it beginning from the end of the file as well + appendInt64(out, componentCount()); + foreach (const Component& i, components()) + i.writeIndexEntry(out, offset); + appendInt64(out, componentCount()); } void ComponentIndex::writeComponentData(QIODevice *out, qint64 offset) const @@ -706,31 +708,32 @@ void ComponentIndex::writeComponentData(QIODevice *out, qint64 offset) const component.writeData(out, offset); } +Component ComponentIndex::componentByName(const QByteArray &id) const +{ + return m_components.value(id); +} -ComponentIndex::ComponentIndex() +void ComponentIndex::insertComponent(const Component& c) { + m_components.insert(c.name(), c); } -ComponentIndex ComponentIndex::read(QIODevice *dev, qint64 offset) +void ComponentIndex::removeComponent(const QByteArray &name) { - ComponentIndex result; - const qint64 size = retrieveInt64(dev); - for (int i = 0; i < size; ++i) - result.insertComponent(Component::readFromIndexEntry(dev, offset)); - retrieveInt64(dev); - return result; + m_components.remove(name); } -void ComponentIndex::writeIndex(QIODevice *out, qint64 offset) const +QVector<Component> ComponentIndex::components() const { - // Q: why do we write the size twice? - // A: for us to be able to read it beginning from the end of the file as well - appendInt64(out, componentCount()); - foreach (const Component& i, components()) - i.writeIndexEntry(out, offset); - appendInt64(out, componentCount()); + return m_components.values().toVector(); } +int ComponentIndex::componentCount() const +{ + return m_components.size(); +} + + /*! \internal Registers the resource found at \a segment within \a file into the Qt resource system. |