KOSMIndoorMap

mapcssparser.h
1/*
2 SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KOSMINDOORMAP_MAPCSSPARSER_H
8#define KOSMINDOORMAP_MAPCSSPARSER_H
9
10#include "kosmindoormap_export.h"
11
12#include <memory>
13
14class QString;
15class QUrl;
16
17namespace KOSMIndoorMap {
18
19class MapCSSParserPrivate;
20class MapCSSStyle;
21class MapCSSRule;
22
23/** MapCSS parser. */
24class KOSMINDOORMAP_EXPORT MapCSSParser
25{
26public:
27 explicit MapCSSParser();
29
30 [[nodiscard]] MapCSSStyle parse(const QString &fileName);
31 /** Parse MapCSS style sheet at @p url.
32 * This can be a local file, qrc resource or a HTTP URL.
33 * @note Attempting to parse a HTTP URL that isn't already downloaded will fail
34 * with FileNotFoundError. When using remote MapCSS files, don't use this directly
35 * but use MapCSSLoader which will handle necesary downloads itself.
36 * @see MapCSSLoader.
37 */
38 [[nodiscard]] MapCSSStyle parse(const QUrl &url);
39
40 /** Returns @c true if an error occured during parsing and the returned style
41 * is invalid.
42 */
43 [[nodiscard]] bool hasError() const;
44
45 enum Error {
46 NoError,
47 SyntaxError,
48 FileNotFoundError,
49 FileIOError,
50 NetworkError,
51 };
52 [[nodiscard]] Error error() const;
53
54 /** URL of the parsed MapCSS style sheet.
55 * This can be a local file, QRC asset or HTTP remote content.
56 */
57 [[nodiscard]] QUrl url() const;
58 [[nodiscard]] QString errorMessage() const;
59
60private:
61 friend class MapCSSParserPrivate;
62 std::unique_ptr<MapCSSParserPrivate> d;
63};
64
65}
66
67#endif // KOSMINDOORMAP_MAPCSSPARSER_H
A parsed MapCSS style sheet.
Definition mapcssstyle.h:33
OSM-based multi-floor indoor maps for buildings.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:06:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.