[C++-sig] Split_module and file names
Roman Yakovenko
roman.yakovenko at gmail.com
Mon Nov 20 16:19:50 CET 2006
On 11/20/06, Nicolas Tessore <Tessore at stud.uni-heidelberg.de> wrote:
> Now the creation fails because of filename length.
> ...
> I have a ton of more nested
> containers, and cannot manually alias them all.
The solution is to create some function that will create an alias from
an instantiation
of std container. Obviously Py++ does if for you, but the names it
creates are very long
and ugly. You can do something better.
Take a look on container traits classes: http://tinyurl.com/yeezdc .
These classes will
help you to extract value_type( mapped_type ) from the container.
( source code: http://tinyurl.com/yeco7e )
Use pygccxml.declaration.all_container_traits variable. It defines a list of all
container traits classes
Now the code is pretty trivial:
def find_out_container_traits( cls ):
for ct in pygccxml.declaration.all_container_traits:
if ct.is_my_case( cls ):
return ct
else:
return None
def mangle( cls, ct ):
element_type = ct.element_type( cls )
cls.rename( .... )
mb = module_builder_t( ... )
for cls in mb.classes():
ct = find_out_container_traits( cls )
if ct:
mangle( cls, ct )
This should work.
> Then, I tried to make a
>
> typedef vector<vector<unsigned short> > > vector_vector_ushort;
>
> but this changed nothing for me.
I think that the reason is that too many different typedefs for the
instantiation
> So it may once again be proof of my ignorance, but could you point me in
> the right direction?
Is this the right direction?
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the Cplusplus-sig
mailing list