Grantlee  5.1.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=QVariant(), bool autoescape=false) 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

Definition at line 57 of file filter.h.

Constructor & Destructor Documentation

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

Destructor.

Member Function Documentation

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.

virtual QVariant Grantlee::Filter::doFilter ( const QVariant input,
const QVariant argument = QVariant(),
bool  autoescape = false 
) 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
SafeString Grantlee::Filter::escape ( const QString input) const

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

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

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

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

Reimplement to return whether this filter is safe.