Swiftray  1.0
DocumentSerializer Class Reference

Save and load documents as binary format. More...

#include <document-serializer.h>

Public Member Functions

 DocumentSerializer (QDataStream &stream)
 
BitmapShapedeserializeBitmapShape ()
 
DocumentdeserializeDocument ()
 
GroupShapedeserializeGroupShape ()
 
LayerPtr deserializeLayer ()
 
PathShapedeserializePathShape ()
 
ShapePtr deserializeShape ()
 
void deserializeShapeProp (Shape *shape)
 
TextShapedeserializeTextShape ()
 
void serializeBitmapShape (BitmapShape *shape)
 
void serializeDocument (Document &doc)
 
void serializeGroupShape (GroupShape *shape)
 
void serializeLayer (const LayerPtr &layer)
 
void serializePathShape (PathShape *shape)
 
void serializeShape (const ShapePtr &shape)
 
void serializeShapeProp (Shape *shape)
 
void serializeTextShape (TextShape *shape)
 

Public Attributes

QDataStream & in
 
QDataStream & out
 

Detailed Description

Save and load documents as binary format.

We use a single file for the serializer to maintain different file versions, so if we add new properties to the document/layer/shape objects in new versions, we can extend the serializer instead of adding a lot if/else to different classes. Notes: We can also use JSON, which is easier for backward-compatiblity and debug, but the performance may be slow. Notes: We may also use JSON partially to support volatile classes. JSON (O): Document settings, memo, metadata JSON (X): QPainterShape, QPixmap TODO (Add JSON Serializer for debugging scenes)

Constructor & Destructor Documentation

◆ DocumentSerializer()

DocumentSerializer::DocumentSerializer ( QDataStream &  stream)
inline

Member Function Documentation

◆ deserializeBitmapShape()

BitmapShape* DocumentSerializer::deserializeBitmapShape ( )
inline

◆ deserializeDocument()

Document* DocumentSerializer::deserializeDocument ( )
inline

◆ deserializeGroupShape()

GroupShape* DocumentSerializer::deserializeGroupShape ( )
inline

◆ deserializeLayer()

LayerPtr DocumentSerializer::deserializeLayer ( )
inline

◆ deserializePathShape()

PathShape* DocumentSerializer::deserializePathShape ( )
inline

◆ deserializeShape()

ShapePtr DocumentSerializer::deserializeShape ( )
inline

◆ deserializeShapeProp()

void DocumentSerializer::deserializeShapeProp ( Shape shape)
inline

◆ deserializeTextShape()

TextShape* DocumentSerializer::deserializeTextShape ( )
inline

◆ serializeBitmapShape()

void DocumentSerializer::serializeBitmapShape ( BitmapShape shape)
inline

◆ serializeDocument()

void DocumentSerializer::serializeDocument ( Document doc)
inline

◆ serializeGroupShape()

void DocumentSerializer::serializeGroupShape ( GroupShape shape)
inline

◆ serializeLayer()

void DocumentSerializer::serializeLayer ( const LayerPtr layer)
inline

◆ serializePathShape()

void DocumentSerializer::serializePathShape ( PathShape shape)
inline

◆ serializeShape()

void DocumentSerializer::serializeShape ( const ShapePtr shape)
inline

◆ serializeShapeProp()

void DocumentSerializer::serializeShapeProp ( Shape shape)
inline

◆ serializeTextShape()

void DocumentSerializer::serializeTextShape ( TextShape shape)
inline

Member Data Documentation

◆ in

QDataStream& DocumentSerializer::in

◆ out

QDataStream& DocumentSerializer::out

The documentation for this class was generated from the following file: