Marble

TemplateDocument.h
1// SPDX-FileCopyrightText: 2012 Illya Kovalevskyy <illya.kovalevskyy@gmail.com>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef MARBLE_TEMPLATEDOCUMENT_H
6#define MARBLE_TEMPLATEDOCUMENT_H
7
8#include <QtGlobal>
9
10class QString;
11
12namespace Marble
13{
14
15class TemplateDocumentPrivate;
16
17/**
18 * @brief The Template Document
19 *
20 * The class represents a template engine for
21 * Marble HTML/plain text. It allows to template big
22 * documents with variables like %variable_name% or
23 * to make includes like %!{include_name}%
24 *
25 * "Include" is a special type of template variables which
26 * allows to include extra already templated text into the
27 * template. E.g. %!{bootstrap}% will include bootstrap CSS
28 * files into html file, where this include is called
29 *
30 * @see TemplateDocument()
31 *
32 */
34{
35public:
37 explicit TemplateDocument(const QString &templateText);
39
40 /**
41 * @brief Returns the current template value of @p key
42 * @param key template key (<here>)
43 * @return value of the template
44 */
45 QString value(const QString &key) const;
46
47 /**
48 * @brief Change set template value into new one
49 * @param key template key
50 * @param value template value
51 */
52 void setValue(const QString &key, const QString &value);
53
54 /**
55 * @brief Set template text
56 * @param newTemplateText new template text
57 */
58 void setTemplate(const QString &newTemplateText);
59
60 /**
61 * @brief Indexator for template values
62 * @param key template value's index
63 * @return reference for the item
64 */
65 QString &operator[](const QString &key);
66
67 /**
68 * @brief Final proceed text
69 *
70 * @return ready text with all variables and includes processed
71 */
72 QString finalText() const;
73
74private:
75 Q_DISABLE_COPY(TemplateDocument)
76 TemplateDocumentPrivate *const d;
77};
78
79} // namespace Marble
80
81#endif // MARBLE_TEMPLATEDOCUMENT_H
The Template Document.
void setTemplate(const QString &newTemplateText)
Set template text.
QString & operator[](const QString &key)
Indexator for template values.
void setValue(const QString &key, const QString &value)
Change set template value into new one.
QString finalText() const
Final proceed text.
QString value(const QString &key) const
Returns the current template value of key.
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:02:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.