edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
baseplistparser.h
Go to the documentation of this file.
1// edbee - Copyright (c) 2012-2025 by Rick Blommers and contributors
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "edbee/exports.h"
7
8#include <QHash>
9#include <QStack>
10#include <QString>
11#include <QVariant>
12
13class QIODevice;
14class QXmlStreamReader;
15
16namespace edbee {
17
20public:
22 virtual ~BasePListParser();
23
24 QString lastErrorMessage() const;
25
26 void setLastErrorMessage( const QString& str );
27
28 bool beginParsing( QIODevice* device );
29 bool endParsing();
30
31 void raiseError( const QString& str );
32
33 // general plist parsing
34 QList<QVariant> readList();
35 QHash<QString, QVariant> readDict();
36 QVariant readNextPlistType(int level=-1);
37
38 bool readNextElement( const QString& name, int level=-1 );
39 QString readElementText();
40
42
43private:
44
45 QString lastErrorMessage_;
46 QStack<QString> elementStack_;
47 QXmlStreamReader* xml_;
48
49};
50
51} // edbee
int currentStackLevel()
returns the current stack-level
Definition baseplistparser.cpp:178
bool endParsing()
Closes the parsers.
Definition baseplistparser.cpp:61
void setLastErrorMessage(const QString &str)
Sets the last error message. To correctly set the last error message while parsing please use raiseEr...
Definition baseplistparser.cpp:36
bool readNextElement(const QString &name, int level=-1)
Reads the next element and optionally expects it to be the given name.
Definition baseplistparser.cpp:135
QList< QVariant > readList()
reads a list of qvariants
Definition baseplistparser.cpp:84
BasePListParser()
The constructor for the parser.
Definition baseplistparser.cpp:14
QVariant readNextPlistType(int level=-1)
reads the next plist type
Definition baseplistparser.cpp:112
QHash< QString, QVariant > readDict()
reads a dictionary
Definition baseplistparser.cpp:97
bool beginParsing(QIODevice *device)
Start the parsing of the plist. If it isn't a valid plist this method return false....
Definition baseplistparser.cpp:44
QString lastErrorMessage() const
Returns the last error message of the parsed file.
Definition baseplistparser.cpp:28
QString readElementText()
Reads the element text contents.
Definition baseplistparser.cpp:169
void raiseError(const QString &str)
Call this method to raise an error and stop the xml parsing.
Definition baseplistparser.cpp:77
#define EDBEE_EXPORT
Definition exports.h:15
QT Acessibility has an issue with reporting blank lines between elements lines. defining 'WINDOWS_EMP...
Definition commentcommand.cpp:20