R++ based XML Generator.

Steven T. Hatton hattons at globalsymmetry.com
Sat Sep 3 01:36:07 UTC 2005


I created an XML generator derived from the r++ DefalutVisitor.  Someone may 
find it modestly useful.  If nothing else, it might be useful as a 
cut-n-paste template for something that is actually useful.

There are a few things commented out, and a few more that probably should be 
commented out.  If an attribute is commented out, or if the value parameter 
to sth::XmlTree::_setAttribute(name, value) is quoted, that means something 
wasn't working either in my code, or in r++.

My code is here:

http://baldur.globalsymmetry.com/open-source/org/kde/kdevelop/rxx/sth/

I made a few changes to the r++ code, and I'm not sure if my code depends on 
any of them.  IOW, I don't know if my code will compile against the r++ in 
the svn.  I do know that I used exceptions, and that r++ was built with 
-fno-exceptions in the svn.  You can remove the exceptions fairly easily 
since they are thrown from a single helper function.

I used a tiny bit of Qt4, but I believe converting it to Qt3 is trivial.

All that the code currently does is create a QDomDocument and streams it to a 
std::ostream passed as a parameter to the constructor. This is an example of 
the XML generated:

http://baldur.globalsymmetry.com/open-source/org/kde/kdevelop/rxx/HelloWorld.xml

I find the default xml rendering provided by Mozilla to be a useful means of 
viewing the file.  KXMLEditor also works well.

If I've accomplished nothing else, I've demonstrated that r++'s AST makes a 
very pretty dot graph:

http://baldur.globalsymmetry.com/open-source/org/kde/kdevelop/rxx/doc/html/inherits.html

To get the really cool frames for the Doxygen output go here:

http://baldur.globalsymmetry.com/open-source/org/kde/kdevelop/rxx/doc/html/index.html
-- 
Regards,
Steven




More information about the KDevelop-devel mailing list