v2.0.0
Loading...
Searching...
No Matches
mna_io.cpp File Reference

Implementation of the MnaIO codecs — UTF-8 JSON for .mna files and CBOR (prefixed with the "MNX1" four-byte magic) for .mnx files. More...

#include "mna_io.h"
#include <QFile>
#include <QFileInfo>
#include <QJsonDocument>
#include <QJsonObject>
#include <QCborValue>
#include <QCborMap>
#include <QDebug>
Include dependency graph for mna_io.cpp:

Go to the source code of this file.

Detailed Description

Implementation of the MnaIO codecs — UTF-8 JSON for .mna files and CBOR (prefixed with the "MNX1" four-byte magic) for .mnx files.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.2.0
Date
April 2026

The read / write entry points dispatch on the file extension and delegate to the four private helpers. The CBOR writer emits the MNX1 magic up-front so the reader can fast-fail on a mismatched binary before attempting to decode the payload; the JSON writer pretty-prints with indentation so .mna files remain diff- and human-friendly under version control. All four helpers share a strict error-handling policy: file or parse errors surface as empty projects with a warning on qWarning so callers cannot silently confuse load failures with empty input.

Definition in file mna_io.cpp.