本文整理汇总了Python中pygccxml.declarations.remove_pointer函数的典型用法代码示例。如果您正苦于以下问题:Python remove_pointer函数的具体用法?Python remove_pointer怎么用?Python remove_pointer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove_pointer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: filter_decls
def filter_decls(mb):
mb.global_ns.exclude()
fx_ns = mb.namespace( 'FX' )
fx_ns.include()
fx_ns.decls( declarations_to_exclude.is_excluded ).exclude()
fx_ns.decls( lambda decl: decl.name.startswith('FXIPCMsgHolder') ).exclude()
fx_ns.namespace( 'Pol' ).exclude()
fx_ns.decls( files_to_exclude.is_excluded ).exclude()
fx_ns.class_( 'QValueList<FX::Pol::knowReferrers::ReferrerEntry>').exclude()
try:
fx_ns.variables( 'metaClass').exclude()
except: pass
try:
fx_ns.class_( 'QPtrVector<FX::Generic::BoundFunctorV>').exclude()
except: pass
#Niall? wrapper for this function could not be compiled
#TnFXSQLDBStatement = fx_ns.class_( 'TnFXSQLDBStatement' )
#TnFXSQLDBStatement.member_function( name='bind', arg_types=[None,None,None] ).exclude()
for func in fx_ns.calldefs():
#I want to exclude all functions that returns pointer to pointer
#and returns pointer to fundamental type
if declarations.is_pointer( func.return_type ):
temp = declarations.remove_pointer( func.return_type )
if declarations.is_fundamental( temp ) and not declarations.is_const(temp):
func.exclude()
temp = declarations.remove_cv( func.return_type )
temp = declarations.remove_pointer( temp )
if declarations.is_pointer( temp ):
func.exclude()
示例2: is_related
def is_related( t1, t2 ):
"""Check whether two types\\classes t1 and t2 could introduce the problem"""
if declarations.is_pointer( t1 ) and declarations.is_pointer( t2 ):
return registration_order.is_related( declarations.remove_pointer( t1 )
, declarations.remove_pointer( t2 ) )
elif declarations.is_pointer( t1 ) and not declarations.is_pointer( t2 ):
t1 = declarations.remove_cv( declarations.remove_pointer( t1 ) )
t2 = declarations.remove_cv( t2 )
if declarations.is_same( t1, t2 ):
return 1
elif not declarations.is_pointer( t1 ) and declarations.is_pointer( t2 ):
t1 = declarations.remove_cv( t1 )
t2 = declarations.remove_cv( declarations.remove_pointer( t2 ) )
if declarations.is_same( t1, t2 ):
return -1
else: #not is_pointer( t1 ) and not is_pointer( t2 ):
if declarations.is_integral( t1 ) and not declarations.is_bool( t1 ) \
and declarations.is_bool( t2 ):
return -1
elif declarations.is_bool( t1 ) \
and declarations.is_integral( t2 ) and not declarations.is_bool( t2 ):
return 1
else:
pass
return None
示例3: test_function_pointer
def test_function_pointer(self):
"""
Test working with pointers and function pointers.
"""
decls = parser.parse([self.header], self.config)
global_ns = declarations.get_global_namespace(decls)
# Test on a function pointer
criteria = declarations.variable_matcher(name="func1")
variables = declarations.matcher.find(criteria, global_ns)
self.assertTrue(variables[0].name == "func1")
self.assertTrue(
isinstance(variables[0].decl_type, declarations.pointer_t))
self.assertTrue(
str(variables[0].decl_type) == "void (*)( int,double )")
self.assertTrue(
declarations.is_calldef_pointer(variables[0].decl_type))
self.assertTrue(
isinstance(declarations.remove_pointer(variables[0].decl_type),
declarations.free_function_type_t))
# Get the function (free_function_type_t) and test the return and
# argument types
function = variables[0].decl_type.base
self.assertTrue(isinstance(function.return_type, declarations.void_t))
self.assertTrue(
isinstance(function.arguments_types[0], declarations.int_t))
self.assertTrue(
isinstance(function.arguments_types[1], declarations.double_t))
# Test on a normal pointer
criteria = declarations.variable_matcher(name="myPointer")
variables = declarations.matcher.find(criteria, global_ns)
self.assertTrue(variables[0].name == "myPointer")
self.assertTrue(
isinstance(variables[0].decl_type, declarations.pointer_t))
self.assertFalse(
declarations.is_calldef_pointer(variables[0].decl_type))
self.assertTrue(
isinstance(declarations.remove_pointer(variables[0].decl_type),
declarations.volatile_t))
# Test on function pointer in struct (x8)
for d in global_ns.declarations:
if d.name == "x8":
self.assertTrue(
isinstance(d.decl_type, declarations.pointer_t))
self.assertTrue(declarations.is_calldef_pointer(d.decl_type))
self.assertTrue(
isinstance(
declarations.remove_pointer(d.decl_type),
declarations.member_function_type_t))
self.assertTrue(
str(declarations.remove_pointer(d.decl_type)) ==
"void ( ::some_struct_t::* )( )")
示例4: _exportable_impl
def _exportable_impl(self):
if self.transformations:
# It is possible that the function asked for the user attention.
# The user paid attention and created a transformation.
# Py++ should be silent in this case.
return ""
if not self.parent.name:
return messages.W1057 % str(self)
all_types = [arg.type for arg in self.arguments]
all_types.append(self.return_type)
for some_type in all_types:
if isinstance(some_type, declarations.ellipsis_t):
return messages.W1053 % str(self)
units = declarations.decompose_type(some_type)
ptr2functions = filter(lambda unit: isinstance(unit, declarations.calldef_type_t), units)
if ptr2functions:
return messages.W1004
# Function that take as agrument some instance of non public class
# will not be exported. Same to the return variable
if isinstance(units[-1], declarations.declarated_t):
dtype = units[-1]
if isinstance(dtype.declaration.parent, declarations.class_t):
if dtype.declaration not in dtype.declaration.parent.public_members:
return messages.W1005
no_ref = declarations.remove_reference(some_type)
no_ptr = declarations.remove_pointer(no_ref)
no_const = declarations.remove_const(no_ptr)
if declarations.is_array(no_const):
return messages.W1006
return self._exportable_impl_derived()
示例5: _update_containers_db
def _update_containers_db( self, type_ ):
#will return True is type was treated
type_ = declarations.remove_alias( type_ )
type_ = declarations.remove_pointer( type_ )
type_ = declarations.remove_reference( type_ )
type_ = declarations.remove_cv( type_ )
type_ = declarations.remove_declarated( type_ )
class_traits = declarations.class_traits
class_declaration_traits = declarations.class_declaration_traits
if not class_traits.is_my_case( type_ ) and not class_declaration_traits.is_my_case( type_ ):
return False
if class_traits.is_my_case( type_ ):
container_cls = class_traits.get_declaration( type_ )
else:
container_cls = class_declaration_traits.get_declaration( type_ )
if None is container_cls.indexing_suite:
return False
try:
#check extraction of element type from container
container_cls.indexing_suite.element_type
except RuntimeError:
decls_logger = _logging_.loggers.declarations
if not messages.filter_disabled_msgs([messages.W1042], container_cls.disabled_messages ):
return #user disabled property warning
decls_logger.warn( "%s;%s" % ( container_cls, messages.W1042 ) )
self.__containers.add( container_cls )
return True
示例6: _exportable_impl
def _exportable_impl( self ):
if not self.name:
return messages.W1033
if self.bits == 0 and self.name == "":
return messages.W1034
if declarations.is_array( self.type ) and declarations.array_size( self.type ) < 1:
return messages.W1045
type_ = declarations.remove_alias( self.type )
type_ = declarations.remove_const( type_ )
if declarations.is_pointer( type_ ):
if self.type_qualifiers.has_static:
return messages.W1035
if python_traits.is_immutable( type_.base ):
return messages.W1036
units = declarations.decompose_type( type_ )
ptr2functions = filter( lambda unit: isinstance( unit, declarations.calldef_type_t )
, units )
if ptr2functions:
return messages.W1037
type_ = declarations.remove_pointer( type_ )
if declarations.class_traits.is_my_case( type_ ):
cls = declarations.class_traits.get_declaration( type_ )
if not cls.name:
return messages.W1038
if isinstance( self.parent, declarations.class_t ):
if self.access_type != declarations.ACCESS_TYPES.PUBLIC:
return messages.W1039
return ''
示例7: remove_ref_or_ptr
def remove_ref_or_ptr( type_ ):
if declarations.is_pointer( type_ ):
return declarations.remove_pointer( type_ )
elif declarations.is_reference( type_ ):
return declarations.remove_reference( type_ )
else:
raise TypeError( 'Type should be reference or pointer, got %s.' % type_ )
示例8: has_unnamed_type
def has_unnamed_type( self, var ):
type_ = declarations.remove_pointer( var.type )
#~ type_ = declarations.remove_declarated( type_ )
if declarations.class_traits.is_my_case( type_ ):
cls = declarations.class_traits.get_declaration( type_ )
return bool( not cls.name )
else:
return False
示例9: check_type_compatibility
def check_type_compatibility( self, fget, fset ):
#algorithms allows "const" differences between types
t1 = fget.return_type
t2 = fset.arguments[0].type
if declarations.is_same( t1, t2 ):
return True
elif declarations.is_pointer( t1 ) and declarations.is_pointer( t2 ):
t1 = declarations.remove_cv( declarations.remove_pointer( t1 ) )
t2 = declarations.remove_cv( declarations.remove_pointer( t2 ) )
return declarations.is_same( t1, t2 )
elif declarations.is_reference( t1 ) and declarations.is_reference( t2 ):
t1 = declarations.remove_cv( declarations.remove_reference( t1 ) )
t2 = declarations.remove_cv( declarations.remove_reference( t2 ) )
return declarations.is_same( t1, t2 )
else:
return False
示例10: _exportable_impl
def _exportable_impl( self ):
if not self.parent.name and self.is_wrapper_needed():
#return messages.W1057 % str( self )
return messages.W1058 % str( self )
if not self.name:
return messages.W1033
if self.bits == 0 and self.name == "":
return messages.W1034
if not self.expose_address:
if declarations.is_array( self.type ) and declarations.array_size( self.type ) < 1:
return messages.W1045
type_ = declarations.remove_alias( self.type )
type_ = declarations.remove_const( type_ )
if declarations.is_pointer( type_ ):
if not self.expose_address and self.type_qualifiers.has_static:
return messages.W1035
if not self.expose_address and python_traits.is_immutable( type_.base ):
return messages.W1036
units = declarations.decompose_type( type_ )
ptr2functions = filter( lambda unit: isinstance( unit, declarations.calldef_type_t )
, units )
if ptr2functions:
return messages.W1037
type_ = declarations.remove_pointer( type_ )
if declarations.class_traits.is_my_case( type_ ):
cls = declarations.class_traits.get_declaration( type_ )
if not cls.name:
return messages.W1038
#if cls.class_type == declarations.CLASS_TYPES.UNION:
# return messages.W1061 % ( str( self ), str( cls ) )
if isinstance( self.parent, declarations.class_t ):
if self.access_type != declarations.ACCESS_TYPES.PUBLIC:
return messages.W1039
if declarations.is_array( type_ ):
item_type = declarations.array_item_type( type_ )
if declarations.is_pointer( item_type ):
item_type_no_ptr = declarations.remove_pointer( item_type )
if python_traits.is_immutable( item_type_no_ptr ):
return messages.W1056
return ''
示例11: __should_be_exposed_by_address_only
def __should_be_exposed_by_address_only(self):
type_ = declarations.remove_alias( self.type )
type_ = declarations.remove_const( type_ )
type_ = declarations.remove_pointer( type_ )
if not declarations.class_traits.is_my_case( type_ ):
return False
cls = declarations.class_traits.get_declaration( type_ )
if cls.class_type == declarations.CLASS_TYPES.UNION:
return True
elif not cls.name:
return True
else:
return False
示例12: visit_pointer
def visit_pointer( self ):
no_ptr = declarations.remove_const( declarations.remove_pointer( self.user_type ) )
if declarations.is_same( declarations.char_t(), no_ptr ) and self.treat_char_ptr_as_binary_data == False:
return "ctypes.c_char_p"
elif declarations.is_same( declarations.wchar_t(), no_ptr ) and self.treat_char_ptr_as_binary_data == False:
return "ctypes.c_wchar_p"
elif declarations.is_same( declarations.void_t(), no_ptr ):
return "ctypes.c_void_p"
else:
base_visitor = self.create_converter( self.user_type.base )
internal_type_str = declarations.apply_visitor( base_visitor, base_visitor.user_type )
if declarations.is_calldef_pointer( self.user_type ):
return internal_type_str
else:
return "ctypes.POINTER( %s )" % internal_type_str
示例13: expose_member_as_ndarray1d
def expose_member_as_ndarray1d(klass, member_name, array_size):
klass.include_files.append( "ndarray.hpp")
z = klass.var(member_name)
z.exclude()
elem_type = _D.array_item_type(z.type) if _D.is_array(z.type) else _D.remove_pointer(z.type)
klass.add_declaration_code('''
static sdcpp::ndarray CLASS_NAME_get_CLASS_NAME_MEMBER_NAME( CLASS_TYPE const & inst ){
return sdcpp::new_ndarray1d(ARRAY_SIZE, sdcpp::dtypeof< ELEM_TYPE >(), (void *)(inst.MEMBER_NAME));
}
'''.replace("MEMBER_NAME", member_name) \
.replace("CLASS_NAME", klass.alias) \
.replace("CLASS_TYPE", klass.pds) \
.replace("ELEM_TYPE", elem_type.partial_decl_string) \
.replace("ARRAY_SIZE", str(array_size)))
klass.add_registration_code('add_property( "MEMBER_NAME", &::CLASS_NAME_get_CLASS_NAME_MEMBER_NAME )' \
.replace("MEMBER_NAME", member_name).replace("CLASS_NAME", klass.alias))
示例14: find_out_opaque_decl
def find_out_opaque_decl( type_, ensure_opaque_decl ):
naked_type = declarations.remove_cv( type_ )
if not declarations.is_pointer( naked_type ):
return None
naked_type = declarations.remove_pointer( declarations.remove_cv( type_ ) )
if decl_wrappers.python_traits.is_immutable( naked_type ):
return None#immutable types could not be opaque
decl = None
if declarations.is_class( naked_type ):
decl = declarations.class_traits.get_declaration( naked_type )
elif declarations.is_class_declaration( naked_type ):#class declaration:
decl = declarations.class_declaration_traits.get_declaration( naked_type )
else:
return None
if ensure_opaque_decl:
if decl.opaque:
return decl
else:
return None
else:
return decl
示例15: _exportable_impl
def _exportable_impl( self ):
all_types = [ arg.type for arg in self.arguments ]
all_types.append( self.return_type )
for some_type in all_types:
units = declarations.decompose_type( some_type )
ptr2functions = filter( lambda unit: isinstance( unit, declarations.calldef_type_t )
, units )
if ptr2functions:
return messages.W1004
#Function that take as agrument some instance of non public class
#will not be exported. Same to the return variable
if isinstance( units[-1], declarations.declarated_t ):
dtype = units[-1]
if isinstance( dtype.declaration.parent, declarations.class_t ):
if dtype.declaration not in dtype.declaration.parent.public_members:
return messages.W1005
no_ref = declarations.remove_reference( some_type )
no_ptr = declarations.remove_pointer( no_ref )
no_const = declarations.remove_const( no_ptr )
if declarations.is_array( no_const ):
return messages.W1006
return self._exportable_impl_derived()