Attica

licenseparser.cpp
1 /*
2  SPDX-FileCopyrightText: 2010 Frederik Gladhorn <[email protected]>
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 
9 using namespace Attica;
10 
11 QStringList License::Parser::xmlElement() const
12 {
13  return QStringList(QStringLiteral("license"));
14 }
15 
16 License 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 }
bool isEndElement() const const
QStringRef name() const const
QXmlStreamReader::TokenType readNext()
int toInt(bool *ok, int base) const const
QString readElementText(QXmlStreamReader::ReadElementTextBehaviour behaviour)
The Attica namespace,.
bool isStartElement() const const
bool atEnd() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Dec 11 2023 04:05:13 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.