Attica

categoryparser.cpp
1/*
2 This file is part of KDE.
3
4 SPDX-FileCopyrightText: 2008 Cornelius Schumacher <schumacher@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#include "categoryparser.h"
10
11using namespace Attica;
12
13Category Category::Parser::parseXml(QXmlStreamReader &xml)
14{
16
17 while (!xml.atEnd()) {
18 xml.readNext();
19
20 if (xml.isStartElement()) {
21 if (xml.name() == QLatin1String("id")) {
22 category.setId(xml.readElementText());
23 } else if (xml.name() == QLatin1String("name")) {
24 category.setName(xml.readElementText());
25 } else if (xml.name() == QLatin1String("display_name")) {
26 category.setDisplayName(xml.readElementText());
27 }
28 } else if (xml.isEndElement() && xml.name() == QLatin1String("category")) {
29 break;
30 }
31 }
32
33 return category;
34}
35
36QStringList Category::Parser::xmlElement() const
37{
38 return QStringList(QStringLiteral("category"));
39}
Represents a single content category.
Definition category.h:24
The Attica namespace,.
Category category(StandardShortcut id)
bool atEnd() const const
bool isEndElement() const const
bool isStartElement() const const
QStringView name() const const
QString readElementText(ReadElementTextBehaviour behaviour)
TokenType readNext()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:04:50 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.