A list for the developers of CellML tools

Text archives Help


[cellml-dev] Using MathMLToInputFormat in C++


Chronological Thread 
  • From: lpsmith at spod-central.org (Lucian Smith)
  • Subject: [cellml-dev] Using MathMLToInputFormat in C++
  • Date: Wed, 18 Nov 2009 23:52:51 +0000

So! Thanks in no small part to the rest of you, I have now successfully
compiled OpenCell, and with that as a guide, believe I will be able to
successfully steal the MathMLToInputFormat and InputFormatToMathML
functions hidden therein--I now am #including 'MathMLInputServices.h' in
my own code, and seem to have access to the functions.

However, I can't work out how to provide the correct objects to actually
call those functions. And I can't use OpenCell as a guide, because (as
far as I can tell) those functions are only called from Java.

So, I have two things I need: One, how do I change a
'iface::mathml_dom::MathMLElement*' into a
'mathml_domIMathMLApplyElement*' ? Is this even possible? There are two
hurdles that I can see--one is changing an 'Element' into an
'ApplyElement', and one is (basically) changing the '::' into an 'I' ;-)

The second thing I need is to know what to do with 'ACString's or
'nsACString's. I tracked down 'nsStringAPI.h' from xulrunner-sdk, but I
get an error if I include it:

/home/lpsmith/xulrunner-sdk/include/xpcom/nsStringAPI.h:1054: error: size of
array 'arg' is negative

If I use it anyway and create a 'nsACString' object, I get a new error:

/home/lpsmith/xulrunner-sdk/include/xpcom/nsStringAPI.h:705: error:
'nsACString::~nsACString()' is protected
src/module-cellml.cpp:178: error: within this context

Here's my current, not-working code for some context:

cellml_api::MathList* mathlist = component->math();
cellml_api::MathMLElementIterator* mli = mathlist->iterate();
mathlist->release_ref();
mathml_dom::MathMLElement* mathel;
while((mathel = mli->next()) != NULL) {
nsACString blank;
blank = "";
MathMLInputServices mmlis;
mmlis.MathMLToInputFormat(NULL, NULL, blank, blank);
mathel->release_ref();
}
mli->release_ref();


So, I need to change 'mathel' into something to use it instead of NULL,
and I need to do something different with my 'nsACString' object.

Hints, anyone? And/or documentation where I could read about this sort of
thing? I think part of this is just that the whole interface thing is
throwing me for a loop.

-Lucian




Archive powered by MHonArc 2.6.18.

Top of page