Re: [pygccxml-development] Problems with long filename
Brought to you by:
mbaas,
roman_yakovenko
|
From: Roman Y. <rom...@gm...> - 2007-03-09 18:37:19
|
On 3/9/07, Birgir Sigurjonsson <Bir...@ro...> wrote:
import os
> from pyplusplus import module_builder
>
In order to use type_traits functionality it is necessary to import
declarations package from pygccxml
from pygccxml import declarations
Sorry, I forgot to write you this
#Creating an instance of class that will help you to expose your
> declarations
> mb = module_builder.module_builder_t(
> ['/home/birgir-s/src/abstractloader.h',
> ]
> , gccxml_path=r""
> ,
> working_directory=r"/home/birgir-s/src"
> ,
> include_paths=['/home/birgir-s/src']
> , define_symbols=[]
> )
>
> mb.decls( lambda decl: 'impl' in decl.name ).exclude()
>
> #mb.print_declarations()
>
> #Creating code creator. After this step you should not modify/customize
> declarations.
> mb.build_code_creator( module_name='pyplusplus' )
>
> all=mb.class_('AbstractLoader')
> extensions=all.mem_fun('extensions')
> rtype=extensions.return_type
> print 'extensions', rtype
> #below will fail as declarations do not exist
> #rtype_cls = declarations.class_traits.get_declaration( rtype )
> #rtype.alias = 'vector_of_strings'
>
Now this will fail for another reason: std::vector< std::string > is class
declaration,
as opposite to class definition. So if you will wrote next 2 lines as:
rtype_cls = declarations.class_declaration_traits.get_declaration( rtype )
rtype.alias = 'vector_of_strings'
This will work.
I also forgot to ask you what version of Py++ pygccxml you use.
Because in order to enjoy from semi automatic aliasing you need
latest version of py++ and pygccxml.
Automatic aliasing:
add next code somewhere in a file, which is passed to gccxml, in global
namespace:
namespace pyplusplus{ namespace aliases{
typedef std::vector < std::string > vvvvvvvv;
}}
Py++ will automaticly pick the name
HTH
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|