mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-15 01:54:14 +02:00
8ea051acfc
Format 3 folio files lose what building a folio computes (QetContainer::dropComputed()): a wire's description of its ends (element1_label, element1_name, element1_linked, terminalname1 and the same for end 2), the content of a symbol text showing the symbol's information or a composition of it, and -- when the project database's index is written, every symbol with a uuid of its own -- a symbol's list of its terminals. What may go was found by test, not by reading: on 342 projects saved by this version, each kind taken out of the file, the project opened and saved: the wire ends came back in all 244 that had them, the symbol texts in all 201, the terminal lists in 305 of 306 -- not in the file whose symbols share a uuid (#1408), where wires find their ends by them; such a project gets no index, so it keeps them. Stays, for now: labels made from a formula and wire numbers made from one, in the database (opening from the index and numbering read them), and a table's size (the user's as much as computed). tst_qetcontainer compares a joined document with the original less what is computed, and computedNotKept checks a file holding both kinds (one filled in by the test) loses them -- it fails when nothing is dropped. Through QElectroTech, 342 projects: a .qetz opened from its index and saved as .qet = eager = master; every folio of industrial and f2099 drawn and linked as eager (f2099 but its 3 render-noise folios). ctest 96/96 with and without QET_LAZY_FOLIOS=1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
74 lines
2.9 KiB
C++
74 lines
2.9 KiB
C++
/*
|
|
Copyright 2006-2026 The QElectroTech Team
|
|
This file is part of QElectroTech.
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef QETCONTAINER_H
|
|
#define QETCONTAINER_H
|
|
|
|
#include "qetzip.h"
|
|
|
|
#include <QDomDocument>
|
|
|
|
/**
|
|
@brief The QetContainer namespace
|
|
Splits a project document into the parts of a .qetz file and joins
|
|
them back:
|
|
|
|
mimetype first, stored
|
|
manifest.xml format and oldest format allowed to read it
|
|
project.xml the project, each part replaced by
|
|
<qetz-part file="..."/>
|
|
project.sqlite the engineering data (format 2,
|
|
QetContainerDb): title-block fields, symbol
|
|
information, links, wires
|
|
folios/<uuid>.xml one per folio
|
|
elements/.../<name> the project's symbol definitions
|
|
titleblocks/<name>.titleblock
|
|
images/<sha256>.png folio pictures, once each, not base64
|
|
|
|
join(split(d)) is d. Nothing here knows what the parts mean: the
|
|
project is read and written by the same code as a .qet file.
|
|
*/
|
|
namespace QetContainer
|
|
{
|
|
extern const char MimeType[];
|
|
/// The format written; files of a later format are refused by join()
|
|
/// unless their min-reader allows this one.
|
|
constexpr int Format = 3;
|
|
|
|
QList<QetZip::Entry> split(const QDomDocument &project,
|
|
const QString &writer = QString(),
|
|
QString *error = nullptr,
|
|
const QByteArray &index = QByteArray());
|
|
bool join(const QList<QetZip::Entry> &entries, QDomDocument *project,
|
|
QString *error = nullptr, QStringList *folio_files = nullptr);
|
|
/// A folio part of @p files, which join() left out, with its
|
|
/// pictures and its engineering data back (stage D2)
|
|
bool readFolio(const QHash<QString, QByteArray> &files, const QString &file,
|
|
QDomDocument *folio, QString *error = nullptr);
|
|
|
|
/// Take what QElectroTech computes out of a folio (format 3)
|
|
void dropComputed(QDomElement diagram, bool terminal_lists);
|
|
/// Parse @p xml as a .qet is read (QETProject::openFile)
|
|
bool parse(const QByteArray &xml, QDomDocument *document, QString *error = nullptr);
|
|
/// true if @p content is a zip, so a .qetz rather than a .qet
|
|
bool isZip(const QByteArray &content);
|
|
/// The project document in @p content, a .qet or a .qetz
|
|
bool readDocument(const QByteArray &content, QDomDocument *document, QString *error = nullptr);
|
|
}
|
|
|
|
#endif // QETCONTAINER_H
|