mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 08:39:20 +00:00
Java wrapper native will return objects, cast it
This commit is contained in:
parent
2b6753bdaf
commit
5a009ff9d5
2 changed files with 19 additions and 2 deletions
|
|
@ -100,11 +100,15 @@ class JavaTranslator(object):
|
|||
|
||||
elif type(_type) is AbsApi.ClassType:
|
||||
if native:
|
||||
return 'long'
|
||||
return 'Object'
|
||||
elif jni:
|
||||
return 'jobject'
|
||||
return _type.desc.name.to_camel_case()
|
||||
elif type(_type) is AbsApi.EnumType:
|
||||
if native:
|
||||
return 'int'
|
||||
elif jni:
|
||||
return 'jint'
|
||||
name = _type.desc.name.to_camel_case()
|
||||
if name in ENUMS_LIST:
|
||||
className = ENUMS_LIST[name]
|
||||
|
|
@ -114,16 +118,28 @@ class JavaTranslator(object):
|
|||
return name
|
||||
elif type(_type) is AbsApi.BaseType:
|
||||
if _type.name == 'string':
|
||||
if jni:
|
||||
return 'jstring'
|
||||
return 'String'
|
||||
elif _type.name == 'integer':
|
||||
if jni:
|
||||
return 'jint'
|
||||
return 'int'
|
||||
elif _type.name == 'floatant':
|
||||
if jni:
|
||||
return 'jfloat'
|
||||
return 'float'
|
||||
elif _type.name == 'size':
|
||||
if jni:
|
||||
return 'jint'
|
||||
return 'int'
|
||||
elif _type.name == 'time':
|
||||
if jni:
|
||||
return 'jlong'
|
||||
return 'long'
|
||||
elif _type.name == 'status':
|
||||
if jni:
|
||||
return 'jint'
|
||||
if native:
|
||||
return 'int'
|
||||
return 'void'
|
||||
|
|
@ -165,6 +181,7 @@ class JavaTranslator(object):
|
|||
methodDict['exception'] = self.throws_exception(_method.returnType)
|
||||
|
||||
methodDict['enumCast'] = type(_method.returnType) is AbsApi.EnumType
|
||||
methodDict['classCast'] = type(_method.returnType) is AbsApi.ClassType
|
||||
methodDict['params'] = ''
|
||||
methodDict['native_params'] = 'long nativePtr'
|
||||
methodDict['static_native_params'] = ''
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ class {{classImplName}} implements {{className}} {
|
|||
return classArray;
|
||||
{{/convertOutputClassArrayToLongArray}}
|
||||
{{#classicMethod}}
|
||||
{{#exception}}int exceptionResult = {{/exception}}{{return_keyword}}{{#enumCast}}{{return}}.fromInt({{/enumCast}}{{name}}(nativePtr{{native_params_impl}}){{#enumCast}}){{/enumCast}};
|
||||
{{#exception}}int exceptionResult = {{/exception}}{{return_keyword}}{{#enumCast}}{{return}}.fromInt({{/enumCast}}{{#classCast}}({{return}}){{/classCast}}{{name}}(nativePtr{{native_params_impl}}){{#enumCast}}){{/enumCast}};
|
||||
{{#exception}}if (exceptionResult != 0) throw new CoreException("{{name}} returned value " + exceptionResult){{/exception}}
|
||||
{{/classicMethod}}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue