[sword-devel] Implementing filters with the SWIG bindings
mattjreimer at gmail.com
Mon Feb 20 13:16:45 MST 2006
On 2/20/06, Jason Turner <lefticus at gmail.com> wrote:
> I am currently in the process of enhancing and extending the SWIG
> interfaces, to make them more robust. One of the things that I can do
> along the way is enable the SWIG feature called "directors"
> Directors allow the user of the SWIG generated code to extend C++
> classes and override virtual methods.
> If you do not know already (since you said "not enough C++ skillz"),
> if a method is declared "virtual" the most derived method in the
> inheritance hierarchy is called. If you don't know what the means, I
> can describe with more details.
Yes, I've forgotten the small amount of C++ I knew. I think I still
understand what "virtual" is, but I don't know what "most derived
method" means--maybe the method defined most specifically, a leaf on
the tree of the inheritance heirarchy?
> Practically, what that means for us (you particularly) is that you
> could choose to implement your own filters in any language which SWIG
> supports directors. Namely: Python, Java and Ocaml.
Excellent! That's exactly what I want to do. I was going to try to
make a SWPythonFilter to see if I could get around the virtual problem
by defining a method and using a hook, but your way sounds like the
I'd be glad to test when you're ready.
> On a personal note, I used to use the FMT_HTMLHREF filter for
> Biblestudy, but between sword versions the HREF part changed
> drastically and I realized I could not rely on it staying stable, so I
> implemented my own set of HTML filters. Looking forward to my C#
> rewrite of biblestudy, I plan to using some less subjective filter
> such as OSIS and apply my own transformations after I have recieved
> the XML.
Yeah, I thought about using HTMLHREF, but my reader is targetted for
handhelds, so I'd like to use a lighter-weight renderer than HTML (a
GtkTextView widget, in particular). Being able to define my own filter
will be a big help.
More information about the sword-devel