Attica

publisherfieldparser.cpp
1 /*
2  This file is part of KDE.
3 
4  SPDX-FileCopyrightText: 2011 Dan Leinir Turthra Jensen <[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 "publisherfieldparser.h"
10 
11 using namespace Attica;
12 
13 PublisherField PublisherField::Parser::parseXml(QXmlStreamReader &xml)
14 {
15  PublisherField fld;
16  while (!xml.atEnd()) {
18  if (xml.isStartElement()) {
19  if (xml.name() == QLatin1String("fieldtype")) {
20  fld.setType(xml.readElementText());
21  } else if (xml.name() == QLatin1String("name")) {
22  fld.setName(xml.readElementText());
23  } else if (xml.name() == QLatin1String("data")) {
24  fld.setData(xml.readElementText());
25  }
26  } else if (xml.isEndElement() && (xml.name() == QLatin1String("field"))) {
27  xml.readNext();
28  break;
29  }
30  }
31  return fld;
32 }
33 
34 QStringList PublisherField::Parser::xmlElement() const
35 {
36  return QStringList(QStringLiteral("field"));
37 }
bool readNextStartElement()
bool isEndElement() const const
QStringRef name() const const
QXmlStreamReader::TokenType readNext()
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.