• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pcolby / doxlee / 9243837855

26 May 2024 02:01PM UTC coverage: 81.176% (+6.3%) from 74.892%
9243837855

push

github

pcolby
Implement Doxyfile parsing

28 of 38 new or added lines in 1 file covered. (73.68%)

21 existing lines in 1 file now uncovered.

552 of 680 relevant lines covered (81.18%)

4514.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.06
/src/doxml.cpp
1
// SPDX-FileCopyrightText: 2021-2024 Paul Colby <git@colby.id.au>
2
// SPDX-License-Identifier: LGPL-3.0-or-later
3

4
#include "doxml.h"
5

6
#include "variant.h"
7

8
#include <QCoreApplication>
9
#include <QDebug>
10
#include <QJsonDocument> /// \todo Remove; only for early dev / debugging.
11

12
/// Shorten the QStringLiteral macro for readability.
13
#define QSL(str) QStringLiteral(str)
14

15
/// Shorten QCoreApplication::translate calls for readability.
16
#define QTR(str) QCoreApplication::translate("doxml", str)
17

18
namespace doxlee {
19

20
namespace doxml {
21

22
static Q_LOGGING_CATEGORY(lc, "doxlee.doxml", QtInfoMsg);
1,056✔
23

24
QPair<QStringList,QStringList> kinds(const QDir &doxmlDir)
72✔
25
{
26
    return kinds(doxmlDir.absoluteFilePath(QSL("index.xsd")));
126✔
27
}
28

29
QPair<QStringList,QStringList> kinds(const QString &indexXsdPath)
72✔
30
{
31
    // Open the file for reading.
32
    QFile file(indexXsdPath);
72✔
33
    if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) {
72✔
UNCOV
34
        qCWarning(lc).noquote() << QTR("Error opening file for reading: %1").arg(indexXsdPath);
×
35
        return { };
36
    }
37

38
    QStringList compoundKinds, memberKinds;
54✔
39

40
    // Parse the opening <schema> element.
41
    QXmlStreamReader xml(&file);
72✔
42
    if (!xml.readNextStartElement()) {
72✔
UNCOV
43
        qCWarning(lc).noquote() << QTR("Invalid XML file: %1 - %2").arg(indexXsdPath, xml.errorString());
×
44
        return { };
45
    }
46
    if (xml.name() != QSL("schema")) {
90✔
UNCOV
47
        qCWarning(lc).noquote() << QTR("File is not a Doxygen XML index schema: %1 - %2")
×
UNCOV
48
            .arg(indexXsdPath, xml.name().toString());
×
49
        return { };
50
    }
51

52
    // Parse the contained 'kind' elements.
53
    while ((!xml.atEnd()) && (xml.readNextStartElement())) {
576✔
54
        if (xml.name() == QSL("simpleType")) {
1,008✔
55
            const QString nameAttribute = xml.attributes().value(QSL("name")).toString();
252✔
56
            if ((nameAttribute == QSL("CompoundKind")) || (nameAttribute == QSL("MemberKind"))) {
252✔
57
                while ((!xml.atEnd()) && (xml.readNextStartElement())) {
288✔
58
                    if (xml.name() == QSL("restriction")) {
288✔
59
                        QStringList &kindsList = (nameAttribute == QLatin1String("CompoundKind"))
252✔
60
                            ? compoundKinds : memberKinds;
144✔
61
                        while ((!xml.atEnd()) && (xml.readNextStartElement())) {
2,184✔
62
                            if (xml.name() == QSL("enumeration")) {
4,080✔
63
                                kindsList.append(xml.attributes().value(QSL("value")).toString());
3,570✔
64
                            }
65
                            xml.skipCurrentElement();
2,040✔
66
                        }
UNCOV
67
                    } else xml.skipCurrentElement();
×
68
                }
69
            } else xml.skipCurrentElement();
×
70
        } else xml.skipCurrentElement();
396✔
71
    }
72
    qCInfo(lc).noquote() << QTR("Parsed %1 compound kind(s), and %2 member kind(s) from %3")
180✔
73
        .arg(compoundKinds.size()).arg(memberKinds.size()).arg(indexXsdPath);
126✔
74
    return { compoundKinds, memberKinds };
72✔
75
}
144✔
76

77
QVariantMap parseIndex(const QDir &doxmlDir, const bool extraIndexes)
72✔
78
{
79
    return parseIndex(doxmlDir.absoluteFilePath(QSL("index.xml")), extraIndexes);
126✔
80
}
81

82
QVariantMap parseIndex(const QString &indexXmlPath, const bool extraIndexes)
72✔
83
{
84
    // Open the file for reading.
85
    QFile file(indexXmlPath);
72✔
86
    if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) {
72✔
UNCOV
87
        qCWarning(lc).noquote() << QTR("Error opening file for reading: %1").arg(indexXmlPath);
×
88
        return QVariantMap();
89
    }
90

91
    // Parse the opening <doxygenindex> element.
92
    QXmlStreamReader xml(&file);
72✔
93
    if (!xml.readNextStartElement()) {
72✔
UNCOV
94
        qCWarning(lc).noquote() << QTR("Invalid XML file: %1 - %2").arg(indexXmlPath, xml.errorString());
×
95
        return QVariantMap();
96
    }
97
    qCDebug(lc) << xml.name() << "version" << xml.attributes().value(QSL("version"))
90✔
UNCOV
98
             << xml.attributes().value(QSL("xml:lang")).toString();
×
99
    if (xml.name() != QSL("doxygenindex")) {
90✔
100
        qCWarning(lc).noquote() << QTR("File is not a Doxygen XML index: %1 - %2")
×
UNCOV
101
                                .arg(indexXmlPath, xml.name().toString());
×
102
        return QVariantMap();
103
    }
104
    QVariantMap indexMap;
54✔
105
    indexMap.insert(QSL("doxygenVersion"), xml.attributes().value(QSL("version")).toString());
180✔
106
    indexMap.insert(QSL("doxygenLanguage"), xml.attributes().value(QSL("xml:lang")).toString());
180✔
107

108
    // Parse the contained <compound> elements.
109
    QVariantList compounds;
54✔
110
    while ((!xml.atEnd()) && (xml.readNextStartElement())) {
2,160✔
111
        if (xml.name() == QSL("compound")) {
4,176✔
112
            QVariantMap compound;
1,566✔
113
            compound.insert(QSL("refid"), xml.attributes().value(QSL("refid")).toString());
5,220✔
114
            compound.insert(QSL("kind"), xml.attributes().value(QSL("kind")).toString());
5,220✔
115
            if ((!xml.readNextStartElement()) || (xml.name() != QSL("name"))) {
4,176✔
UNCOV
116
                qCWarning(lc).noquote() << QTR(" %1:%2:%3 <compound> does not begin with <name>")
×
UNCOV
117
                    .arg(indexXmlPath).arg(xml.lineNumber()).arg(xml.columnNumber());
×
118
                return QVariantMap();
119
            }
120
            compound.insert(QSL("name"), xml.readElementText());
3,654✔
121
            //qCDebug(lc) << __func__ << "compound" << compound;
122
            QVariantList members;
1,566✔
123
            while ((!xml.atEnd()) && (xml.readNextStartElement())) {
5,328✔
124
                if (xml.name() == QSL("member")) {
6,480✔
125
                    QVariantMap member;
2,430✔
126
                    member.insert(QSL("refid"), xml.attributes().value(QSL("refid")).toString());
8,100✔
127
                    member.insert(QSL("kind"), xml.attributes().value(QSL("kind")).toString());
8,100✔
128
                    if ((!xml.readNextStartElement()) || (xml.name() != QSL("name"))) {
6,480✔
UNCOV
129
                        qCWarning(lc).noquote() << QTR("%1:%2:%3 <member> does not begin with <name>")
×
UNCOV
130
                            .arg(indexXmlPath).arg(xml.lineNumber()).arg(xml.columnNumber());
×
131
                        return QVariantMap();
132
                    }
133
                    member.insert(QSL("name"), xml.readElementText());
5,670✔
134
                    //qCDebug(lc) << __func__ << "member" << member;
135
                    members.append(member);
5,670✔
136
                    xml.skipCurrentElement();
3,240✔
137
                } else {
810✔
UNCOV
138
                    qCWarning(lc).noquote() << QTR("Skipping unknown <%1> element at %2:%3:%4")
×
UNCOV
139
                        .arg(xml.name().toString(), indexXmlPath).arg(xml.lineNumber()).arg(xml.columnNumber());
×
140
                    xml.skipCurrentElement();
×
141
                }
142
            }
143
            compound.insert(QSL("members"), members);
3,654✔
144
            compounds.append(compound);
3,654✔
145
        } else {
522✔
UNCOV
146
            qCWarning(lc).noquote() << QTR("Skipping unknown <%1> element at %2:%3:%4")
×
UNCOV
147
                .arg(xml.name().toString(), indexXmlPath).arg(xml.lineNumber()).arg(xml.columnNumber());
×
148
            xml.skipCurrentElement();
×
149
        }
150
    }
151
    qCInfo(lc).noquote() << QTR("Parsed %1 compound(s) from %2").arg(compounds.size()).arg(indexXmlPath);
180✔
152
    indexMap.insert(QSL("compoundsList"), compounds);
126✔
153
    if (extraIndexes) {
72✔
154
        #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
155
        indexMap.insert(doxml::extraIndexes(compounds));
126✔
156
        #else
157
        const QVariantMap extra = doxml::extraIndexes(compounds);
158
        for (auto iter = extra.constBegin(); iter != extra.constEnd(); ++iter) {
159
            indexMap.insert(iter.key(), iter.value());
160
        }
161
        #endif
162
    }
163
    return indexMap;
164
}
72✔
165

