KTextTemplate

filter.cpp
1/*
2 This file is part of the KTextTemplate library
3
4 SPDX-FileCopyrightText: 2009, 2010 Stephen Kelly <steveire@gmail.com>
5
6 SPDX-License-Identifier: LGPL-2.1-or-later
7
8*/
9
10#include "filter.h"
11
12using namespace KTextTemplate;
13
14Filter::~Filter() = default;
15
16void Filter::setStream(KTextTemplate::OutputStream *stream)
17{
18 m_stream = stream;
19}
20
21SafeString Filter::escape(const QString &input) const
22{
23 return m_stream->escape(input);
24}
25
26SafeString Filter::escape(const SafeString &input) const
27{
28 if (input.isSafe())
29 return {m_stream->escape(input), SafeString::IsSafe};
30 return m_stream->escape(input);
31}
32
33SafeString Filter::conditionalEscape(const SafeString &input) const
34{
35 if (!input.isSafe())
36 return m_stream->escape(input);
37 return input;
38}
39
40bool Filter::isSafe() const
41{
42 return false;
43}
The OutputStream class is used to render templates to a QTextStream.
A QString wrapper class for containing whether a string is safe or needs to be escaped.
Definition safestring.h:81
bool isSafe() const
Whether the string is safe.
@ IsSafe
The string is safe and requires no further escaping.
Definition safestring.h:87
The KTextTemplate namespace holds all public KTextTemplate API.
Definition Mainpage.dox:8
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:12:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.