Attica

homepagetypeparser.cpp
1 /*
2  This file is part of KDE.
3 
4  SPDX-FileCopyrightText: 2010 Intel Corporation
5  SPDX-FileContributor: Mateu Batle Sastre <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
8 */
9 
10 #include "homepagetypeparser.h"
11 
12 using namespace Attica;
13 
14 QStringList HomePageType::Parser::xmlElement() const
15 {
16  return QStringList(QStringLiteral("homepagetype"));
17 }
18 
19 HomePageType HomePageType::Parser::parseXml(QXmlStreamReader &xml)
20 {
21  HomePageType 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("homepagetype")) {
33  break;
34  }
35  }
36  return item;
37 }
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 Sun Dec 3 2023 04:08:16 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.