166
QVariantMap extraIndexes(const QVariantList &compounds)
72✔
167
{
168
    QHash<QString,QVariantList> compoundsByKind, membersByKind;
54✔
169
    QVariantMap compoundsByRefId, membersByRefId;
54✔
170
    for (const QVariant &compound: compounds) {
2,160✔
171
        const QVariantMap compoundMap = compound.toMap();
2,088✔
172
        {
173
            const QString kind = compoundMap.value(QSL("kind")).toString();
4,176✔
174
            const QString refid = compoundMap.value(QSL("refid")).toString();
4,176✔
175
            compoundsByKind[kind].append(compound);
2,088✔
176
            compoundsByRefId.insert(refid, compound);
2,088✔
177
        }
522✔
178

179
        const QVariantList members = compoundMap.value(QSL("members")).toList();
4,176✔
180
        for (const QVariant &member: members) {
5,328✔
181
            const QVariantMap memberMap = member.toMap();
3,240✔
182
            const QString kind = memberMap.value(QSL("kind")).toString();
6,480✔
183
            const QString refid = memberMap.value(QSL("refid")).toString();
6,480✔
184
            membersByKind[kind].append(member);
3,240✔
185
            membersByRefId.insert(refid, member);
3,240✔
186
        }
810✔
187
    }
522✔
188
    for (QVariantList &compoundsList: compoundsByKind) sortBy(compoundsList, QSL("name"));
888✔
189
    for (QVariantList &membersList: membersByKind)     sortBy(membersList,   QSL("name"));
720✔
190
    return QVariantMap{
191
        { QSL("compoundsByKind" ), toVariant(compoundsByKind) },
144✔
192
        { QSL("compoundsByRefId"), compoundsByRefId           },
72✔
193
        { QSL("membersByKind"   ), toVariant(membersByKind)   },
144✔
194
        { QSL("membersByRefId"  ), membersByRefId             },
72✔
195
    };
558✔
196
}
72✔
197

