本文整理汇总了Python中pygccxml.declarations.array_item_type函数的典型用法代码示例。如果您正苦于以下问题:Python array_item_type函数的具体用法?Python array_item_type怎么用?Python array_item_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array_item_type函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: visit_array
def visit_array( self ):
item_visitor = self.create_converter( declarations.array_item_type(self.user_type) )
item_type = declarations.apply_visitor( item_visitor, item_visitor.user_type )
size = declarations.array_size( self.user_type )
if size == declarations.array_t.SIZE_UNKNOWN:
size = 0
return "( %s * %d )" % ( item_type, size )
开发者ID:Axitonium,项目名称:py-source-sdk-2013,代码行数:7,代码来源:ctypes_formatter.py
示例2: __init__
def __init__(self, function, buffer_arg_ref, size_arg_ref):
"""Constructor.
:param buffer_arg_ref: "reference" to the buffer argument
:param buffer_arg_ref: "reference" to argument, which holds buffer size
"""
transformer.transformer_t.__init__(self, function)
self.buffer_arg = self.get_argument(buffer_arg_ref)
self.buffer_arg_index = self.function.arguments.index(self.buffer_arg)
self.size_arg = self.get_argument(size_arg_ref)
self.size_arg_index = self.function.arguments.index(self.size_arg)
if not is_ptr_or_array(self.buffer_arg.type):
raise ValueError(
'%s\nin order to use "input_c_buffer" transformation, "buffer" argument %s type must be a array or a pointer (got %s).'
) % (function, self.buffer_arg.name, self.buffer_arg.type)
if not declarations.is_integral(self.size_arg.type):
raise ValueError(
'%s\nin order to use "input_c_buffer" transformation, "size" argument %s type must be an integral type (got %s).'
) % (function, self.size_arg.name, self.size_arg.type)
self.buffer_item_type = declarations.remove_const(declarations.array_item_type(self.buffer_arg.type))
开发者ID:ISoirar,项目名称:pypp11,代码行数:25,代码来源:transformers.py
示例3: wrapper_type
def wrapper_type( self ):
tmpl = "%(namespace)s::%(constness)sarray_1_t< %(item_type)s, %(array_size)d>"
item_type = declarations.array_item_type(self.declaration.decl_type)
is_noncopyable = not declarations.is_fundamental(item_type) and \
declarations.is_noncopyable(item_type)
constness = ''
if declarations.is_const(self.declaration.decl_type) or is_noncopyable:
constness = 'const_'
result = tmpl % {
'namespace' : code_repository.array_1.namespace
, 'constness' : constness
, 'item_type' : declarations.array_item_type( self.declaration.decl_type ).decl_string
, 'array_size': declarations.array_size( self.declaration.decl_type )
}
return declarations.dummy_type_t( result )
开发者ID:Sandern,项目名称:py-source-sdk-2013,代码行数:17,代码来源:member_variable.py
示例4: _create_impl
def _create_impl(self):
templates = declarations.templates
call_invocation = declarations.call_invocation
ns_name = code_repository.array_1.namespace
item_type = declarations.array_item_type(self.array_type)
is_noncopyable = not declarations.is_fundamental(item_type) and declarations.is_noncopyable(item_type)
if declarations.is_const(self.array_type) or is_noncopyable:
fn_name = 'register_const_array_1'
else:
fn_name = 'register_array_1'
fn_def_tmpl_args = [ declarations.array_item_type(self.array_type).decl_string
, str( declarations.array_size(self.array_type) ) ]
if not self.call_policies.is_default():
fn_def_tmpl_args.append(
self.call_policies.create(self, call_policies.CREATION_POLICY.AS_TEMPLATE_ARGUMENT ) )
fn_def = templates.join( '::'.join( [ns_name, fn_name] ), fn_def_tmpl_args )
return call_invocation.join( fn_def, [ '"%s"' % self._create_name() ] ) + ';'
开发者ID:Sandern,项目名称:py-source-sdk-2013,代码行数:20,代码来源:array_1_registrator.py
示例5: wrapper_type
def wrapper_type( self ):
tmpl = "%(namespace)s::%(constness)sarray_1_t< %(item_type)s, %(array_size)d>"
constness = ''
if declarations.is_const( self.declaration.type ):
constness = 'const_'
result = tmpl % {
'namespace' : code_repository.array_1.namespace
, 'constness' : constness
, 'item_type' : declarations.array_item_type( self.declaration.type ).decl_string
, 'array_size': declarations.array_size( self.declaration.type )
}
return declarations.dummy_type_t( result )
开发者ID:CTrauma,项目名称:pypp11,代码行数:13,代码来源:member_variable.py
示例6: __format_type_as_undecorated
def __format_type_as_undecorated( self, type_, is_argument, hint ):
result = []
type_ = declarations.remove_alias( type_ )
if declarations.is_array( type_ ):
result.append( declarations.array_item_type( type_ ).decl_string )
result.append( '*' )
if is_argument:
result.append( 'const' )
else:
result.append( self.__remove_leading_scope( type_.decl_string ) )
result = ' '.join( result )
if hint == 'nm':
for x in ( '*', '&' ):
result = result.replace( ' ' + x, x )
return result
开发者ID:Noitidart,项目名称:osxtypes,代码行数:16,代码来源:undname.py
示例7: __init__
def __init__(self, function, arg_ref, size):
"""Constructor.
@param size: The fixed size of the input array
@type size: int
"""
transformer.transformer_t.__init__( self, function )
self.arg = self.get_argument( arg_ref )
self.arg_index = self.function.arguments.index( self.arg )
if not is_ptr_or_array( self.arg.type ):
raise ValueError( '%s\nin order to use "input_array" transformation, argument %s type must be a array or a pointer (got %s).' ) \
% ( function, self.arg.name, self.arg.type)
self.array_size = size
self.array_item_type = declarations.remove_const( declarations.array_item_type( self.arg.type ) )
开发者ID:alekob,项目名称:tce,代码行数:17,代码来源:transformers.py
示例8: 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))
开发者ID:BackupGGCode,项目名称:pyopencv,代码行数:17,代码来源:memvar_transformers.py
示例9: _create_impl
def _create_impl(self):
templates = declarations.templates
call_invocation = declarations.call_invocation
ns_name = code_repository.array_1.namespace
if declarations.is_const(self.array_type):
fn_name = "register_const_array_1"
else:
fn_name = "register_array_1"
fn_def_tmpl_args = [
declarations.array_item_type(self.array_type).decl_string,
str(declarations.array_size(self.array_type)),
]
if not self.call_policies.is_default():
fn_def_tmpl_args.append(self.call_policies.create(self, call_policies.CREATION_POLICY.AS_TEMPLATE_ARGUMENT))
fn_def = templates.join("::".join([ns_name, fn_name]), fn_def_tmpl_args)
return call_invocation.join(fn_def, ['"%s"' % self._create_name()]) + ";"
开发者ID:BackupTheBerlios,项目名称:slon,代码行数:18,代码来源:array_1_registrator.py
示例10: __init__
def __init__(self, function, arg_ref, size):
"""Constructor.
:param maxsize: The maximum string size we will allow...
:type maxsize: int
"""
transformer.transformer_t.__init__( self, function )
self.arg = self.get_argument( arg_ref )
self.arg_index = self.function.arguments.index( self.arg )
if not is_ptr_or_array( self.arg.type ):
raise ValueError( '%s\nin order to use "input_array" transformation, argument %s type must be a array or a pointer (got %s).' ) \
% ( function, self.arg.name, self.arg.type)
self.max_size = size
self.array_item_type = declarations.remove_const( declarations.array_item_type( self.arg.type ) )
self.array_item_rawtype = declarations.remove_cv( self.arg.type )
self.array_item_rawtype = declarations.pointer_t( self.array_item_type )
开发者ID:holocronweaver,项目名称:python-ogre,代码行数:19,代码来源:PO_FuncTransform.py
示例11: _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 ''
开发者ID:CTrauma,项目名称:pypp11,代码行数:41,代码来源:variable_wrapper.py
注:本文中的pygccxml.declarations.array_item_type函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论