Attica

accountbalanceparser.cpp
1 /*
2  This file is part of KDE.
3 
4  SPDX-FileCopyrightText: 2009 Frederik Gladhorn <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8 
9 #include "accountbalanceparser.h"
10 
11 #include <QXmlStreamReader>
12 
13 using namespace Attica;
14 
15 QStringList AccountBalance::Parser::xmlElement() const
16 {
17  return QStringList(QStringLiteral("person"));
18 }
19 
20 AccountBalance AccountBalance::Parser::parseXml(QXmlStreamReader &xml)
21 {
22  AccountBalance item;
23 
24  while (!xml.atEnd()) {
25  xml.readNext();
26  if (xml.isStartElement()) {
27  if (xml.name() == QLatin1String("balance")) {
28  item.setBalance(xml.readElementText());
29  }
30  else if (xml.name() == QLatin1String("currency")) {
31  item.setCurrency(xml.readElementText());
32  }
33  }
34  }
35  return item;
36 }
bool atEnd() const const
void setBalance(const QString &name)
Sets the balance.
void setCurrency(const QString &currency)
Sets the currency in use.
QString readElementText(QXmlStreamReader::ReadElementTextBehaviour behaviour)
QXmlStreamReader::TokenType readNext()
bool isStartElement() const const
QStringRef name() const const
Represents the money in the account of the user.
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.