Adds prototype classes for better serialization.
This commit is contained in:
@@ -17,7 +17,7 @@ class QSplitter;
|
||||
#endif
|
||||
|
||||
// Use namespace
|
||||
// Disabled with Qt4!
|
||||
// Disabled with Qt4, it makes problems with signals and slots.
|
||||
#ifdef ADS_NAMESPACE_ENABLED
|
||||
#define ADS_NAMESPACE_BEGIN namespace ads {
|
||||
#define ADS_NAMESPACE_END }
|
||||
@@ -28,6 +28,12 @@ class QSplitter;
|
||||
#define ADS_NS
|
||||
#endif
|
||||
|
||||
// Always enable "serialization" namespace.
|
||||
// It is not required for signals and slots.
|
||||
#define ADS_NAMESPACE_SER_BEGIN namespace ads { namespace serialization {
|
||||
#define ADS_NAMESPACE_SER_END }}
|
||||
#define ADS_NS_SER ::ads::serialization
|
||||
|
||||
// Width of the native window frame border (based on OS).
|
||||
#define ADS_WINDOW_FRAME_BORDER_WIDTH 7
|
||||
|
||||
|
||||
116
AdvancedDockingSystem/include/ads/Serialization.h
Normal file
116
AdvancedDockingSystem/include/ads/Serialization.h
Normal file
@@ -0,0 +1,116 @@
|
||||
#ifndef ADS_SERIALIZATION_H
|
||||
#define ADS_SERIALIZATION_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QDataStream>
|
||||
|
||||
#include "ads/API.h"
|
||||
|
||||
ADS_NAMESPACE_SER_BEGIN
|
||||
|
||||
class Header
|
||||
{
|
||||
public:
|
||||
Header();
|
||||
qint32 magic;
|
||||
qint32 version;
|
||||
};
|
||||
QDataStream& operator<<(QDataStream& out, const Header& data);
|
||||
QDataStream& operator>>(QDataStream& in, Header& data);
|
||||
|
||||
|
||||
class OffsetHeader
|
||||
{
|
||||
public:
|
||||
OffsetHeader();
|
||||
qint64 length;
|
||||
QList<class OffsetHeaderEntry> entries;
|
||||
};
|
||||
QDataStream& operator<<(QDataStream& out, const OffsetHeader& data);
|
||||
QDataStream& operator>>(QDataStream& in, OffsetHeader& data);
|
||||
|
||||
|
||||
class OffsetHeaderEntry
|
||||
{
|
||||
public:
|
||||
enum Type
|
||||
{
|
||||
Unknown = 0x00000001,
|
||||
Hierarchy = 0x00000002,
|
||||
SectionIndex = 0x00000003
|
||||
};
|
||||
|
||||
OffsetHeaderEntry();
|
||||
qint32 type;
|
||||
qint64 offset;
|
||||
qint64 length;
|
||||
};
|
||||
QDataStream& operator<<(QDataStream& out, const OffsetHeaderEntry& data);
|
||||
QDataStream& operator>>(QDataStream& in, OffsetHeaderEntry& data);
|
||||
|
||||
|
||||
class Section
|
||||
{
|
||||
public:
|
||||
Section();
|
||||
qint32 width;
|
||||
qint32 height;
|
||||
qint32 currentIndex;
|
||||
qint32 sectionContentsCount;
|
||||
QList<class SectionContent> sectionContents;
|
||||
};
|
||||
QDataStream& operator<<(QDataStream& out, const Section& data);
|
||||
QDataStream& operator>>(QDataStream& in, Section& data);
|
||||
|
||||
|
||||
class SectionContent
|
||||
{
|
||||
public:
|
||||
SectionContent();
|
||||
QString uniqueName;
|
||||
bool visible;
|
||||
qint32 preferredIndex;
|
||||
};
|
||||
QDataStream& operator<<(QDataStream& out, const SectionContent& data);
|
||||
QDataStream& operator>>(QDataStream& in, SectionContent& data);
|
||||
|
||||
|
||||
class FloatingContent
|
||||
{
|
||||
public:
|
||||
FloatingContent();
|
||||
QString uniqueName;
|
||||
qint32 xpos;
|
||||
qint32 ypos;
|
||||
qint32 width;
|
||||
qint32 height;
|
||||
bool visible;
|
||||
};
|
||||
QDataStream& operator<<(QDataStream& out, const FloatingContent& data);
|
||||
QDataStream& operator>>(QDataStream& in, FloatingContent& data);
|
||||
|
||||
|
||||
// Type: OffsetHeaderEntry::Hierarchy
|
||||
class HierarchyData
|
||||
{
|
||||
public:
|
||||
HierarchyData();
|
||||
QByteArray data;
|
||||
};
|
||||
QDataStream& operator<<(QDataStream& out, const HierarchyData& data);
|
||||
QDataStream& operator>>(QDataStream& in, HierarchyData& data);
|
||||
|
||||
|
||||
// Type: OffsetHeaderEntry::SectionIndex
|
||||
class SectionIndexData
|
||||
{
|
||||
public:
|
||||
SectionIndexData();
|
||||
qint32 sectionsCount;
|
||||
QList<Section> sections;
|
||||
};
|
||||
|
||||
ADS_NAMESPACE_SER_END
|
||||
#endif
|
||||
Reference in New Issue
Block a user