File indexing completed on 2023-10-03 07:01:57
0001 /* 0002 This file is part of KDE. 0003 0004 SPDX-FileCopyrightText: 2018 Ralf Habacker <ralf.habacker@freenet.de> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #include "configparser.h" 0010 0011 using namespace Attica; 0012 0013 Config Config::Parser::parseXml(QXmlStreamReader &xml) 0014 { 0015 Config config; 0016 0017 while (!xml.atEnd()) { 0018 xml.readNext(); 0019 0020 if (xml.isStartElement()) { 0021 if (xml.name() == QLatin1String("version")) { 0022 config.setVersion(xml.readElementText()); 0023 } else if (xml.name() == QLatin1String("website")) { 0024 config.setWebsite(xml.readElementText()); 0025 } else if (xml.name() == QLatin1String("host")) { 0026 config.setHost(xml.readElementText()); 0027 } else if (xml.name() == QLatin1String("contact")) { 0028 config.setContact(xml.readElementText()); 0029 } else if (xml.name() == QLatin1String("ssl")) { 0030 config.setSsl(xml.readElementText() == QLatin1String("true")); 0031 } 0032 } 0033 0034 if (xml.isEndElement() && xml.name() == QLatin1String("data")) { 0035 break; 0036 } 0037 } 0038 0039 return config; 0040 } 0041 0042 QStringList Config::Parser::xmlElement() const 0043 { 0044 return QStringList(QStringLiteral("data")); 0045 }