C++ XML Objects review

by rbytes.net on

C++ XML Objects is a framework for persisting hierarchies of C++ objects to and from XML

License: Freeware
File size: 0K
Developer: Paul Hamilton
0 stars award from rbytes.net

C++ XML Objects is a framework for persisting hierarchies of C++ objects to and from XML. Boost, The STL and Patterns are used extensively. All platforms which support Boost will be supported.

Sometimes there is a need to save hierarchies of C++ objects to a file (or DB etc), and then retrieve them at a later date. This project allows your classes to derive from a single object (called "xmlobj"), provide a few extra methods which allow the visitor pattern to work on them and register them so that they can be read or written to an XML stream.

The only overhead is a per-class type and name of each object (as std::string). The members don't need to be wrapped which means that your memory footprint won't really get any larger.

There are actually 2 separate projects which are combined to make "cppxmlobj". The first is a called "cppreflect" and provides a framework for providing reflection to C++ objects. Reflection is the mechanism by which your class members can be referenced by a string name. To achieve this, "cppreflect" uses the visitor pattern. The other project is "cpppersist" which adds the right methods to each object so that it can be read or written to some type of stream.

These projects are included as part of this (they aren't separate SourceForge projects), but they are completely independent of each other, so you could build your own scheme to persist your objects to a different type of file, or provide some other type of mechanism to read and write your objects data.

To interoperate, these two projects share a common base class which is provided by another independent project called "cppcommon". This is a simple class which provides the abstract interfaces necessary for an object to provide different types of facilities.

The project uses all the facilities of Boost for the build system (and for a bunch of the implementation) so you will need to get and build it. It uses the same license as Boost which means you can freely use it (it's really only useful as source code anywhere), as long as you don't change the copyright message at the top of the files.

If you find it useful, or find some bugs (and fix them, then get back to me and I'll incorporate the changes. If you do this through SourceForge, then we can track the bugs etc.

What's New in This Release:
Added in delayed loading. This allows a system to only load in an object in an XML file when the object is actually referenced. Added in "platforms" to documentation for supported platforms. Now builds on OS X Tiger, GCC 4.0 and latest BOOST (1.33.1). Also builds on latest Linux. Change the documentation layout (thank's Spirit), and added Generic objects. Also changed to use a single license.txt referenced at the top of each file. Since this code has been stable and working for a while, next release will be beta if I can build on a few more systems.

C++ XML Objects search tags