Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
086a7495
Commit
086a7495
authored
Oct 10, 2017
by
Sylvain Berfini
🎩
Browse files
Fixed enums names in Java wrapper
parent
49ae9548
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
33 deletions
+41
-33
wrappers/java/genwrapper.py
wrappers/java/genwrapper.py
+41
-33
No files found.
wrappers/java/genwrapper.py
View file @
086a7495
...
...
@@ -31,6 +31,39 @@ import metadoc
##########################################################################
ENUMS_LIST
=
{
'AccountCreatorActivationCodeStatus'
:
'AccountCreator'
,
'AccountCreatorDomainStatus'
:
'AccountCreator'
,
'AccountCreatorEmailStatus'
:
'AccountCreator'
,
'AccountCreatorLanguageStatus'
:
'AccountCreator'
,
'AccountCreatorPasswordStatus'
:
'AccountCreator'
,
'AccountCreatorPhoneNumberStatus'
:
'AccountCreator'
,
'AccountCreatorStatus'
:
'AccountCreator'
,
'AccountCreatorTransportStatus'
:
'AccountCreator'
,
'AccountCreatorUsernameStatus'
:
'AccountCreator'
,
'AddressFamily'
:
'CallStats'
,
'CallDir'
:
'Call'
,
'CallState'
:
'Call'
,
'CallStatus'
:
'CallLog'
,
'ChatMessageState'
:
'ChatMessage'
,
'ConfiguringState'
:
'Core'
,
'CoreLogCollectionUploadState'
:
'Core'
,
'GlobalState'
:
'Core'
,
'FriendListStatus'
:
'FriendList'
,
'IceState'
:
'CallStats'
,
'LimeState'
:
'Core'
,
'MediaDirection'
:
'Core'
,
'MediaEncryption'
:
'Core'
,
'PlayerState'
:
'Player'
,
'RegistrationState'
:
'Core'
,
'SubscribePolicy'
:
'Friend'
,
'TransportType'
:
'Address'
,
'XmlRpcArgType'
:
'XmlRpcRequest'
,
'XmlRpcStatus'
:
'XmlRpcRequest'
,
}
##########################################################################
class
JavaTranslator
(
object
):
def
__init__
(
self
):
self
.
docTranslator
=
metadoc
.
SandcastleJavaTranslator
()
...
...
@@ -67,7 +100,12 @@ class JavaTranslator(object):
elif
type
(
_type
)
is
AbsApi
.
EnumType
:
if
native
:
return
'int'
return
_type
.
desc
.
name
.
to_camel_case
()
name
=
_type
.
desc
.
name
.
to_camel_case
()
if
name
in
ENUMS_LIST
:
className
=
ENUMS_LIST
[
name
]
if
name
.
startswith
(
className
):
name
=
className
+
'.'
+
name
[
len
(
className
):]
return
name
elif
type
(
_type
)
is
AbsApi
.
BaseType
:
if
_type
.
name
==
'string'
:
return
'String'
...
...
@@ -290,36 +328,6 @@ class GenWrapper(object):
self
.
enums
=
{}
self
.
interfaces
=
{}
self
.
classes
=
{}
self
.
enums_list
=
{
'AccountCreatorActivationCodeStatus'
:
'AccountCreator'
,
'AccountCreatorDomainStatus'
:
'AccountCreator'
,
'AccountCreatorEmailStatus'
:
'AccountCreator'
,
'AccountCreatorLanguageStatus'
:
'AccountCreator'
,
'AccountCreatorPasswordStatus'
:
'AccountCreator'
,
'AccountCreatorPhoneNumberStatus'
:
'AccountCreator'
,
'AccountCreatorStatus'
:
'AccountCreator'
,
'AccountCreatorTransportStatus'
:
'AccountCreator'
,
'AccountCreatorUsernameStatus'
:
'AccountCreator'
,
'AddressFamily'
:
'CallStats'
,
'CallDir'
:
'Call'
,
'CallState'
:
'Call'
,
'CallStatus'
:
'CallLog'
,
'ChatMessageState'
:
'ChatMessage'
,
'ConfiguringState'
:
'Core'
,
'CoreLogCollectionUploadState'
:
'Core'
,
'GlobalState'
:
'Core'
,
'FriendListStatus'
:
'FriendList'
,
'IceState'
:
'CallStats'
,
'LimeState'
:
'Core'
,
'MediaDirection'
:
'Core'
,
'MediaEncryption'
:
'Core'
,
'PlayerState'
:
'Player'
,
'RegistrationState'
:
'Core'
,
'SubscribePolicy'
:
'Friend'
,
'TransportType'
:
'Address'
,
'XmlRpcArgType'
:
'XmlRpcRequest'
,
'XmlRpcStatus'
:
'XmlRpcRequest'
,
}
self
.
enums_to_remove
=
[]
def
render_all
(
self
):
...
...
@@ -332,8 +340,8 @@ class GenWrapper(object):
self
.
render_java_enum
(
_enum
[
1
])
for
name
,
value
in
self
.
enums
.
iteritems
():
if
name
in
self
.
enums_list
:
className
=
self
.
enums_list
[
name
]
if
name
in
ENUMS_LIST
:
className
=
ENUMS_LIST
[
name
]
print
'Enum '
+
name
+
' belongs to class '
+
className
self
.
classes
[
className
].
add_enum
(
value
)
self
.
enums_to_remove
.
append
(
name
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment