Grantlee: Grantlee::Filter Class Reference

Grantlee 5.3.0

Public Member Functions | List of all members
Grantlee::Filter Class Referenceabstract

Base class for all filters. More...

`#include <grantlee/filter.h>`

## Public Member Functions
virtual | ~Filter ()
SafeString | conditionalEscape (const SafeString &input) const
virtual QVariant | doFilter (const QVariant &input, const QVariant &argument={}, bool autoescape={}) const =0
SafeString | escape (const QString &input) const
SafeString | escape (const SafeString &input) const
virtual bool | isSafe () const

## 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.

See also
  Filters

Author
  Stephen Kelly steve.nosp@m.ire@.nosp@m.gmail.nosp@m..com

Definition at line 59 of file filter.h.

## Constructor & Destructor Documentation

## ◆ ~Filter()

virtual Grantlee::Filter::~Filter | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ conditionalEscape()

SafeString Grantlee::Filter::conditionalEscape | ( | const SafeString & | input | ) | const

Escapes `input` if not already safe from further escaping and returns it. The OutputStream::escape method is used to escape `input`.

## ◆ doFilter()

virtual QVariant Grantlee::Filter::doFilter | ( | const QVariant & | input,
|  | const QVariant & | argument = {},
|  | bool | autoescape = {} ) const
| pure virtual

Reimplement to filter `input` given `argument`.

`autoescape` determines whether the autoescape feature is currently on or off. Most filters will not use this.

See also
  Autoescaping and safe-ness

## ◆ escape() [1/2]

SafeString Grantlee::Filter::escape | ( | const QString & | input | ) | const

Escapes and returns `input`. The OutputStream::escape method is used to escape `input`.

## ◆ escape() [2/2]

SafeString Grantlee::Filter::escape | ( | const SafeString & | input | ) | const

Escapes and returns `input`. The OutputStream::escape method is used to escape `input`.

## ◆ isSafe()

virtual bool Grantlee::Filter::isSafe | ( |  | ) | const
| virtual

Reimplement to return whether this filter is safe.