Commit ee4621fc authored by DanmeiChen's avatar DanmeiChen
Browse files

add key 'maybenil' to ALIASES to allow some parameterss optional for swift wrapper

parent aa2a7a0f
......@@ -231,6 +231,7 @@ TAB_SIZE = 8
ALIASES = bctbx_list{1}="A list of \ref \1 objects. \xmlonly <bctbxlist>\1</bctbxlist> \endxmlonly"
ALIASES += onTheFlyList="The objects inside the list are freshly allocated with a reference counter equal to one, so they need to be freed on list destruction with bctbx_list_free_with_data() for instance. \xmlonly <onTheFlyList/> \endxmlonly"
ALIASES += donotwrap="\xmlonly <donotwrap /> \endxmlonly"
ALIASES += maybenil="\xmlonly <maybenil /> \endxmlonly"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
......
......@@ -455,6 +455,7 @@ LINPHONE_PUBLIC LinphoneStatus linphone_call_accept (LinphoneCall *call);
* The application can later accept the call using this method.
* @param[in] call A #LinphoneCall object
* @param[in] params The specific parameters for this call, for example whether video is accepted or not. Use NULL to use default parameters
* @maybenil
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_with_params (LinphoneCall *call, const LinphoneCallParams *params);
......@@ -475,6 +476,7 @@ LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_early_media (LinphoneCall *c
* The call can then later be fully accepted using linphone_call_accept() or linphone_call_accept_with_params().
* @param[in] call A #LinphoneCall object
* @param[in] params The call parameters to use (can be NULL)
* @maybenil
* @return 0 if successful, -1 otherwise
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_early_media_with_params (LinphoneCall *call, const LinphoneCallParams *params);
......@@ -489,6 +491,7 @@ LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_early_media_with_params (Lin
*
* @param[in] call A #LinphoneCall object
* @param[in] params The new call parameters to use (may be NULL)
* @maybenil
* @return 0 if successful, -1 otherwise.
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_update (LinphoneCall *call, const LinphoneCallParams *params);
......@@ -529,6 +532,7 @@ LINPHONE_PUBLIC LinphoneStatus linphone_call_defer_update (LinphoneCall *call);
* (see linphone_call_params_enable_video()).
* @param[in] call A #LinphoneCall object
* @param[in] params A #LinphoneCallParams object describing the call parameters to accept
* @maybenil
* @return 0 if successful, -1 otherwise (actually when this function call is performed outside ot #LinphoneCallUpdatedByRemote state)
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_update (LinphoneCall *call, const LinphoneCallParams *params);
......
......@@ -1481,6 +1481,7 @@ LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneStatus linphone_core_accept_call_upd
* The parameters are initialized according to the current #LinphoneCore configuration and the current state of the LinphoneCall.
* @param[in] lc #LinphoneCore object
* @param[in] call #LinphoneCall for which the parameters are to be build, or NULL in the case where the parameters are to be used for a new outgoing call.
* @maybenil
* @return A new #LinphoneCallParams object
* @ingroup call_control
*/
......@@ -5573,6 +5574,7 @@ LINPHONE_PUBLIC LinphoneContent * linphone_core_create_content(LinphoneCore *lc)
* @param event the event name
* @param expires the whished duration of the subscription
* @param body an optional body, may be NULL.
* @maybenil
* @return a #LinphoneEvent holding the context of the created subcription.
**/
LINPHONE_PUBLIC LinphoneEvent *linphone_core_subscribe(LinphoneCore *lc, const LinphoneAddress *resource, const char *event, int expires, const LinphoneContent *body);
......
......@@ -44,6 +44,7 @@ LINPHONE_PUBLIC LinphoneStatus linphone_event_send_subscribe(LinphoneEvent *ev,
* Update (refresh) an outgoing subscription, changing the body.
* @param lev a #LinphoneEvent
* @param body an optional body to include in the subscription update, may be NULL.
* @maybenil
**/
LINPHONE_PUBLIC LinphoneStatus linphone_event_update_subscribe(LinphoneEvent *lev, const LinphoneContent *body);
......
......@@ -853,7 +853,7 @@ class CParser(object):
for arg in event.arguments:
argName = metaname.ArgName()
argName.from_snake_case(arg.name)
argument = Argument(argName, self.parse_type(arg))
argument = Argument(argName, self.parse_type(arg), arg.maybenil)
method.add_arguments(argument)
method.briefDescription = event.briefDoc
method.detailedDescription = event.detailedDoc
......@@ -881,7 +881,7 @@ class CParser(object):
aType = self.parse_type(arg)
argName = metaname.ArgName()
argName.from_snake_case(arg.name)
absArg = Argument(argName, aType)
absArg = Argument(argName, aType, arg.maybenil)
method.add_arguments(absArg)
self.methodsIndex[cfunction.name] = method
......
......@@ -92,6 +92,7 @@ class CArgument(CObject):
self.description = None
self.containedType = None
self.onTheFlyList = False
self.maybenil = False
keywords = [ 'const', 'struct', 'enum', 'signed', 'unsigned', 'short', 'long', '*' ]
fullySplittedType = []
splittedType = t.strip().split(' ')
......@@ -591,6 +592,7 @@ class Project:
n = paramdesc.find('.//bctbxlist')
if n is not None:
arg.containedType = n.text
arg.maybenil = True if paramdesc.find('.//maybenil') is not None else False
arg.description = self.__cleanDescription(paramdesc.find('./parameterdescription'))
missingDocWarning = ''
for arg in argslist.arguments:
......
......@@ -123,7 +123,7 @@ class SwiftTranslator(object):
methodDict['impl']['args'] += ', '
methodDict['impl']['c_args'] += ', '
if isinstance(arg.type, AbsApi.ClassType):
methodDict['impl']['c_args'] += argName + ".cPtr"
methodDict['impl']['c_args'] += argName + "?.cPtr" if arg.optional else argName + ".cPtr"
elif isinstance(arg.type, AbsApi.EnumType):
argType = arg.type.translate(self.langTranslator, namespace=namespace)
if methodDict['impl']['type'] == "Int":
......@@ -151,7 +151,7 @@ class SwiftTranslator(object):
elif argType == "UnsafeMutableRawPointer":
argType = "UnsafeMutableRawPointer?"
methodDict['impl']['args'] += argName + ":" + argType
methodDict['impl']['args'] += argName + ":" + argType + "?" if arg.optional else argName + ":" + argType
return methodDict
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment