stencet
v0.1.16
Build C++ web server modules that allow easy routing and deployment.
|
Custom filters are subclassed off of the 'Filter' class. They must provide a constructor in the form of:
Where 'expression' is the optionally passed in argument (It is optional – can be null). See Expr for more information on how to suss out from that what you need to do to retrieve data fully from that – since it can be a literal or a variable, it might require a view context to evaluate.
They must also provide an evaluation function of their own:
The target is the passed in value from the left, and it must return a value to be rendered or passed to the right. Variants can be a useful type to pass back, and you shouldn't care in particular what type is passed in – although you can throw an exception if you need a certain type and the passed in type is non-convertible.
Filters must also be registered via
sometime before template parsing. In the future, there will be functionality to read filters from shared libraries.