Attica

licenseparser.cpp
1/*
2 SPDX-FileCopyrightText: 2010 Frederik Gladhorn <gladhorn@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#include "licenseparser.h"
8
9using namespace Attica;
10
11QStringList License::Parser::xmlElement() const
12{
13 return QStringList(QStringLiteral("license"));
14}
15
16License License::Parser::parseXml(QXmlStreamReader &xml)
17{
18 License item;
19
20 while (!xml.atEnd()) {
21 xml.readNext();
22 if (xml.isStartElement()) {
23 if (xml.name() == QLatin1String("id")) {
24 item.setId(xml.readElementText().toInt());
25 } else if (xml.name() == QLatin1String("name")) {
26 item.setName(xml.readElementText());
27 } else if (xml.name() == QLatin1String("link")) {
28 item.setUrl(QUrl(xml.readElementText()));
29 }
30 }
31 if (xml.isEndElement() && xml.name() == QLatin1String("license")) {
32 break;
33 }
34 }
35 return item;
36}
The License class contains information about one license that the server offers.
Definition license.h:24
The Attica namespace,.
int toInt(bool *ok, int base) const const
bool atEnd() const const
bool isEndElement() const const
bool isStartElement() const const
QStringView name() const const
QString readElementText(ReadElementTextBehaviour behaviour)
TokenType readNext()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:36 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.