The package can be retrieved either from the svn repository:
svn checkout http://xml-cpp-class-generator.googlecode.com/svn/trunk/ MyClassGenerator
or from the downloads page. and should be installed like this:
cd MyClassGenerator ./configure --prefix=/usr make install
NB: the prefix (/usr in the given example) should correspond to where the python modules should be installed. On many distributions it is
/usr/lib[64]/python[version]/site-packages/
whilst the default prefix is usually /usr/local, which will not work.
Once this is done, it can be run by calling GenerateFiles.py
from anywhere (be sure you run rehash
on your (t)csh or zsh already opened shells).
I found a proper way to configure a local installation:
cd MyClassGenerator ./configure --enable-local make
This allows to run the package like this:
cd MyClassGenerator ./GenerateFiles.py
From now onwards, it is assumed that MyClassDescription.xml, a valid XML class description file (as described here), is present in the directory.
First, help is provided by the executable script itself, when using the -h
or --help
argument:
usage: GenerateFiles.py [-h] [-v] [-H HEADEREXT] [-I IMPLEXT] [-d OUTPUTDIR] [-l LANG] [-n] [-1 LEVEL1] [-2 LEVEL2] F [F ...]
Generates C++ classes from a class description read from a XML file.
positional arguments: F XML file(s) to be read
optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit -H HEADEREXT, --header HEADEREXT extension for header files (default: .hpp) -I IMPLEXT, --impl IMPLEXT extension for implementation files (default: .cpp) -d OUTPUTDIR, --directory OUTPUTDIR destination directory (default: ./) -l LANG, --language LANG sets the output language (default: en) -t, --translation shows available translations and exits -n, --noout disables the file production, will just check syntax (default: False) -1 LEVEL1, --level1 LEVEL1 sets output level for the interpretor class (default: 3) -2 LEVEL2, --level2 LEVEL2 sets output level for the main script (default: 3)
This help and the argument processing are done by the argparse python module.
In order to get the output files in my_output_dir
, the following command line has to be typed:
cd MyClassGenerator ./GenerateFiles.py MyClassDescription.xml -d my_output_dir
The -1
and -2
arguments control the verbosity of the running, -l
sets the output language (the ISO-639-1 language code), defaults to en (i.e. english) if nothing is given or if the wanted translation does not exist. A list of available translations is printed when using -t
argument.
All the python modules are documented, the pdf manual can be created using doxygen on the provided doxyfile in Documentation/
. The documentation can also be generated by using make documentation
.