198
QVariantMap parseCompound(const QDir &doxmlDir, const QString &refId)
384✔
199
{
200
    return parseCompound(doxmlDir.absoluteFilePath(QSL("%1.xml").arg(refId)));
672✔
201
}
202

203
QVariantMap parseCompound(const QString &compoundXmlPath)
384✔
204
{
205
    // Open the compound XML file.
206
    QFile file(compoundXmlPath);
384✔
207
    if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) {
384✔
UNCOV
208
        qCWarning(lc).noquote() << QTR("Error opening file for reading: %1").arg(compoundXmlPath);
×
209
        return QVariantMap();
210
    }
211

212
    // Parse, and fetch the compoundDef element.
213
    QXmlStreamReader xml(&file);
384✔
214
    const QVariantMap compoundDef = toVariant(xml).value(QSL("doxygen")).toMap().value(QSL("compounddef")).toMap();
768✔
215
    if (compoundDef.isEmpty()) {
384✔
UNCOV
216
        qCWarning(lc).noquote() << QTR("Error reading compond defintion: %1").arg(compoundXmlPath);
×
217
        return QVariantMap();
218
    }
219
    qCDebug(lc).noquote() << QJsonDocument::fromVariant(compoundDef).toJson();
480✔
220

221
    // Map the compoundDef properties to our own compound map.
222
    QVariantMap compound{
223
        { QSL("name"), compoundDef.value(QSL("compoundname")).toMap().value(QSL(".Characters")) },
768✔
224
        /// \todo Provide stand way of fetch, and trimming, all text from each of these...
225
        // { QSL("brief"),       compoundDef.value(QSL("briefdescription")).toMap().value(QSL(".Characters")) },
226
        // { QSL("description"), compoundDef.value(QSL("fulldescription" )).toMap().value(QSL(".Characters")) },
227
    };
1,152✔
228

229
    // Copy call compoundDef attributes to top-level compound properties.
230
    for (const QVariant &attribute: compoundDef) {
5,760✔
231
        const auto map = attribute.toMap();
5,376✔
232
        const auto name = map.find(QSL("QualifiedName"));
5,376✔
233
        const auto value = map.find(QSL("Value"));
5,376✔
234
        if ((name != map.constEnd()) && (value != map.constEnd())) {
5,376✔
235
            compound.insert(name->toString(), *value);
2,814✔
236
        }
237
    }
1,344✔
238

239
    /// \todo More parsing here...
240

241
    qCDebug(lc).noquote() << QJsonDocument::fromVariant(compound).toJson();
480✔
242
    return compound;
243
}
384✔
244

245
} // namespace doxml
246

247
Doxml::Doxml(const QString &doxmlDir) : doxmlDir(doxmlDir)
760✔
248
{
249

250
}
760✔
251

UNCOV
252
bool Doxml::isValid() const
×
253
{
UNCOV
254
    return false; /// \todo.
×
255
}
256

257
QString Doxml::location(const QXmlStreamReader &xml) const
24✔
258
{
259
    return QStringLiteral("%1:%2:%3").arg(currentXmlFilePath).arg(xml.lineNumber()).arg(xml.columnNumber());
24✔
260
}
261

262
QVariantMap Doxml::parseCompound(QXmlStreamReader &xml) const
8✔
263
{
264
    /// \todo Implement Doxml::parseCompound().
265
    Q_UNUSED(xml)
266
    return {};
8✔
267
}
268

269
QVariantMap Doxml::parseCompound_DoxygenType(QXmlStreamReader &xml) const
8✔
270
{
271
    /// \todo Implement Doxml::parseCompound_DoxygenType().
272
    Q_UNUSED(xml)
273
    return {};
8✔
274
}
275

276
QVariantMap Doxml::parseCompound_compounddefType(QXmlStreamReader &xml) const
8✔
277
{
278
    /// \todo Implement Doxml::parseCompound_compounddefType().
279
    Q_UNUSED(xml)
280
    return {};
8✔
281
}
282

