[sword-devel] Temporarily suspend option filters

Greg Hellings greg.hellings at gmail.com
Sun Feb 1 15:38:54 MST 2009


Troy,

On Sun, Feb 1, 2009 at 4:01 PM, Troy A. Griffitts <scribe at crosswire.org> wrote:
> David and Greg,
>
> RenderText can take a buffer to render rather than the current key. This is
> useful for when you grab EntryAttributes from a module and want to process
> them through the same filters for that module.  But this won't help turn
> certain filters on or off temporarily.

I haven't tested this to see if it works, but if he's turning options
on and off regularly might he be better to use SWFilter::processText()
(this is what I was thinking of when I said renderText()) directly?
Then he could create a filter with the options he wants for one
display, get that text in an SWBuf, and pass it into processText()?
It seems that would be very much more efficient than pulling out the
options, setting them, rendering the text, then resetting them to
their initial.  However, I don't know if SWFilter is only usable
internal to the module classes or not.  That's the process I was
thinking of when I suggested renderText() - I just couldn't think of
the proper name of the method.

If an SWFilter is only usable inside of the module class, another
alternative would be to have renderText() accept an optional argument
of an SWFilter and render according to that instead of the default
filter - then the programmer could easily switch in and out between an
arbitrary number of filters with preset options, rather than having to
remember every option to save/reset at every attempt to render.

--Greg



More information about the sword-devel mailing list