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 atEnd() const const
The HomePageType class contains information about one home page type.
Definition: homepagetype.h:24
QString readElementText(QXmlStreamReader::ReadElementTextBehaviour behaviour)
int toInt(bool *ok, int base) const const
QXmlStreamReader::TokenType readNext()
bool isStartElement() const const
QStringRef name() const const
bool isEndElement() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 23:06:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.