283
QVariantMap Doxml::parseCompound_listofallmembersType(QXmlStreamReader &xml) const
8✔
284
{
285
    /// \todo Implement Doxml::parseCompound_listofallmembersType().
286
    Q_UNUSED(xml)
287
    return {};
8✔
288
}
289

290
QVariantMap Doxml::parseCompound_memberRefType(QXmlStreamReader &xml) const
8✔
291
{
292
    /// \todo Implement Doxml::parseCompound_memberRefType().
293
    Q_UNUSED(xml)
294
    return {};
8✔
295
}
296

297
QVariantMap Doxml::parseCompound_docHtmlOnlyType(QXmlStreamReader &xml) const
8✔
298
{
299
    /// \todo Implement Doxml::parseCompound_docHtmlOnlyType().
300
    Q_UNUSED(xml)
301
    return {};
8✔
302
}
303

304
QVariantMap Doxml::parseCompound_compoundRefType(QXmlStreamReader &xml) const
8✔
305
{
306
    /// \todo Implement Doxml::parseCompound_compoundRefType().
307
    Q_UNUSED(xml)
308
    return {};
8✔
309
}
310

311
QVariantMap Doxml::parseCompound_reimplementType(QXmlStreamReader &xml) const
8✔
312
{
313
    /// \todo Implement Doxml::parseCompound_reimplementType().
314
    Q_UNUSED(xml)
315
    return {};
8✔
316
}
317

318
QVariantMap Doxml::parseCompound_incType(QXmlStreamReader &xml) const
8✔
319
{
320
    /// \todo Implement Doxml::parseCompound_incType().
321
    Q_UNUSED(xml)
322
    return {};
8✔
323
}
324

325
QVariantMap Doxml::parseCompound_exportsType(QXmlStreamReader &xml) const
8✔
326
{
327
    /// \todo Implement Doxml::parseCompound_exportsType().
328
    Q_UNUSED(xml)
329
    return {};
7✔
330
}
331

332
QVariantMap Doxml::parseCompound_exportType(QXmlStreamReader &xml) const
8✔
333
{
334
    /// \todo Implement Doxml::parseCompound_exportType().
335
    Q_UNUSED(xml)
336
    return {};
8✔
337
}
338

339
QVariantMap Doxml::parseCompound_refType(QXmlStreamReader &xml) const
8✔
340
{
341
    /// \todo Implement Doxml::parseCompound_refType().
342
    Q_UNUSED(xml)
343
    return {};
8✔
344
}
345

346
QVariantMap Doxml::parseCompound_refTextType(QXmlStreamReader &xml) const
8✔
347
{
348
    /// \todo Implement Doxml::parseCompound_refTextType().
349
    Q_UNUSED(xml)
350
    return {};
8✔
351
}
352

353
QVariantMap Doxml::parseCompound_MemberType(QXmlStreamReader &xml) const
8✔
354
{
355
    /// \todo Implement Doxml::parseCompound_MemberType().
356
    Q_UNUSED(xml)
357
    return {};
8✔
358
}
359

360
QVariantMap Doxml::parseCompound_sectiondefType(QXmlStreamReader &xml) const
8✔
361
{
362
    /// \todo Implement Doxml::parseCompound_sectiondefType().
363
    Q_UNUSED(xml)
364
    return {};
8✔
365
}
366

367
QVariantMap Doxml::parseCompound_memberdefType(QXmlStreamReader &xml) const
8✔
368
{
369
    /// \todo Implement Doxml::parseCompound_memberdefType().
370
    Q_UNUSED(xml)
371
    return {};
8✔
372
}
373

374
QVariantMap Doxml::parseCompound_descriptionType(QXmlStreamReader &xml) const
8✔
375
{
376
    /// \todo Implement Doxml::parseCompound_descriptionType().
377
    Q_UNUSED(xml)
378
    return {};
8✔
379
}
380

381
QVariantMap Doxml::parseCompound_enumvalueType(QXmlStreamReader &xml) const
8✔
382
{
383
    /// \todo Implement Doxml::parseCompound_enumvalueType().
384
    Q_UNUSED(xml)
385
    return {};
8✔
386
}
387

388
QVariantMap Doxml::parseCompound_templateparamlistType(QXmlStreamReader &xml) const
8✔
389
{
390
    /// \todo Implement Doxml::parseCompound_templateparamlistType().
391
    Q_UNUSED(xml)
392
    return {};
8✔
393
}
394

395
QVariantMap Doxml::parseCompound_paramType(QXmlStreamReader &xml) const
8✔
396
{
397
    /// \todo Implement Doxml::parseCompound_paramType().
398
    Q_UNUSED(xml)
399
    return {};
8✔
400
}
401

402
QVariantMap Doxml::parseCompound_linkedTextType(QXmlStreamReader &xml) const
8✔
403
{
404
    /// \todo Implement Doxml::parseCompound_linkedTextType().
405
    Q_UNUSED(xml)
406
    return {};
8✔
407
}
408

409
QVariantMap Doxml::parseCompound_graphType(QXmlStreamReader &xml) const
8✔
410
{
411
    /// \todo Implement Doxml::parseCompound_graphType().
412
    Q_UNUSED(xml)
413
    return {};
8✔
414
}
415

