Attica

distributionparser.cpp
1/*
2 This file is part of KDE.
3
4 SPDX-FileCopyrightText: 2010 Intel Corporation
5 SPDX-FileContributor: Mateu Batle Sastre <mbatle@collabora.co.uk>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
8*/
9
10#include "distributionparser.h"
11
12using namespace Attica;
13
14QStringList Distribution::Parser::xmlElement() const
15{
16 return QStringList(QStringLiteral("distribution"));
17}
18
19Distribution Distribution::Parser::parseXml(QXmlStreamReader &xml)
20{
21 Distribution item;
22
23 while (!xml.atEnd()) {
24 xml.readNext();
25 if (xml.isStartElement()) {
26 if (xml.name() == QLatin1String("id")) {
27 item.setId(xml.readElementText().toInt());
28 } else if (xml.name() == QLatin1String("name")) {
29 item.setName(xml.readElementText());
30 }
31 }
32 if (xml.isEndElement() && xml.name() == QLatin1String("distribution")) {
33 break;
34 }
35 }
36 return item;
37}
The Distribution class contains information about one distribution that the server offers.
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 Tue Mar 26 2024 11:19:48 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.