mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 23:51:33 +08:00
Refactor: Moves EntryTypes into namespace enum.
Adds ADS_EXPORT_API defines to public classes.
This commit is contained in:
parent
158dac5309
commit
34891e746e
@ -11,7 +11,17 @@
|
|||||||
|
|
||||||
ADS_NAMESPACE_SER_BEGIN
|
ADS_NAMESPACE_SER_BEGIN
|
||||||
|
|
||||||
class Header
|
enum EntryType
|
||||||
|
{
|
||||||
|
ET_Unknown = 0x00000000,
|
||||||
|
ET_Hierarchy = 0x00000001,
|
||||||
|
ET_SectionIndex = 0x00000002,
|
||||||
|
|
||||||
|
// Begin of custom entry types (e.g. CustomType + 42)
|
||||||
|
ET_Custom = 0x0000ffff
|
||||||
|
};
|
||||||
|
|
||||||
|
class ADS_EXPORT_API Header
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static qint32 MAGIC;
|
static qint32 MAGIC;
|
||||||
@ -27,7 +37,7 @@ QDataStream& operator<<(QDataStream& out, const Header& data);
|
|||||||
QDataStream& operator>>(QDataStream& in, Header& data);
|
QDataStream& operator>>(QDataStream& in, Header& data);
|
||||||
|
|
||||||
|
|
||||||
class OffsetsHeader
|
class ADS_EXPORT_API OffsetsHeader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OffsetsHeader();
|
OffsetsHeader();
|
||||||
@ -39,16 +49,9 @@ QDataStream& operator<<(QDataStream& out, const OffsetsHeader& data);
|
|||||||
QDataStream& operator>>(QDataStream& in, OffsetsHeader& data);
|
QDataStream& operator>>(QDataStream& in, OffsetsHeader& data);
|
||||||
|
|
||||||
|
|
||||||
class OffsetsHeaderEntry
|
class ADS_EXPORT_API OffsetsHeaderEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Type
|
|
||||||
{
|
|
||||||
Unknown = 0x00000001,
|
|
||||||
Hierarchy = 0x00000002,
|
|
||||||
SectionIndex = 0x00000003
|
|
||||||
};
|
|
||||||
|
|
||||||
OffsetsHeaderEntry();
|
OffsetsHeaderEntry();
|
||||||
qint32 type;
|
qint32 type;
|
||||||
qint64 offset;
|
qint64 offset;
|
||||||
@ -58,7 +61,7 @@ QDataStream& operator<<(QDataStream& out, const OffsetsHeaderEntry& data);
|
|||||||
QDataStream& operator>>(QDataStream& in, OffsetsHeaderEntry& data);
|
QDataStream& operator>>(QDataStream& in, OffsetsHeaderEntry& data);
|
||||||
|
|
||||||
|
|
||||||
class Section
|
class ADS_EXPORT_API Section
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Section();
|
Section();
|
||||||
@ -72,7 +75,7 @@ QDataStream& operator<<(QDataStream& out, const Section& data);
|
|||||||
QDataStream& operator>>(QDataStream& in, Section& data);
|
QDataStream& operator>>(QDataStream& in, Section& data);
|
||||||
|
|
||||||
|
|
||||||
class SectionContent
|
class ADS_EXPORT_API SectionContent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SectionContent();
|
SectionContent();
|
||||||
@ -84,7 +87,7 @@ QDataStream& operator<<(QDataStream& out, const SectionContent& data);
|
|||||||
QDataStream& operator>>(QDataStream& in, SectionContent& data);
|
QDataStream& operator>>(QDataStream& in, SectionContent& data);
|
||||||
|
|
||||||
|
|
||||||
class FloatingContent
|
class ADS_EXPORT_API FloatingContent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FloatingContent();
|
FloatingContent();
|
||||||
@ -100,7 +103,7 @@ QDataStream& operator>>(QDataStream& in, FloatingContent& data);
|
|||||||
|
|
||||||
|
|
||||||
// Type: OffsetHeaderEntry::Hierarchy
|
// Type: OffsetHeaderEntry::Hierarchy
|
||||||
class HierarchyData
|
class ADS_EXPORT_API HierarchyData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HierarchyData();
|
HierarchyData();
|
||||||
@ -111,7 +114,7 @@ QDataStream& operator>>(QDataStream& in, HierarchyData& data);
|
|||||||
|
|
||||||
|
|
||||||
// Type: OffsetHeaderEntry::SectionIndex
|
// Type: OffsetHeaderEntry::SectionIndex
|
||||||
class SectionIndexData
|
class ADS_EXPORT_API SectionIndexData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SectionIndexData();
|
SectionIndexData();
|
||||||
@ -125,7 +128,7 @@ QDataStream& operator>>(QDataStream& in, SectionIndexData& data);
|
|||||||
/*!
|
/*!
|
||||||
* \brief The InMemoryWriter class writes into a QByteArray.
|
* \brief The InMemoryWriter class writes into a QByteArray.
|
||||||
*/
|
*/
|
||||||
class InMemoryWriter
|
class ADS_EXPORT_API InMemoryWriter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InMemoryWriter();
|
InMemoryWriter();
|
||||||
@ -142,7 +145,7 @@ private:
|
|||||||
/*!
|
/*!
|
||||||
* \brief The InMemoryReader class
|
* \brief The InMemoryReader class
|
||||||
*/
|
*/
|
||||||
class InMemoryReader
|
class ADS_EXPORT_API InMemoryReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InMemoryReader(const QByteArray& data);
|
InMemoryReader(const QByteArray& data);
|
||||||
|
@ -118,7 +118,7 @@ QDataStream& operator>>(QDataStream& in, OffsetsHeader& data)
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
OffsetsHeaderEntry::OffsetsHeaderEntry() :
|
OffsetsHeaderEntry::OffsetsHeaderEntry() :
|
||||||
type(Unknown), offset(0), contentSize(0)
|
type(ET_Unknown), offset(0), contentSize(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ bool InMemoryWriter::write(qint32 entryType, const QByteArray& data)
|
|||||||
bool InMemoryWriter::write(const SectionIndexData& data)
|
bool InMemoryWriter::write(const SectionIndexData& data)
|
||||||
{
|
{
|
||||||
OffsetsHeaderEntry entry;
|
OffsetsHeaderEntry entry;
|
||||||
entry.type = OffsetsHeaderEntry::SectionIndex;
|
entry.type = ET_SectionIndex;
|
||||||
entry.offset = _contentBuffer.pos(); // Relative offset!
|
entry.offset = _contentBuffer.pos(); // Relative offset!
|
||||||
|
|
||||||
QDataStream out(&_contentBuffer);
|
QDataStream out(&_contentBuffer);
|
||||||
@ -340,7 +340,7 @@ QByteArray InMemoryWriter::toByteArray() const
|
|||||||
const qint64 allHeaderSize = out.device()->pos();
|
const qint64 allHeaderSize = out.device()->pos();
|
||||||
for (int i = 0; i < offsetsHeader.entriesCount; ++i)
|
for (int i = 0; i < offsetsHeader.entriesCount; ++i)
|
||||||
{
|
{
|
||||||
offsetsHeader.entries[i].offset += allHeaderSize;
|
offsetsHeader.entries[i].offset += allHeaderSize; // Absolute offset!
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seek back and write again with absolute offsets.
|
// Seek back and write again with absolute offsets.
|
||||||
|
Loading…
Reference in New Issue
Block a user