416
QVariantMap Doxml::parseCompound_nodeType(QXmlStreamReader &xml) const
8✔
417
{
418
    /// \todo Implement Doxml::parseCompound_nodeType().
419
    Q_UNUSED(xml)
420
    return {};
8✔
421
}
422

423
QVariantMap Doxml::parseCompound_childnodeType(QXmlStreamReader &xml) const
8✔
424
{
425
    /// \todo Implement Doxml::parseCompound_childnodeType().
426
    Q_UNUSED(xml)
427
    return {};
8✔
428
}
429

430
QVariantMap Doxml::parseCompound_linkType(QXmlStreamReader &xml) const
8✔
431
{
432
    /// \todo Implement Doxml::parseCompound_linkType().
433
    Q_UNUSED(xml)
434
    return {};
8✔
435
}
436

437
QVariantMap Doxml::parseCompound_listingType(QXmlStreamReader &xml) const
8✔
438
{
439
    /// \todo Implement Doxml::parseCompound_listingType().
440
    Q_UNUSED(xml)
441
    return {};
8✔
442
}
443

444
QVariantMap Doxml::parseCompound_codelineType(QXmlStreamReader &xml) const
8✔
445
{
446
    /// \todo Implement Doxml::parseCompound_codelineType().
447
    Q_UNUSED(xml)
448
    return {};
8✔
449
}
450

451
QVariantMap Doxml::parseCompound_highlightType(QXmlStreamReader &xml) const
8✔
452
{
453
    /// \todo Implement Doxml::parseCompound_highlightType().
454
    Q_UNUSED(xml)
455
    return {};
8✔
456
}
457

458
QVariantMap Doxml::parseCompound_spType(QXmlStreamReader &xml) const
8✔
459
{
460
    /// \todo Implement Doxml::parseCompound_spType().
461
    Q_UNUSED(xml)
462
    return {};
8✔
463
}
464

465
QVariantMap Doxml::parseCompound_referenceType(QXmlStreamReader &xml) const
8✔
466
{
467
    /// \todo Implement Doxml::parseCompound_referenceType().
468
    Q_UNUSED(xml)
469
    return {};
8✔
470
}
471

472
QVariantMap Doxml::parseCompound_locationType(QXmlStreamReader &xml) const
8✔
473
{
474
    /// \todo Implement Doxml::parseCompound_locationType().
475
    Q_UNUSED(xml)
476
    return {};
8✔
477
}
478

479
QVariantMap Doxml::parseCompound_docSect1Type(QXmlStreamReader &xml) const
8✔
480
{
481
    /// \todo Implement Doxml::parseCompound_docSect1Type().
482
    Q_UNUSED(xml)
483
    return {};
8✔
484
}
485

486
QVariantMap Doxml::parseCompound_docSect2Type(QXmlStreamReader &xml) const
8✔
487
{
488
    /// \todo Implement Doxml::parseCompound_docSect2Type().
489
    Q_UNUSED(xml)
490
    return {};
8✔
491
}
492

493
QVariantMap Doxml::parseCompound_docSect3Type(QXmlStreamReader &xml) const
8✔
494
{
495
    /// \todo Implement Doxml::parseCompound_docSect3Type().
496
    Q_UNUSED(xml)
497
    return {};
8✔
498
}
499

500
QVariantMap Doxml::parseCompound_docSect4Type(QXmlStreamReader &xml) const
8✔
501
{
502
    /// \todo Implement Doxml::parseCompound_docSect4Type().
503
    Q_UNUSED(xml)
504
    return {};
8✔
505
}
506

507
QVariantMap Doxml::parseCompound_docInternalType(QXmlStreamReader &xml) const
8✔
508
{
509
    /// \todo Implement Doxml::parseCompound_docInternalType().
510
    Q_UNUSED(xml)
511
    return {};
8✔
512
}
513

514
QVariantMap Doxml::parseCompound_docInternalS1Type(QXmlStreamReader &xml) const
8✔
515
{
516
    /// \todo Implement Doxml::parseCompound_docInternalS1Type().
517
    Q_UNUSED(xml)
518
    return {};
8✔
519
}
520

521
QVariantMap Doxml::parseCompound_docInternalS2Type(QXmlStreamReader &xml) const
8✔
522
{
523
    /// \todo Implement Doxml::parseCompound_docInternalS2Type().
524
    Q_UNUSED(xml)
525
    return {};
8✔
526
}
527

528
QVariantMap Doxml::parseCompound_docInternalS3Type(QXmlStreamReader &xml) const
8✔
529
{
530
    /// \todo Implement Doxml::parseCompound_docInternalS3Type().
531
    Q_UNUSED(xml)
532
    return {};
8✔
533
}
534

535
QVariantMap Doxml::parseCompound_docInternalS4Type(QXmlStreamReader &xml) const
8✔
536
{
537
    /// \todo Implement Doxml::parseCompound_docInternalS4Type().
538
    Q_UNUSED(xml)
539
    return {};
8✔
540
}
541

542
QVariantMap Doxml::parseCompound_docTitleType(QXmlStreamReader &xml) const
8✔
543
{
544
    /// \todo Implement Doxml::parseCompound_docTitleType().
545
    Q_UNUSED(xml)
546
    return {};
8✔
547
}
548

