Cutelee
6.1.0
templates
lib
context.h
1
/*
2
This file is part of the Cutelee template system.
3
4
Copyright (c) 2009,2010 Stephen Kelly <steveire@gmail.com>
5
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either version
9
2.1 of the Licence, or (at your option) any later version.
10
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Lesser General Public License for more details.
15
16
You should have received a copy of the GNU Lesser General Public
17
License along with this library. If not, see <http://www.gnu.org/licenses/>.
18
19
*/
20
21
#ifndef CUTELEE_CONTEXT_H
22
#define CUTELEE_CONTEXT_H
23
24
#include "abstractlocalizer.h"
25
#include "cutelee_templates_export.h"
26
27
#include <memory>
28
#include <QtCore/QVariantHash>
29
30
namespace
Cutelee
31
{
32
33
class
RenderContext;
34
35
class
ContextPrivate;
36
38
118
class
CUTELEE_TEMPLATES_EXPORT
Context
119
{
120
public
:
124
Context
();
129
explicit
Context
(
const
QVariantHash &hash);
130
134
Context
(
const
Context
&other);
135
139
Context
&operator=(
const
Context
&other);
140
141
#ifndef Q_QDOC
148
bool
autoEscape()
const
;
149
156
void
setAutoEscape(
bool
autoescape);
157
#endif
161
virtual
~
Context
();
162
166
virtual
QVariant
lookup(
const
QString
&str)
const
;
167
172
void
insert(
const
QString
&name, QObject *
object
);
173
178
void
insert(
const
QString
&name,
const
QVariant
&variant);
179
184
void
push();
185
190
void
pop();
191
192
#ifndef Q_QDOC
196
QVariantHash stackHash(
int
depth)
const
;
197
202
bool
isMutating()
const
;
203
208
void
setMutating(
bool
mutating);
209
213
void
addExternalMedia(
const
QString
&absolutePart,
214
const
QString
&relativePart);
215
219
void
clearExternalMedia();
220
#endif
221
227
void
setLocalizer(std::shared_ptr<AbstractLocalizer> localizer);
228
232
std::shared_ptr<AbstractLocalizer> localizer()
const
;
233
237
QList<std::pair<QString, QString>> externalMedia()
const
;
238
242
enum
UrlType
{
243
AbsoluteUrls
,
244
RelativeUrls
245
};
246
251
void
setUrlType(UrlType type);
252
256
UrlType urlType()
const
;
257
264
void
setRelativeMediaPath(
const
QString
&relativePath);
265
269
QString
relativeMediaPath()
const
;
270
276
RenderContext
*renderContext()
const
;
277
278
private
:
279
Q_DECLARE_PRIVATE(
Context
)
280
ContextPrivate
*
const
d_ptr;
281
};
282
}
283
284
#endif
Cutelee::ContextPrivate
Definition:
context.cpp:35
Cutelee::Context
The Context class holds the context to render a Template with.
Definition:
context.h:119
Cutelee::Context::UrlType
UrlType
Definition:
context.h:242
Cutelee::Context::AbsoluteUrls
@ AbsoluteUrls
Absolute URLs should be put in the template.
Definition:
context.h:243
Cutelee::RenderContext
Provides storage facility for state while rendering a template.
Definition:
rendercontext.h:47
QString
Definition:
operatorcasttests.cpp:24
QVariant
Definition:
operatorcasttests.cpp:31
Cutelee
The Cutelee namespace holds all public Cutelee API.
Definition:
Mainpage.dox:8
Generated by
1.9.1