Re: [pygccxml-development] type_traits.has_public_destructor problem
Brought to you by:
mbaas,
roman_yakovenko
|
From: Roman Y. <rom...@gm...> - 2008-07-06 19:27:19
|
On Sun, Jul 6, 2008 at 6:07 PM, Gustavo Carneiro <gjc...@gm...> wrote:
> When parsing a simple class like:
>
> /**
> * \brief a 3d cartesian position vector
> *
> * Unit is meters.
> */
> class Vector
> {
> public:
> /**
> * \param _x x coordinate of vector vector
> * \param _y y coordinate of vector vector
> * \param _z z coordinate of vector vector
> *
> * Create vector vector (_x, _y, _z)
> */
> Vector (double _x, double _y, double _z);
> /**
> * Create vector vector (0.0, 0.0, 0.0)
> */
> Vector ();
> /**
> * x coordinate of vector vector
> */
> double x;
> /**
> * y coordinate of vector vector
> */
> double y;
> /**
> * z coordinate of vector vector
> */
> double z;
> };
>
> pygccxml.declarations.type_traits.has_public_destructor is returning False.
> The class has an implicit public destructor, so pygccxml is wrong (0.9.5).
>
> In my code I am working around this problem like this:
>
> + def _has_public_destructor(self, cls):
> + for member in cls.get_members():
> + if isinstance(member, calldef.destructor_t):
> + if member.access_type != 'public':
> + return False
> + return True
>
> Regards.
Thanks. Latest CVS version of GCCXML dumps artificial declarations. It
is the only way to reliably find-out whether a class has public
destructor or not.
For example, next use case is not covered by the posted code:
struct XXX{
private:
virtual ~XXX(){}
};
struct YYY : public XXX{
};
/*void do_smth(){
YYY y;
}
*/
SVN version of pygccxml was updated.
I suggest you to switch to the latest versions
P.S. If nothing wrong happens, I will start working on next release - 1.0
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|