C++ XML Objects

Abstract

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.

Description

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 anyway), as long as you don't change the copyright message at the top of the files, and include the license.txt file.

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.

I am only building and working on Darwin (OS-X) on a regular basis, with (very) infrequent excursions to a Debian GNU-Linux box. It would be great if somebody found this stuff useful and built it on some other systems to make sure it keeps compiling.

Further links

Installation (if you can call it that)

Using xmlobj in your own code

The doxygen generated documentation

Changes

Platforms that have been tested

XML Literate Project


Generated: Wed Apr 5 23:00:18 EST 2006

Copyright (c) 2005; Paul Hamilton; pHamtec P/L.

Use, modification, and distribution is provided free of any limitations.