549
QVariantMap Doxml::parseCompound_docSummaryType(QXmlStreamReader &xml) const
8✔
550
{
551
    /// \todo Implement Doxml::parseCompound_docSummaryType().
552
    Q_UNUSED(xml)
553
    return {};
8✔
554
}
555

556
QVariantMap Doxml::parseCompound_docParaType(QXmlStreamReader &xml) const
8✔
557
{
558
    /// \todo Implement Doxml::parseCompound_docParaType().
559
    Q_UNUSED(xml)
560
    return {};
8✔
561
}
562

563
QVariantMap Doxml::parseCompound_docMarkupType(QXmlStreamReader &xml) const
8✔
564
{
565
    /// \todo Implement Doxml::parseCompound_docMarkupType().
566
    Q_UNUSED(xml)
567
    return {};
8✔
568
}
569

570
QVariantMap Doxml::parseCompound_docURLLink(QXmlStreamReader &xml) const
8✔
571
{
572
    /// \todo Implement Doxml::parseCompound_docURLLink().
573
    Q_UNUSED(xml)
574
    return {};
8✔
575
}
576

577
QVariantMap Doxml::parseCompound_docAnchorType(QXmlStreamReader &xml) const
8✔
578
{
579
    /// \todo Implement Doxml::parseCompound_docAnchorType().
580
    Q_UNUSED(xml)
581
    return {};
8✔
582
}
583

584
QVariantMap Doxml::parseCompound_docFormulaType(QXmlStreamReader &xml) const
8✔
585
{
586
    /// \todo Implement Doxml::parseCompound_docFormulaType().
587
    Q_UNUSED(xml)
588
    return {};
8✔
589
}
590

591
QVariantMap Doxml::parseCompound_docIndexEntryType(QXmlStreamReader &xml) const
8✔
592
{
593
    /// \todo Implement Doxml::parseCompound_docIndexEntryType().
594
    Q_UNUSED(xml)
595
    return {};
8✔
596
}
597

598
QVariantMap Doxml::parseCompound_docListType(QXmlStreamReader &xml) const
8✔
599
{
600
    /// \todo Implement Doxml::parseCompound_docListType().
601
    Q_UNUSED(xml)
602
    return {};
8✔
603
}
604

605
QVariantMap Doxml::parseCompound_docListItemType(QXmlStreamReader &xml) const
8✔
606
{
607
    /// \todo Implement Doxml::parseCompound_docListItemType().
608
    Q_UNUSED(xml)
609
    return {};
8✔
610
}
611

612
QVariantMap Doxml::parseCompound_docSimpleSectType(QXmlStreamReader &xml) const
8✔
613
{
614
    /// \todo Implement Doxml::parseCompound_docSimpleSectType().
615
    Q_UNUSED(xml)
616
    return {};
8✔
617
}
618

619
QVariantMap Doxml::parseCompound_docVarListEntryType(QXmlStreamReader &xml) const
8✔
620
{
621
    /// \todo Implement Doxml::parseCompound_docVarListEntryType().
622
    Q_UNUSED(xml)
623
    return {};
8✔
624
}
625

626
QVariantMap Doxml::parseCompound_docVariableListType(QXmlStreamReader &xml) const
8✔
627
{
628
    /// \todo Implement Doxml::parseCompound_docVariableListType().
629
    Q_UNUSED(xml)
630
    return {};
8✔
631
}
632

633
QVariantMap Doxml::parseCompound_docRefTextType(QXmlStreamReader &xml) const
8✔
634
{
635
    /// \todo Implement Doxml::parseCompound_docRefTextType().
636
    Q_UNUSED(xml)
637
    return {};
8✔
638
}
639

640
QVariantMap Doxml::parseCompound_docTableType(QXmlStreamReader &xml) const
8✔
641
{
642
    /// \todo Implement Doxml::parseCompound_docTableType().
643
    Q_UNUSED(xml)
644
    return {};
8✔
645
}
646

647
QVariantMap Doxml::parseCompound_docRowType(QXmlStreamReader &xml) const
8✔
648
{
649
    /// \todo Implement Doxml::parseCompound_docRowType().
650
    Q_UNUSED(xml)
651
    return {};
8✔
652
}
653

654
QVariantMap Doxml::parseCompound_docEntryType(QXmlStreamReader &xml) const
8✔
655
{
656
    /// \todo Implement Doxml::parseCompound_docEntryType().
657
    Q_UNUSED(xml)
658
    return {};
8✔
659
}
660

661
QVariantMap Doxml::parseCompound_docCaptionType(QXmlStreamReader &xml) const
8✔
662
{
663
    /// \todo Implement Doxml::parseCompound_docCaptionType().
664
    Q_UNUSED(xml)
665
    return {};
8✔
666
}
667

668
QVariantMap Doxml::parseCompound_docHeadingType(QXmlStreamReader &xml) const
8✔
669
{
670
    /// \todo Implement Doxml::parseCompound_docHeadingType().
671
    Q_UNUSED(xml)
672
    return {};
8✔
673
}
674

675
QVariantMap Doxml::parseCompound_docImageType(QXmlStreamReader &xml) const
8✔
676
{
677
    /// \todo Implement Doxml::parseCompound_docImageType().
678
    Q_UNUSED(xml)
679
    return {};
8✔
680
}
681

