Commit 9a45f5c3 authored by DanmeiChen's avatar DanmeiChen
Browse files

fix swift wrapper enum

parent 39c1d52e
......@@ -51,7 +51,7 @@ typedef struct _LinphoneLoggingServiceCbs LinphoneLoggingServiceCbs;
* @brief Verbosity levels of log messages.
*/
typedef enum _LinphoneLogLevel {
LinphoneLogLevelDebug = 1, /**< @brief Level for debug messages. */
LinphoneLogLevelDebug = 1<<0, /**< @brief Level for debug messages. */
LinphoneLogLevelTrace = 1<<1, /**< @brief Level for traces. */
LinphoneLogLevelMessage = 1<<2, /**< @brief Level for information messages. */
LinphoneLogLevelWarning = 1<<3, /**< @brief Level for warning messages. */
......
......@@ -271,9 +271,9 @@ class SwiftTranslator(object):
enumValDict = {}
enumValDict['name'] = enumValue.name.translate(self.nameTranslator)
enumValDict['doc'] = enumValue.briefDescription.translate(self.docTranslator, tagAsBrief=True)
enumValDict['firstValue'] = i==0
if isinstance(enumValue.value, int):
lastValue = enumValue.value
enumValDict['isNone'] = i==0
enumValDict['value'] = str(enumValue.value)
elif isinstance(enumValue.value, AbsApi.Flag):
enumValDict['value'] = '1<<' + str(enumValue.value.position)
......
......@@ -45,7 +45,7 @@ public struct {{enumName}}:OptionSet
/// {{{line}}}
{{/lines}}
{{/doc}}
public static let {{name}} = {{enumName}}({{#firstValue}}[]{{/firstValue}}{{^firstValue}}rawValue: {{{value}}}{{/firstValue}})
public static let {{name}} = {{enumName}}({{#isNone}}[]{{/isNone}}{{^isNone}}rawValue: {{{value}}}{{/isNone}})
{{/values}}
}
{{/isFlag}}
......@@ -362,7 +362,7 @@ public class {{className}} : LinphoneObject
/// {{{line}}}
{{/lines}}
{{/doc}}
public static let {{name}} = {{enumName}}(rawValue: {{{value}}})
public static let {{name}} = {{enumName}}({{#isNone}}[]{{/isNone}}{{^isNone}}rawValue: {{{value}}}{{/isNone}})
{{/values}}
}
{{/isFlag}}
......
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