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

Single, shared implementation of how an element's external-file reference (an appearance image, a custom audio file, a file-based IC sub-circuit) gets resolved on load and represented on save. Every class that owns such a reference routes through these functions instead of reimplementing the same path arithmetic – three independent copies of it had already silently drifted apart before this was extracted (see the "avoid this bug class" thread this was written for). More...

#include <optional>
#include <QDir>
#include <QFileInfo>
#include <QString>
#include "App/IO/SerializationContext.h"
Include dependency graph for ExternalFilePath.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  ExternalFilePath

Functions

std::optional< QString > ExternalFilePath::forReading (const QString &storedValue, const QString &contextDir, SerializationPurpose purpose)
QString ExternalFilePath::forWriting (const QString &path, SerializationPurpose purpose)
QString ExternalFilePath::resolve (const QString &storedPath, const QString &contextDir)

Detailed Description

Single, shared implementation of how an element's external-file reference (an appearance image, a custom audio file, a file-based IC sub-circuit) gets resolved on load and represented on save. Every class that owns such a reference routes through these functions instead of reimplementing the same path arithmetic – three independent copies of it had already silently drifted apart before this was extracted (see the "avoid this bug class" thread this was written for).

Definition in file ExternalFilePath.h.