Gerd v. Egidy wrote: > Hi, > > I'm using gccxml within our libt2n-project (a C++ IPC library, > http://www.intra2net.com/de/produkte/opensource/libt2n/) > and it has helped us very much to avoid needing an IDL-file: you just > mark a function within the source and that is parsed by gccxml to > gather the information usually found within an IDL. > > I'm now adding support for default arguments and I'm unsure > about the details of the gccxml-output: > > when I write > > void testb(std::string a=std::string()) > { > return; > } > > I'll get > > <Function id="_8" name="testb" returns="_334" context="_1" > mangled="_Z5testbSs" > demangled="testb(std::string)" location="f0:23" file="f0" line="23" > endline="25"> > <Argument name="a" type="_951" location="f0:23" file="f0" line="23" > default="string()"/> > </Function> > > So the default argument is returned without namespace. > > But in this code: > > namespace foo > { > > class bar > { > public: > static const std::string other; > }; > > const std::string bar::other="secret"; > } > > void testc(std::string a=foo::bar::other) > { > return; > } > > <Function id="_7" name="testc" returns="_334" context="_1" > mangled="_Z5testcSs" > demangled="testc(std::string)" location="f0:28" file="f0" line="28" > endline="30"> > <Argument name="a" type="_951" location="f0:28" file="f0" line="28" > default="foo::bar::other"/> > </Function> > > I get the full namespace of the default argument. > > I always need the full namespace of the default argument to be able > to add it to the headers of my stubs. > > Would anyone mind to help me understand the logic behind the > default attribute and where to get the namespace from in my > first example?
The default argument string is just an expression->string conversion done by the internal GCC parser (which is there for production of error messages from the compiler). It is mostly for human reference, and I doubt it can be parsed/used reliably for something automated. True support for default arguments will require support for dumping expressions, which in turn is part of the missing support for function bodies. A contributor is working on support for bodies, though: http://gccxml-bodies.sourceforge.net/ -Brad _______________________________________________ gccxml mailing list [email protected] http://www.gccxml.org/mailman/listinfo/gccxml