682
QVariantMap Doxml::parseCompound_docDotMscType(QXmlStreamReader &xml) const
8✔
683
{
684
    /// \todo Implement Doxml::parseCompound_docDotMscType().
685
    Q_UNUSED(xml)
686
    return {};
8✔
687
}
688

689
QVariantMap Doxml::parseCompound_docImageFileType(QXmlStreamReader &xml) const
8✔
690
{
691
    /// \todo Implement Doxml::parseCompound_docImageFileType().
692
    Q_UNUSED(xml)
693
    return {};
8✔
694
}
695

696
QVariantMap Doxml::parseCompound_docPlantumlType(QXmlStreamReader &xml) const
8✔
697
{
698
    /// \todo Implement Doxml::parseCompound_docPlantumlType().
699
    Q_UNUSED(xml)
700
    return {};
8✔
701
}
702

703
QVariantMap Doxml::parseCompound_docTocItemType(QXmlStreamReader &xml) const
8✔
704
{
705
    /// \todo Implement Doxml::parseCompound_docTocItemType().
706
    Q_UNUSED(xml)
707
    return {};
8✔
708
}
709

710
QVariantMap Doxml::parseCompound_docTocListType(QXmlStreamReader &xml) const
8✔
711
{
712
    /// \todo Implement Doxml::parseCompound_docTocListType().
713
    Q_UNUSED(xml)
714
    return {};
8✔
715
}
716

717
QVariantMap Doxml::parseCompound_docLanguageType(QXmlStreamReader &xml) const
8✔
718
{
719
    /// \todo Implement Doxml::parseCompound_docLanguageType().
720
    Q_UNUSED(xml)
721
    return {};
8✔
722
}
723

724
QVariantMap Doxml::parseCompound_docParamListType(QXmlStreamReader &xml) const
8✔
725
{
726
    /// \todo Implement Doxml::parseCompound_docParamListType().
727
    Q_UNUSED(xml)
728
    return {};
8✔
729
}
730

731
QVariantMap Doxml::parseCompound_docParamListItem(QXmlStreamReader &xml) const
8✔
732
{
733
    /// \todo Implement Doxml::parseCompound_docParamListItem().
734
    Q_UNUSED(xml)
735
    return {};
8✔
736
}
737

738
QVariantMap Doxml::parseCompound_docParamNameList(QXmlStreamReader &xml) const
8✔
739
{
740
    /// \todo Implement Doxml::parseCompound_docParamNameList().
741
    Q_UNUSED(xml)
742
    return {};
8✔
743
}
744

745
QVariantMap Doxml::parseCompound_docParamType(QXmlStreamReader &xml) const
8✔
746
{
747
    /// \todo Implement Doxml::parseCompound_docParamType().
748
    Q_UNUSED(xml)
749
    return {};
8✔
750
}
751

752
QVariantMap Doxml::parseCompound_docParamName(QXmlStreamReader &xml) const
8✔
753
{
754
    /// \todo Implement Doxml::parseCompound_docParamName().
755
    Q_UNUSED(xml)
756
    return {};
8✔
757
}
758

759
QVariantMap Doxml::parseCompound_docXRefSectType(QXmlStreamReader &xml) const
8✔
760
{
761
    /// \todo Implement Doxml::parseCompound_docXRefSectType().
762
    Q_UNUSED(xml)
763
    return {};
8✔
764
}
765

766
QVariantMap Doxml::parseCompound_docCopyType(QXmlStreamReader &xml) const
8✔
767
{
768
    /// \todo Implement Doxml::parseCompound_docCopyType().
769
    Q_UNUSED(xml)
770
    return {};
8✔
771
}
772

773
QVariantMap Doxml::parseCompound_docDetailsType(QXmlStreamReader &xml) const
8✔
774
{
775
    /// \todo Implement Doxml::parseCompound_docDetailsType().
776
    Q_UNUSED(xml)
777
    return {};
8✔
778
}
779

780
QVariantMap Doxml::parseCompound_docBlockQuoteType(QXmlStreamReader &xml) const
8✔
781
{
782
    /// \todo Implement Doxml::parseCompound_docBlockQuoteType().
783
    Q_UNUSED(xml)
784
    return {};
8✔
785
}
786

787
QVariantMap Doxml::parseCompound_docParBlockType(QXmlStreamReader &xml) const
8✔
788
{
789
    /// \todo Implement Doxml::parseCompound_docParBlockType().
790
    Q_UNUSED(xml)
791
    return {};
8✔
792
}
793

794
QVariantMap Doxml::parseCompound_docEmptyType(QXmlStreamReader &xml) const
8✔
795
{
796
    /// \todo Implement Doxml::parseCompound_docEmptyType().
797
    Q_UNUSED(xml)
798
    return {};
8✔
799
}
800

801
QVariantMap Doxml::parseCompound_tableofcontentsType(QXmlStreamReader &xml) const
8✔
802
{
803
    /// \todo Implement Doxml::parseCompound_tableofcontentsType().
804
    Q_UNUSED(xml)
805
    return {};
8✔
806
}
807

808
QVariantMap Doxml::parseCompound_tableofcontentsKindType(QXmlStreamReader &xml) const
8✔
809
{
810
    /// \todo Implement Doxml::parseCompound_tableofcontentsKindType().
811
    Q_UNUSED(xml)
812
    return {};
8✔
813
}
814

