|
wiRedPanda
Logic Circuit Simulator
|
Serializes a GraphicElement to/from a versioned QDataStream. More...
#include <GraphicElementSerializer.h>
Static Public Member Functions | |
| static void | load (GraphicElement &element, QDataStream &stream, SerializationContext &context) |
| Reads element from stream, dispatching on the format version in context. | |
| static void | save (const GraphicElement &element, QDataStream &stream, SerializationOptions options) |
| Writes element to stream (current keyed-QMap format). | |
Serializes a GraphicElement to/from a versioned QDataStream.
Extracted from GraphicElement so persistence is a collaborator rather than a cluster of methods on the element itself. A friend of GraphicElement, it reaches the element's ports/orientation/appearance/context-directory state through that friendship. The element keeps thin virtual save()/load() entry points that delegate here, so subclasses (e.g. IC) can still extend the load via their override. All methods are static and take the element explicitly; no serializer instance state is needed.
Definition at line 37 of file GraphicElementSerializer.h.
|
static |
Reads element from stream, dispatching on the format version in context.
Definition at line 212 of file GraphicElementSerializer.cpp.
References ElementOrientation::applyLoadedOrientation(), VersionInfo::hasQMapFormat(), qCDebug, GraphicElement::updatePortsProperties(), and SerializationContext::version.
Referenced by GraphicElement::load().
|
static |
Writes element to stream (current keyed-QMap format).
Definition at line 93 of file GraphicElementSerializer.cpp.
References ElementAppearance::alternativeAppearances(), GraphicElement::elementType(), ExternalFilePath::forWriting(), ItemWithId::id(), ElementPorts::inputs(), GraphicElement::isFlippedX(), GraphicElement::isFlippedY(), GraphicElement::label(), GraphicElement::m_appearance, GraphicElement::m_ports, Port::makeSerialId(), ElementPorts::outputs(), PortableFile, SerializationOptions::purpose, qCDebug, GraphicElement::rotation(), and GraphicElement::trigger().
Referenced by GraphicElement::save().