wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
SerializationContext.h File Reference

Deserialization/serialization context structs passed through load()/save() call chains. More...

#include <QHash>
#include <QMap>
#include <QString>
#include <QVersionNumber>
Include dependency graph for SerializationContext.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SerializationContext
 Bundles all per-deserialization state so that load() overrides receive it through one explicit parameter instead of several globals. More...
struct  SerializationOptions
 Options passed to GraphicElement::save() (and friends); the save-side counterpart of SerializationContext, kept separate since save() needs none of that struct's load-only fields (portMap, version, ...). More...

Enumerations

enum class  SerializationPurpose { PortableFile , InMemorySnapshot }
 What a serialization operation is for – shared by both load() and save(), so the same distinction is never expressed two different, independently maintained ways. More...

Detailed Description

Deserialization/serialization context structs passed through load()/save() call chains.

Definition in file SerializationContext.h.

Enumeration Type Documentation

◆ SerializationPurpose

enum class SerializationPurpose
strong

What a serialization operation is for – shared by both load() and save(), so the same distinction is never expressed two different, independently maintained ways.

Every external-file reference an element holds (an appearance image, a custom audio file, a file-based IC sub-circuit) needs a different representation depending on which of these an operation is:

  • PortableFile — a real, portable .panda file on disk (or a blob embedded in one). Written paths are stripped to a bare filename, since the referenced file is expected to live alongside the saved file (see WorkSpace::save()'s copy step). Read paths are relative/bare and get resolved against contextDir; a stored resource (":/...") value is NOT trusted on load, since the compiled-in resource it names may have been renamed/moved by a newer app version – the element's own current default is left alone instead.
  • InMemorySnapshot — an ephemeral, in-process byte array that never leaves this run: undo/redo snapshots, clipboard copy/paste, IC-reload rollback. No cross-version or cross-machine staleness is possible, so every value – resource or not – round-trips losslessly, verbatim, both ways.

There is deliberately no default value anywhere this enum is used: every construction site must say which one it means, so a future caller that forgets simply fails to compile rather than silently inheriting the wrong behavior.

Enumerator
PortableFile 
InMemorySnapshot 

Definition at line 42 of file SerializationContext.h.