815
QVariantMap Doxml::parseCompound_docEmojiType(QXmlStreamReader &xml) const
8✔
816
{
817
    /// \todo Implement Doxml::parseCompound_docEmojiType().
818
    Q_UNUSED(xml)
819
    return {};
8✔
820
}
821

822
QVariantMap Doxml::parseDoxyfile(QXmlStreamReader &xml) const
8✔
823
{
824
    if (!xml.readNextStartElement()) {
8✔
825
        /// \todo Better standardise these warnings / errors.
NEW
826
        qCWarning(lc).noquote() << QTR("Invalid XML file: %1 - %2").arg(location(xml), xml.errorString());
×
827
        return { };
828
    }
829
    if (xml.name() != QSL("doxyfile")) {
10✔
NEW
830
        xml.raiseError(QTR("Root element is not \"doxyfile\""));
×
831
        return { };
832
    }
833
    return parseDoxyfile_DoxygenFileType(xml);
8✔
834
}
835

836
QVariantMap Doxml::parseDoxyfile_DoxygenFileType(QXmlStreamReader &xml) const
16✔
837
{
838
    Q_ASSERT(xml.name() == QSL("doxyfile"));
839

840
    // Fetch the XML attributes.
841
    QVariantMap map;
12✔
842
    map.insert(QSL("version"), xml.attributes().value(QSL("version")).toString());
40✔
843
    map.insert(QSL("language"), xml.attributes().value(QSL("xml:lang")).toString());
40✔
844

845
    // Parse the <option> elements.
846
    QVariantMap options;
12✔
847
    while ((!xml.atEnd()) && (xml.readNextStartElement())) {
112✔
848
        if (xml.name() == QSL("option")) {
192✔
849
            options.insert(parseDoxyfile_OptionType(xml));
168✔
850
        } else {
NEW
851
            qCWarning(lc).noquote() << QTR("Skipping unknown <%1> element at %2:%3:%4")
×
NEW
852
                                           .arg(xml.name().toString(), location(xml));
×
NEW
853
            xml.skipCurrentElement();
×
854
        }
855
    }
856
    qCDebug(lc).noquote() << QTR("Parsed %1 options(s) from %2").arg(options.size()).arg(currentXmlFilePath);
20✔
857
    map.insert(QSL("options"), options);
28✔
858
    return map;
16✔
859
}
4✔
860

861
QVariantMap Doxml::parseDoxyfile_OptionType(QXmlStreamReader &xml) const
144✔
862
{
863
    Q_ASSERT(xml.name() == QSL("option"));
864
    const auto attributes = xml.attributes();
144✔
865
    const auto id = attributes.value(QSL("id"));
180✔
866
    const auto type = attributes.value(QSL("type"));
270✔
867
    if (type == QSL("int")) {
144✔
868
        return { { id.toString(), xml.readElementText(QXmlStreamReader::IncludeChildElements).toInt() } };
72✔
869
    } else if (type == QSL("bool")) {
120✔
870
        return { { id.toString(), xml.readElementText(QXmlStreamReader::IncludeChildElements) == QSL("YES") } };
108✔
871
    } else if (type == QSL("string")) {
72✔
872
        return { { id.toString(), xml.readElementText(QXmlStreamReader::IncludeChildElements) } };
60✔
873
    } else if (type == QSL("stringlist")) {
48✔
874
        QStringList values;
36✔
875
        while ((!xml.atEnd()) && (xml.readNextStartElement())) {
96✔
876
            if (xml.name() == QSL("value")) {
96✔
877
                values.append(xml.readElementText());
84✔
878
            } else {
NEW
879
                qCWarning(lc).noquote() << QTR("Skipping unknown <%1> element at %2:%3:%4")
×
NEW
880
                                               .arg(xml.name().toString(), location(xml));
×
NEW
881
                xml.skipCurrentElement();
×
882
            }
883
        }
884
        return { { id.toString(), values } };
108✔
885
    }
NEW
886
    qCWarning(lc).noquote() << QTR("Treating option of unknwn type as string");
×
NEW
887
    return { { id.toString(), xml.readElementText(QXmlStreamReader::IncludeChildElements) } };
×
888
}
889

890
QVariantMap Doxml::parseIndex(QXmlStreamReader &xml) const
8✔
891
{
892
    /// \todo Implement Doxml::parseIndex().
893
    Q_UNUSED(xml)
894
    return {};
8✔
895
}
896

897
QVariantMap Doxml::parseIndex_DoxygenType(QXmlStreamReader &xml) const
8✔
898
{
899
    /// \todo Implement Doxml::parseIndex_DoxygenType().
900
    Q_UNUSED(xml)
901
    return {};
8✔
902
}
903

904
QVariantMap Doxml::parseIndex_CompoundType(QXmlStreamReader &xml) const
8✔
905
{
906
    /// \todo Implement Doxml::parseIndex_CompoundType().
907
    Q_UNUSED(xml)
908
    return {};
8✔
909
}
910

911
QVariantMap Doxml::parseIndex_MemberType(QXmlStreamReader &xml) const
8✔
912
{
913
    /// \todo Implement Doxml::parseIndex_MemberType().
914
    Q_UNUSED(xml)
915
    return {};
8✔
916
}
917

918
} // namespace doxlee
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc