MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / appendFileInfo

Function appendFileInfo

pj_app/tests/layout_xml_test.cpp:158–172  ·  view source on GitHub ↗

Appends an extra to an existing data-source doc, so a single doc can carry multiple loaded files (mirrors a multi-file session save).

Source from the content-addressed store, hash-verified

156// Appends an extra <fileInfo> to an existing data-source doc, so a single doc
157// can carry multiple loaded files (mirrors a multi-file session save).
158void appendFileInfo(
159 QDomDocument& doc, const QString& filename, const QString& prefix = QString(), const QString& plugin_id = QString(),
160 const QString& plugin_json = QString()) {
161 QDomElement wrapper = doc.documentElement().firstChildElement(QStringLiteral("previouslyLoaded_Datafiles"));
162 QDomElement file_info = doc.createElement(QStringLiteral("fileInfo"));
163 file_info.setAttribute(QStringLiteral("filename"), filename);
164 file_info.setAttribute(QStringLiteral("prefix"), prefix);
165 if (!plugin_id.isEmpty()) {
166 QDomElement plugin = doc.createElement(QStringLiteral("plugin"));
167 plugin.setAttribute(QStringLiteral("ID"), plugin_id);
168 PJ::layout_xml::appendJsonAsCdata(doc, plugin, plugin_json);
169 file_info.appendChild(plugin);
170 }
171 wrapper.appendChild(file_info);
172}
173
174TEST(ExtractDataSource, EmptyDocReturnsEmptyList) {
175 QDomDocument doc;

Callers 1

TESTFunction · 0.85

Calls 4

appendJsonAsCdataFunction · 0.85
QStringClass · 0.50
setAttributeMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected