KTextTemplate::Filter Class
class KTextTemplate::FilterBase class for all filters. More...
Header: | #include <KTextTemplate/Filter> |
CMake: | find_package(KF6 REQUIRED COMPONENTS TextTemplate) target_link_libraries(mytarget PRIVATE KF6::TextTemplate) |
Public Functions
KTextTemplate::SafeString | conditionalEscape(const KTextTemplate::SafeString &input) const |
virtual QVariant | doFilter(const QVariant &input, const QVariant &argument = {}, bool autoescape = {}) const = 0 |
KTextTemplate::SafeString | escape(const KTextTemplate::SafeString &input) const |
KTextTemplate::SafeString | escape(const QString &input) const |
virtual bool | isSafe() const |
void | setStream(KTextTemplate::OutputStream *stream) |
Detailed Description
The Filter class can be implemented in plugin libraries to make additional functionality available to templates.
Developers are required only to implement the doFilter method and integrate the filter as part of a custom plugin, but will never create or access filters directly in application code.
The FilterExpression class is the access interface to a chain of Filter objects.
The escape and conditionalEscape methods are available for escaping data where needed.
Member Function Documentation
KTextTemplate::SafeString Filter::conditionalEscape(const KTextTemplate::SafeString &input) const
Escapes input if not already safe from further escaping and returns it. The OutputStream::escape method is used to escape input.
[pure virtual]
QVariant Filter::doFilter(const QVariant &input, const QVariant &argument = {}, bool autoescape = {}) const
Reimplement to filter input given argument.
autoescape determines whether the autoescape feature is currently on or off. Most filters will not use this.
KTextTemplate::SafeString Filter::escape(const KTextTemplate::SafeString &input) const
Escapes and returns input. The OutputStream::escape method is used to escape input.
KTextTemplate::SafeString Filter::escape(const QString &input) const
Escapes and returns input. The OutputStream::escape method is used to escape input.
[virtual]
bool Filter::isSafe() const
Reimplement to return whether this filter is safe.
void Filter::setStream(KTextTemplate::OutputStream *stream)
FilterExpression makes it possible to access stream methods like escape while resolving.