Attica

privatedataparser.cpp
1 /*
2  This file is part of KDE.
3 
4  SPDX-FileCopyrightText: 2008 Cornelius Schumacher <[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 "privatedataparser.h"
10 
11 using namespace Attica;
12 
13 PrivateData PrivateData::Parser::parseXml(QXmlStreamReader &xml)
14 {
15  PrivateData data;
16  QString key;
17 
18  // TODO: when we get internet and some documentation
19  while (!xml.atEnd()) {
20  xml.readNext();
21 
22  if (xml.isStartElement()) {
23  if (xml.name() == QLatin1String("key")) {
24  key = xml.readElementText();
25  } else if (xml.name() == QLatin1String("value")) {
26  data.setAttribute(key, xml.readElementText());
27  } else if (xml.name() == QLatin1String("timestamp")) {
29  }
30  } else if (xml.isEndElement() && (xml.name() == QLatin1String("data") || xml.name() == QLatin1String("user"))) {
31  break;
32  }
33  }
34 
35  return data;
36 }
37 
38 QStringList PrivateData::Parser::xmlElement() const
39 {
40  return QStringList(QStringLiteral("privatedata"));
41 }
void setTimestamp(const QString &key, const QDateTime &when)
Sets when an attribute last was changed (mostly for internal use).
Definition: privatedata.cpp:70
bool isEndElement() const const
QStringRef name() const const
void setAttribute(const QString &key, const QString &value)
Sets an attribute referenced by \key to \value.
Definition: privatedata.cpp:49
QXmlStreamReader::TokenType readNext()
QString readElementText(QXmlStreamReader::ReadElementTextBehaviour behaviour)
QDateTime fromString(const QString &string, Qt::DateFormat format)
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 Mon Dec 11 2023 04:05:13 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.