Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
djinni
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
djinni
Commits
137c2ea8
Commit
137c2ea8
authored
May 07, 2015
by
Jacob Potter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add nullability constraints to ObjC generated files.
parent
04da0e9a
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
156 additions
and
136 deletions
+156
-136
src/source/ObjcGenerator.scala
src/source/ObjcGenerator.scala
+14
-9
src/source/ObjcMarshal.scala
src/source/ObjcMarshal.scala
+19
-4
test-suite/generated-src/objc/DBAssortedIntegers.h
test-suite/generated-src/objc/DBAssortedIntegers.h
+13
-13
test-suite/generated-src/objc/DBAssortedIntegers.mm
test-suite/generated-src/objc/DBAssortedIntegers.mm
+4
-4
test-suite/generated-src/objc/DBClientInterface.h
test-suite/generated-src/objc/DBClientInterface.h
+3
-3
test-suite/generated-src/objc/DBClientReturnedRecord.h
test-suite/generated-src/objc/DBClientReturnedRecord.h
+6
-6
test-suite/generated-src/objc/DBClientReturnedRecord.mm
test-suite/generated-src/objc/DBClientReturnedRecord.mm
+2
-2
test-suite/generated-src/objc/DBConstants.h
test-suite/generated-src/objc/DBConstants.h
+7
-7
test-suite/generated-src/objc/DBConstants.mm
test-suite/generated-src/objc/DBConstants.mm
+4
-4
test-suite/generated-src/objc/DBCppException.h
test-suite/generated-src/objc/DBCppException.h
+1
-1
test-suite/generated-src/objc/DBCppException.mm
test-suite/generated-src/objc/DBCppException.mm
+1
-1
test-suite/generated-src/objc/DBDateRecord.h
test-suite/generated-src/objc/DBDateRecord.h
+3
-3
test-suite/generated-src/objc/DBDateRecord.mm
test-suite/generated-src/objc/DBDateRecord.mm
+1
-1
test-suite/generated-src/objc/DBMapDateRecord.h
test-suite/generated-src/objc/DBMapDateRecord.h
+3
-3
test-suite/generated-src/objc/DBMapDateRecord.mm
test-suite/generated-src/objc/DBMapDateRecord.mm
+1
-1
test-suite/generated-src/objc/DBMapListRecord.h
test-suite/generated-src/objc/DBMapListRecord.h
+3
-3
test-suite/generated-src/objc/DBMapListRecord.mm
test-suite/generated-src/objc/DBMapListRecord.mm
+1
-1
test-suite/generated-src/objc/DBMapRecord.h
test-suite/generated-src/objc/DBMapRecord.h
+3
-3
test-suite/generated-src/objc/DBMapRecord.mm
test-suite/generated-src/objc/DBMapRecord.mm
+1
-1
test-suite/generated-src/objc/DBNestedCollection.h
test-suite/generated-src/objc/DBNestedCollection.h
+3
-3
test-suite/generated-src/objc/DBNestedCollection.mm
test-suite/generated-src/objc/DBNestedCollection.mm
+1
-1
test-suite/generated-src/objc/DBPrimitiveList.h
test-suite/generated-src/objc/DBPrimitiveList.h
+3
-3
test-suite/generated-src/objc/DBPrimitiveList.mm
test-suite/generated-src/objc/DBPrimitiveList.mm
+1
-1
test-suite/generated-src/objc/DBRecordWithDerivings.h
test-suite/generated-src/objc/DBRecordWithDerivings.h
+5
-5
test-suite/generated-src/objc/DBRecordWithDerivings.mm
test-suite/generated-src/objc/DBRecordWithDerivings.mm
+1
-1
test-suite/generated-src/objc/DBRecordWithNestedDerivings.h
test-suite/generated-src/objc/DBRecordWithNestedDerivings.h
+5
-5
test-suite/generated-src/objc/DBRecordWithNestedDerivings.mm
test-suite/generated-src/objc/DBRecordWithNestedDerivings.mm
+1
-1
test-suite/generated-src/objc/DBSetRecord.h
test-suite/generated-src/objc/DBSetRecord.h
+3
-3
test-suite/generated-src/objc/DBSetRecord.mm
test-suite/generated-src/objc/DBSetRecord.mm
+1
-1
test-suite/generated-src/objc/DBTestHelpers.h
test-suite/generated-src/objc/DBTestHelpers.h
+21
-21
test-suite/generated-src/objc/DBTestHelpers.mm
test-suite/generated-src/objc/DBTestHelpers.mm
+21
-21
No files found.
src/source/ObjcGenerator.scala
View file @
137c2ea8
...
...
@@ -87,11 +87,15 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
def
headerName
(
ident
:
String
)
:
String
=
idObjc
.
ty
(
ident
)
+
"."
+
spec
.
objcHeaderExt
def
bodyName
(
ident
:
String
)
:
String
=
idObjc
.
ty
(
ident
)
+
".mm"
// Must be a Obj-C++ file in case the constants are not compile-time constant expressions
def
writeObjcConstVariable
(
w
:
IndentWriter
,
c
:
Const
,
s
:
String
)
:
Unit
=
c
.
ty
.
resolved
.
base
match
{
// MBinary | MList | MSet | MMap are not allowed for constants.
// Primitives should be `const type`. All others are pointers and should be `type * const`
case
t
:
MPrimitive
=>
w
.
w
(
s
"const ${marshal.fqFieldType(c.ty)} $s${idObjc.const(c.ident)}"
)
case
_
=>
w
.
w
(
s
"${marshal.fqFieldType(c.ty)} const $s${idObjc.const(c.ident)}"
)
def
writeObjcConstVariable
(
w
:
IndentWriter
,
c
:
Const
,
s
:
String
)
:
Unit
=
{
val
nullability
=
marshal
.
nullability
(
c
.
ty
.
resolved
).
fold
(
""
)(
" __"
+
_
)
val
td
=
marshal
.
fqFieldType
(
c
.
ty
)
+
nullability
c
.
ty
.
resolved
.
base
match
{
// MBinary | MList | MSet | MMap are not allowed for constants.
// Primitives should be `const type`. All others are pointers and should be `type * const`
case
t
:
MPrimitive
=>
w
.
w
(
s
"const ${td} $s${idObjc.const(c.ident)}"
)
case
_
=>
w
.
w
(
s
"${td} const $s${idObjc.const(c.ident)}"
)
}
}
def
generateObjcConstants
(
w
:
IndentWriter
,
consts
:
Seq
[
Const
],
selfName
:
String
)
=
{
...
...
@@ -219,12 +223,12 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
w
.
wl
(
s
"@interface $self : NSObject"
)
// Deep copy construtor
w
.
wl
(
s
"- (
id)${idObjc.method("
init_with_
" + ident.name)}:(
$self *)${idObjc.local(ident)};"
)
w
.
wl
(
s
"- (
nonnull id)${idObjc.method("
init_with_
" + ident.name)}:(nonnull
$self *)${idObjc.local(ident)};"
)
if
(!
r
.
fields
.
isEmpty
)
{
val
head
=
r
.
fields
.
head
val
skipFirst
=
SkipFirst
()
val
first
=
if
(
r
.
fields
.
isEmpty
)
""
else
IdentStyle
.
camelUpper
(
"with_"
+
r
.
fields
.
head
.
ident
.
name
)
val
decl
=
s
"- (id)init$first"
val
decl
=
s
"- (
nonnull
id)init$first"
writeAlignedObjcCall
(
w
,
decl
,
r
.
fields
,
""
,
f
=>
(
idObjc
.
field
(
f
.
ident
),
s
"(${marshal.paramType(f.ty)})${idObjc.local(f.ident)}"
))
w
.
wl
(
";"
)
}
...
...
@@ -232,11 +236,12 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
for
(
f
<-
r
.
fields
)
{
w
.
wl
writeDoc
(
w
,
f
.
doc
)
w
.
wl
(
s
"@property (nonatomic, readonly) ${marshal.fqFieldType(f.ty)} ${idObjc.field(f.ident)};"
)
val
nullability
=
marshal
.
nullability
(
f
.
ty
.
resolved
).
fold
(
""
)(
", "
+
_
)
w
.
wl
(
s
"@property (nonatomic, readonly${nullability}) ${marshal.fqFieldType(f.ty)} ${idObjc.field(f.ident)};"
)
}
if
(
r
.
derivingTypes
.
contains
(
DerivingType
.
Ord
))
{
w
.
wl
w
.
wl
(
s
"- (NSComparisonResult)compare:($self *)other;"
)
w
.
wl
(
s
"- (NSComparisonResult)compare:(
nonnull
$self *)other;"
)
}
w
.
wl
w
.
wl
(
"@end"
)
...
...
src/source/ObjcMarshal.scala
View file @
137c2ea8
...
...
@@ -16,14 +16,29 @@ class ObjcMarshal(spec: Spec) extends Marshal(spec) {
override
def
fqTypename
(
tm
:
MExpr
)
:
String
=
typename
(
tm
)
def
fqTypename
(
name
:
String
,
ty
:
TypeDef
)
:
String
=
typename
(
name
,
ty
)
override
def
paramType
(
tm
:
MExpr
)
:
String
=
toObjcParamType
(
tm
)
def
nullability
(
tm
:
MExpr
)
:
Option
[
String
]
=
{
tm
.
base
match
{
case
MOptional
=>
Some
(
"nullable"
)
case
MPrimitive
(
_
,
_
,
_
,
_
,
_
,
_
,
_
,
_
)
=>
None
case
d
:
MDef
=>
d
.
defType
match
{
case
DEnum
=>
None
case
DInterface
=>
Some
(
"nullable"
)
case
DRecord
=>
Some
(
"nonnull"
)
}
case
_
=>
Some
(
"nonnull"
)
}
}
override
def
paramType
(
tm
:
MExpr
)
:
String
=
{
nullability
(
tm
).
fold
(
""
)(
_
+
" "
)
+
toObjcParamType
(
tm
)
}
override
def
fqParamType
(
tm
:
MExpr
)
:
String
=
paramType
(
tm
)
override
def
returnType
(
ret
:
Option
[
TypeRef
])
:
String
=
ret
.
fold
(
"void"
)(
paramType
)
override
def
returnType
(
ret
:
Option
[
TypeRef
])
:
String
=
ret
.
fold
(
"void"
)(
(
t
:
TypeRef
)
=>
nullability
(
t
.
resolved
).
fold
(
""
)(
_
+
" "
)
+
toObjcParamType
(
t
.
resolved
)
)
override
def
fqReturnType
(
ret
:
Option
[
TypeRef
])
:
String
=
returnType
(
ret
)
override
def
fieldType
(
tm
:
MExpr
)
:
String
=
p
aramType
(
tm
)
override
def
fqFieldType
(
tm
:
MExpr
)
:
String
=
fq
ParamType
(
tm
)
override
def
fieldType
(
tm
:
MExpr
)
:
String
=
toObjcP
aramType
(
tm
)
override
def
fqFieldType
(
tm
:
MExpr
)
:
String
=
toObjc
ParamType
(
tm
)
override
def
toCpp
(
tm
:
MExpr
,
expr
:
String
)
:
String
=
throw
new
AssertionError
(
"direct objc to cpp conversion not possible"
)
override
def
fromCpp
(
tm
:
MExpr
,
expr
:
String
)
:
String
=
throw
new
AssertionError
(
"direct cpp to objc conversion not possible"
)
...
...
test-suite/generated-src/objc/DBAssortedIntegers.h
View file @
137c2ea8
...
...
@@ -4,15 +4,15 @@
#import <Foundation/Foundation.h>
@interface
DBAssortedIntegers
:
NSObject
-
(
id
)
initWithAssortedIntegers
:(
DBAssortedIntegers
*
)
assortedIntegers
;
-
(
id
)
initWithEight
:(
int8_t
)
eight
sixteen
:(
int16_t
)
sixteen
thirtytwo
:(
int32_t
)
thirtytwo
sixtyfour
:(
int64_t
)
sixtyfour
oEight
:(
NSNumber
*
)
oEight
oSixteen
:(
NSNumber
*
)
oSixteen
oThirtytwo
:(
NSNumber
*
)
oThirtytwo
oSixtyfour
:(
NSNumber
*
)
oSixtyfour
;
-
(
nonnull
id
)
initWithAssortedIntegers
:(
nonnull
DBAssortedIntegers
*
)
assortedIntegers
;
-
(
nonnull
id
)
initWithEight
:(
int8_t
)
eight
sixteen
:(
int16_t
)
sixteen
thirtytwo
:(
int32_t
)
thirtytwo
sixtyfour
:(
int64_t
)
sixtyfour
oEight
:(
nullable
NSNumber
*
)
oEight
oSixteen
:(
nullable
NSNumber
*
)
oSixteen
oThirtytwo
:(
nullable
NSNumber
*
)
oThirtytwo
oSixtyfour
:(
nullable
NSNumber
*
)
oSixtyfour
;
@property
(
nonatomic
,
readonly
)
int8_t
eight
;
...
...
@@ -22,12 +22,12 @@
@property
(
nonatomic
,
readonly
)
int64_t
sixtyfour
;
@property
(
nonatomic
,
readonly
)
NSNumber
*
oEight
;
@property
(
nonatomic
,
readonly
,
nullable
)
NSNumber
*
oEight
;
@property
(
nonatomic
,
readonly
)
NSNumber
*
oSixteen
;
@property
(
nonatomic
,
readonly
,
nullable
)
NSNumber
*
oSixteen
;
@property
(
nonatomic
,
readonly
)
NSNumber
*
oThirtytwo
;
@property
(
nonatomic
,
readonly
,
nullable
)
NSNumber
*
oThirtytwo
;
@property
(
nonatomic
,
readonly
)
NSNumber
*
oSixtyfour
;
@property
(
nonatomic
,
readonly
,
nullable
)
NSNumber
*
oSixtyfour
;
@end
test-suite/generated-src/objc/DBAssortedIntegers.mm
View file @
137c2ea8
...
...
@@ -41,10 +41,10 @@
sixteen
:(
int16_t
)
sixteen
thirtytwo
:(
int32_t
)
thirtytwo
sixtyfour
:(
int64_t
)
sixtyfour
oEight
:(
NSNumber
*
)
oEight
oSixteen
:(
NSNumber
*
)
oSixteen
oThirtytwo
:(
NSNumber
*
)
oThirtytwo
oSixtyfour
:(
NSNumber
*
)
oSixtyfour
oEight
:(
nullable
NSNumber
*
)
oEight
oSixteen
:(
nullable
NSNumber
*
)
oSixteen
oThirtytwo
:(
nullable
NSNumber
*
)
oThirtytwo
oSixtyfour
:(
nullable
NSNumber
*
)
oSixtyfour
{
if
(
self
=
[
super
init
])
{
_eight
=
eight
;
...
...
test-suite/generated-src/objc/DBClientInterface.h
View file @
137c2ea8
...
...
@@ -8,8 +8,8 @@
@protocol
DBClientInterface
/** Returns record of given string */
-
(
DBClientReturnedRecord
*
)
getRecord
:(
int64_t
)
recordId
utf8string
:(
NSString
*
)
utf8string
misc
:(
NSString
*
)
misc
;
-
(
nonnull
DBClientReturnedRecord
*
)
getRecord
:(
int64_t
)
recordId
utf8string
:(
nonnull
NSString
*
)
utf8string
misc
:(
nullable
NSString
*
)
misc
;
@end
test-suite/generated-src/objc/DBClientReturnedRecord.h
View file @
137c2ea8
...
...
@@ -4,15 +4,15 @@
#import <Foundation/Foundation.h>
@interface
DBClientReturnedRecord
:
NSObject
-
(
id
)
initWithClientReturnedRecord
:(
DBClientReturnedRecord
*
)
clientReturnedRecord
;
-
(
id
)
initWithRecordId
:(
int64_t
)
recordId
content
:(
NSString
*
)
content
misc
:(
NSString
*
)
misc
;
-
(
nonnull
id
)
initWithClientReturnedRecord
:(
nonnull
DBClientReturnedRecord
*
)
clientReturnedRecord
;
-
(
nonnull
id
)
initWithRecordId
:(
int64_t
)
recordId
content
:(
nonnull
NSString
*
)
content
misc
:(
nullable
NSString
*
)
misc
;
@property
(
nonatomic
,
readonly
)
int64_t
recordId
;
@property
(
nonatomic
,
readonly
)
NSString
*
content
;
@property
(
nonatomic
,
readonly
,
nonnull
)
NSString
*
content
;
@property
(
nonatomic
,
readonly
)
NSString
*
misc
;
@property
(
nonatomic
,
readonly
,
nullable
)
NSString
*
misc
;
@end
test-suite/generated-src/objc/DBClientReturnedRecord.mm
View file @
137c2ea8
...
...
@@ -21,8 +21,8 @@
}
-
(
id
)
initWithRecordId
:(
int64_t
)
recordId
content
:(
NSString
*
)
content
misc
:(
NSString
*
)
misc
content
:(
nonnull
NSString
*
)
content
misc
:(
nullable
NSString
*
)
misc
{
if
(
self
=
[
super
init
])
{
_recordId
=
recordId
;
...
...
test-suite/generated-src/objc/DBConstants.h
View file @
137c2ea8
...
...
@@ -5,13 +5,13 @@
@class
DBConstants
;
@interface
DBConstants
:
NSObject
-
(
id
)
initWithConstants
:(
DBConstants
*
)
constants
;
-
(
id
)
initWithSomeInteger
:(
int32_t
)
someInteger
someString
:(
NSString
*
)
someString
;
-
(
nonnull
id
)
initWithConstants
:(
nonnull
DBConstants
*
)
constants
;
-
(
nonnull
id
)
initWithSomeInteger
:(
int32_t
)
someInteger
someString
:(
nonnull
NSString
*
)
someString
;
@property
(
nonatomic
,
readonly
)
int32_t
someInteger
;
@property
(
nonatomic
,
readonly
)
NSString
*
someString
;
@property
(
nonatomic
,
readonly
,
nonnull
)
NSString
*
someString
;
@end
...
...
@@ -21,6 +21,6 @@ extern const int16_t DBConstantsI16Constant;
extern
const
int32_t
DBConstantsI32Constant
;
extern
const
int64_t
DBConstantsI64Constant
;
extern
const
double
DBConstantsF64Constant
;
extern
NSString
*
const
DBConstantsStringConstant
;
extern
NSNumber
*
const
DBConstantsOptionalIntegerConstant
;
extern
DBConstants
*
const
DBConstantsObjectConstant
;
extern
NSString
*
__nonnull
const
DBConstantsStringConstant
;
extern
NSNumber
*
__nullable
const
DBConstantsOptionalIntegerConstant
;
extern
DBConstants
*
__nonnull
const
DBConstantsObjectConstant
;
test-suite/generated-src/objc/DBConstants.mm
View file @
137c2ea8
...
...
@@ -19,11 +19,11 @@ const int64_t DBConstantsI64Constant = 4;
const
double
DBConstantsF64Constant
=
5.0
;
NSString
*
const
DBConstantsStringConstant
=
@"string-constant"
;
NSString
*
__nonnull
const
DBConstantsStringConstant
=
@"string-constant"
;
NSNumber
*
const
DBConstantsOptionalIntegerConstant
=
@1
;
NSNumber
*
__nullable
const
DBConstantsOptionalIntegerConstant
=
@1
;
DBConstants
*
const
DBConstantsObjectConstant
=
[[
DBConstants
alloc
]
initWithSomeInteger
:
DBConstantsI32Constant
DBConstants
*
__nonnull
const
DBConstantsObjectConstant
=
[[
DBConstants
alloc
]
initWithSomeInteger
:
DBConstantsI32Constant
someString:
DBConstantsStringConstant
];
#pragma clang diagnostic pop
...
...
@@ -40,7 +40,7 @@ DBConstants * const DBConstantsObjectConstant = [[DBConstants alloc] initWithSom
}
-
(
id
)
initWithSomeInteger
:(
int32_t
)
someInteger
someString
:(
NSString
*
)
someString
someString
:(
nonnull
NSString
*
)
someString
{
if
(
self
=
[
super
init
])
{
_someInteger
=
someInteger
;
...
...
test-suite/generated-src/objc/DBCppException.h
View file @
137c2ea8
...
...
@@ -9,6 +9,6 @@
-
(
int32_t
)
throwAnException
;
+
(
DBCppException
*
)
get
;
+
(
nullable
DBCppException
*
)
get
;
@end
test-suite/generated-src/objc/DBCppException.mm
View file @
137c2ea8
...
...
@@ -56,7 +56,7 @@ auto CppException::fromCpp(const CppType& cpp) -> ObjcType
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
DBCppException
*
)
get
{
+
(
nullable
DBCppException
*
)
get
{
try
{
auto
r
=
::
CppException
::
get
();
return
::
djinni_generated
::
CppException
::
fromCpp
(
r
);
...
...
test-suite/generated-src/objc/DBDateRecord.h
View file @
137c2ea8
...
...
@@ -4,9 +4,9 @@
#import <Foundation/Foundation.h>
@interface
DBDateRecord
:
NSObject
-
(
id
)
initWithDateRecord
:(
DBDateRecord
*
)
dateRecord
;
-
(
id
)
initWithCreatedAt
:(
NSDate
*
)
createdAt
;
-
(
nonnull
id
)
initWithDateRecord
:(
nonnull
DBDateRecord
*
)
dateRecord
;
-
(
nonnull
id
)
initWithCreatedAt
:(
nonnull
NSDate
*
)
createdAt
;
@property
(
nonatomic
,
readonly
)
NSDate
*
createdAt
;
@property
(
nonatomic
,
readonly
,
nonnull
)
NSDate
*
createdAt
;
@end
test-suite/generated-src/objc/DBDateRecord.mm
View file @
137c2ea8
...
...
@@ -14,7 +14,7 @@
return
self
;
}
-
(
id
)
initWithCreatedAt
:(
NSDate
*
)
createdAt
-
(
id
)
initWithCreatedAt
:(
nonnull
NSDate
*
)
createdAt
{
if
(
self
=
[
super
init
])
{
_createdAt
=
createdAt
;
...
...
test-suite/generated-src/objc/DBMapDateRecord.h
View file @
137c2ea8
...
...
@@ -4,9 +4,9 @@
#import <Foundation/Foundation.h>
@interface
DBMapDateRecord
:
NSObject
-
(
id
)
initWithMapDateRecord
:(
DBMapDateRecord
*
)
mapDateRecord
;
-
(
id
)
initWithDatesById
:(
NSDictionary
*
)
datesById
;
-
(
nonnull
id
)
initWithMapDateRecord
:(
nonnull
DBMapDateRecord
*
)
mapDateRecord
;
-
(
nonnull
id
)
initWithDatesById
:(
nonnull
NSDictionary
*
)
datesById
;
@property
(
nonatomic
,
readonly
)
NSDictionary
*
datesById
;
@property
(
nonatomic
,
readonly
,
nonnull
)
NSDictionary
*
datesById
;
@end
test-suite/generated-src/objc/DBMapDateRecord.mm
View file @
137c2ea8
...
...
@@ -22,7 +22,7 @@
return
self
;
}
-
(
id
)
initWithDatesById
:(
NSDictionary
*
)
datesById
-
(
id
)
initWithDatesById
:(
nonnull
NSDictionary
*
)
datesById
{
if
(
self
=
[
super
init
])
{
_datesById
=
datesById
;
...
...
test-suite/generated-src/objc/DBMapListRecord.h
View file @
137c2ea8
...
...
@@ -4,9 +4,9 @@
#import <Foundation/Foundation.h>
@interface
DBMapListRecord
:
NSObject
-
(
id
)
initWithMapListRecord
:(
DBMapListRecord
*
)
mapListRecord
;
-
(
id
)
initWithMapList
:(
NSArray
*
)
mapList
;
-
(
nonnull
id
)
initWithMapListRecord
:(
nonnull
DBMapListRecord
*
)
mapListRecord
;
-
(
nonnull
id
)
initWithMapList
:(
nonnull
NSArray
*
)
mapList
;
@property
(
nonatomic
,
readonly
)
NSArray
*
mapList
;
@property
(
nonatomic
,
readonly
,
nonnull
)
NSArray
*
mapList
;
@end
test-suite/generated-src/objc/DBMapListRecord.mm
View file @
137c2ea8
...
...
@@ -28,7 +28,7 @@
return
self
;
}
-
(
id
)
initWithMapList
:(
NSArray
*
)
mapList
-
(
id
)
initWithMapList
:(
nonnull
NSArray
*
)
mapList
{
if
(
self
=
[
super
init
])
{
_mapList
=
mapList
;
...
...
test-suite/generated-src/objc/DBMapRecord.h
View file @
137c2ea8
...
...
@@ -4,9 +4,9 @@
#import <Foundation/Foundation.h>
@interface
DBMapRecord
:
NSObject
-
(
id
)
initWithMapRecord
:(
DBMapRecord
*
)
mapRecord
;
-
(
id
)
initWithMap
:(
NSDictionary
*
)
map
;
-
(
nonnull
id
)
initWithMapRecord
:(
nonnull
DBMapRecord
*
)
mapRecord
;
-
(
nonnull
id
)
initWithMap
:(
nonnull
NSDictionary
*
)
map
;
@property
(
nonatomic
,
readonly
)
NSDictionary
*
map
;
@property
(
nonatomic
,
readonly
,
nonnull
)
NSDictionary
*
map
;
@end
test-suite/generated-src/objc/DBMapRecord.mm
View file @
137c2ea8
...
...
@@ -22,7 +22,7 @@
return
self
;
}
-
(
id
)
initWithMap
:(
NSDictionary
*
)
map
-
(
id
)
initWithMap
:(
nonnull
NSDictionary
*
)
map
{
if
(
self
=
[
super
init
])
{
_map
=
map
;
...
...
test-suite/generated-src/objc/DBNestedCollection.h
View file @
137c2ea8
...
...
@@ -4,9 +4,9 @@
#import <Foundation/Foundation.h>
@interface
DBNestedCollection
:
NSObject
-
(
id
)
initWithNestedCollection
:(
DBNestedCollection
*
)
nestedCollection
;
-
(
id
)
initWithSetList
:(
NSArray
*
)
setList
;
-
(
nonnull
id
)
initWithNestedCollection
:(
nonnull
DBNestedCollection
*
)
nestedCollection
;
-
(
nonnull
id
)
initWithSetList
:(
nonnull
NSArray
*
)
setList
;
@property
(
nonatomic
,
readonly
)
NSArray
*
setList
;
@property
(
nonatomic
,
readonly
,
nonnull
)
NSArray
*
setList
;
@end
test-suite/generated-src/objc/DBNestedCollection.mm
View file @
137c2ea8
...
...
@@ -26,7 +26,7 @@
return
self
;
}
-
(
id
)
initWithSetList
:(
NSArray
*
)
setList
-
(
id
)
initWithSetList
:(
nonnull
NSArray
*
)
setList
{
if
(
self
=
[
super
init
])
{
_setList
=
setList
;
...
...
test-suite/generated-src/objc/DBPrimitiveList.h
View file @
137c2ea8
...
...
@@ -4,9 +4,9 @@
#import <Foundation/Foundation.h>
@interface
DBPrimitiveList
:
NSObject
-
(
id
)
initWithPrimitiveList
:(
DBPrimitiveList
*
)
primitiveList
;
-
(
id
)
initWithList
:(
NSArray
*
)
list
;
-
(
nonnull
id
)
initWithPrimitiveList
:(
nonnull
DBPrimitiveList
*
)
primitiveList
;
-
(
nonnull
id
)
initWithList
:(
nonnull
NSArray
*
)
list
;
@property
(
nonatomic
,
readonly
)
NSArray
*
list
;
@property
(
nonatomic
,
readonly
,
nonnull
)
NSArray
*
list
;
@end
test-suite/generated-src/objc/DBPrimitiveList.mm
View file @
137c2ea8
...
...
@@ -20,7 +20,7 @@
return
self
;
}
-
(
id
)
initWithList
:(
NSArray
*
)
list
-
(
id
)
initWithList
:(
nonnull
NSArray
*
)
list
{
if
(
self
=
[
super
init
])
{
_list
=
list
;
...
...
test-suite/generated-src/objc/DBRecordWithDerivings.h
View file @
137c2ea8
...
...
@@ -4,14 +4,14 @@
#import <Foundation/Foundation.h>
@interface
DBRecordWithDerivings
:
NSObject
-
(
id
)
initWithRecordWithDerivings
:(
DBRecordWithDerivings
*
)
recordWithDerivings
;
-
(
id
)
initWithKey1
:(
int32_t
)
key1
key2
:(
NSString
*
)
key2
;
-
(
nonnull
id
)
initWithRecordWithDerivings
:(
nonnull
DBRecordWithDerivings
*
)
recordWithDerivings
;
-
(
nonnull
id
)
initWithKey1
:(
int32_t
)
key1
key2
:(
nonnull
NSString
*
)
key2
;
@property
(
nonatomic
,
readonly
)
int32_t
key1
;
@property
(
nonatomic
,
readonly
)
NSString
*
key2
;
@property
(
nonatomic
,
readonly
,
nonnull
)
NSString
*
key2
;
-
(
NSComparisonResult
)
compare
:(
DBRecordWithDerivings
*
)
other
;
-
(
NSComparisonResult
)
compare
:(
nonnull
DBRecordWithDerivings
*
)
other
;
@end
test-suite/generated-src/objc/DBRecordWithDerivings.mm
View file @
137c2ea8
...
...
@@ -16,7 +16,7 @@
}
-
(
id
)
initWithKey1
:(
int32_t
)
key1
key2
:(
NSString
*
)
key2
key2
:(
nonnull
NSString
*
)
key2
{
if
(
self
=
[
super
init
])
{
_key1
=
key1
;
...
...
test-suite/generated-src/objc/DBRecordWithNestedDerivings.h
View file @
137c2ea8
...
...
@@ -5,14 +5,14 @@
@class
DBRecordWithDerivings
;
@interface
DBRecordWithNestedDerivings
:
NSObject
-
(
id
)
initWithRecordWithNestedDerivings
:(
DBRecordWithNestedDerivings
*
)
recordWithNestedDerivings
;
-
(
id
)
initWithKey
:(
int32_t
)
key
rec
:(
DBRecordWithDerivings
*
)
rec
;
-
(
nonnull
id
)
initWithRecordWithNestedDerivings
:(
nonnull
DBRecordWithNestedDerivings
*
)
recordWithNestedDerivings
;
-
(
nonnull
id
)
initWithKey
:(
int32_t
)
key
rec
:(
nonnull
DBRecordWithDerivings
*
)
rec
;
@property
(
nonatomic
,
readonly
)
int32_t
key
;
@property
(
nonatomic
,
readonly
)
DBRecordWithDerivings
*
rec
;
@property
(
nonatomic
,
readonly
,
nonnull
)
DBRecordWithDerivings
*
rec
;
-
(
NSComparisonResult
)
compare
:(
DBRecordWithNestedDerivings
*
)
other
;
-
(
NSComparisonResult
)
compare
:(
nonnull
DBRecordWithNestedDerivings
*
)
other
;
@end
test-suite/generated-src/objc/DBRecordWithNestedDerivings.mm
View file @
137c2ea8
...
...
@@ -17,7 +17,7 @@
}
-
(
id
)
initWithKey
:(
int32_t
)
key
rec
:(
DBRecordWithDerivings
*
)
rec
rec
:(
nonnull
DBRecordWithDerivings
*
)
rec
{
if
(
self
=
[
super
init
])
{
_key
=
key
;
...
...
test-suite/generated-src/objc/DBSetRecord.h
View file @
137c2ea8
...
...
@@ -4,9 +4,9 @@
#import <Foundation/Foundation.h>
@interface
DBSetRecord
:
NSObject
-
(
id
)
initWithSetRecord
:(
DBSetRecord
*
)
setRecord
;
-
(
id
)
initWithSet
:(
NSSet
*
)
set
;
-
(
nonnull
id
)
initWithSetRecord
:(
nonnull
DBSetRecord
*
)
setRecord
;
-
(
nonnull
id
)
initWithSet
:(
nonnull
NSSet
*
)
set
;
@property
(
nonatomic
,
readonly
)
NSSet
*
set
;
@property
(
nonatomic
,
readonly
,
nonnull
)
NSSet
*
set
;
@end
test-suite/generated-src/objc/DBSetRecord.mm
View file @
137c2ea8
...
...
@@ -20,7 +20,7 @@
return
self
;
}
-
(
id
)
initWithSet
:(
NSSet
*
)
set
-
(
id
)
initWithSet
:(
nonnull
NSSet
*
)
set
{
if
(
self
=
[
super
init
])
{
_set
=
set
;
...
...
test-suite/generated-src/objc/DBTestHelpers.h
View file @
137c2ea8
...
...
@@ -14,49 +14,49 @@
@interface
DBTestHelpers
:
NSObject
+
(
DBSetRecord
*
)
getSetRecord
;
+
(
nonnull
DBSetRecord
*
)
getSetRecord
;
+
(
BOOL
)
checkSetRecord
:(
DBSetRecord
*
)
rec
;
+
(
BOOL
)
checkSetRecord
:(
nonnull
DBSetRecord
*
)
rec
;
+
(
DBPrimitiveList
*
)
getPrimitiveList
;
+
(
nonnull
DBPrimitiveList
*
)
getPrimitiveList
;
+
(
BOOL
)
checkPrimitiveList
:(
DBPrimitiveList
*
)
pl
;
+
(
BOOL
)
checkPrimitiveList
:(
nonnull
DBPrimitiveList
*
)
pl
;
+
(
DBNestedCollection
*
)
getNestedCollection
;
+
(
nonnull
DBNestedCollection
*
)
getNestedCollection
;
+
(
BOOL
)
checkNestedCollection
:(
DBNestedCollection
*
)
nc
;
+
(
BOOL
)
checkNestedCollection
:(
nonnull
DBNestedCollection
*
)
nc
;
+
(
NSDictionary
*
)
getMap
;
+
(
nonnull
NSDictionary
*
)
getMap
;
+
(
BOOL
)
checkMap
:(
NSDictionary
*
)
m
;
+
(
BOOL
)
checkMap
:(
nonnull
NSDictionary
*
)
m
;
+
(
NSDictionary
*
)
getEmptyMap
;
+
(
nonnull
NSDictionary
*
)
getEmptyMap
;
+
(
BOOL
)
checkEmptyMap
:(
NSDictionary
*
)
m
;
+
(
BOOL
)
checkEmptyMap
:(
nonnull
NSDictionary
*
)
m
;
+
(
DBMapListRecord
*
)
getMapListRecord
;
+
(
nonnull
DBMapListRecord
*
)
getMapListRecord
;
+
(
BOOL
)
checkMapListRecord
:(
DBMapListRecord
*
)
m
;
+
(
BOOL
)
checkMapListRecord
:(
nonnull
DBMapListRecord
*
)
m
;
+
(
void
)
checkClientInterfaceAscii
:(
id
<
DBClientInterface
>
)
i
;
+
(
void
)
checkClientInterfaceAscii
:(
nullable
id
<
DBClientInterface
>
)
i
;
+
(
void
)
checkClientInterfaceNonascii
:(
id
<
DBClientInterface
>
)
i
;
+
(
void
)
checkClientInterfaceNonascii
:(
nullable
id
<
DBClientInterface
>
)
i
;
+
(
void
)
checkEnumMap
:(
NSDictionary
*
)
m
;
+
(
void
)
checkEnumMap
:(
nonnull
NSDictionary
*
)
m
;
+
(
void
)
checkEnum
:(
DBColor
)
c
;
+
(
DBToken
*
)
tokenId
:(
DBToken
*
)
t
;
+
(
nullable
DBToken
*
)
tokenId
:(
nullable
DBToken
*
)
t
;
+
(
DBToken
*
)
createCppToken
;
+
(
nullable
DBToken
*
)
createCppToken
;
+
(
void
)
checkCppToken
:(
DBToken
*
)
t
;
+
(
void
)
checkCppToken
:(
nullable
DBToken
*
)
t
;
+
(
int64_t
)
cppTokenId
:(
DBToken
*
)
t
;
+
(
int64_t
)
cppTokenId
:(
nullable
DBToken
*
)
t
;
+
(
NSNumber
*
)
returnNone
;
+
(
nullable
NSNumber
*
)
returnNone
;
/** Ensures that we generate integer translation code */
+
(
DBAssortedIntegers
*
)
assortedIntegersId
:(
DBAssortedIntegers
*
)
i
;
+
(
nonnull
DBAssortedIntegers
*
)
assortedIntegersId
:(
nonnull
DBAssortedIntegers
*
)
i
;
@end
test-suite/generated-src/objc/DBTestHelpers.mm
View file @
137c2ea8
...
...
@@ -55,103 +55,103 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
return
self
;
}
+
(
DBSetRecord
*
)
getSetRecord
{
+
(
nonnull
DBSetRecord
*
)
getSetRecord
{
try
{
auto
r
=
::
TestHelpers
::
get_set_record
();
return
::
djinni_generated
::
SetRecord
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
BOOL
)
checkSetRecord
:(
DBSetRecord
*
)
rec
{
+
(
BOOL
)
checkSetRecord
:(
nonnull
DBSetRecord
*
)
rec
{
try
{
auto
r
=
::
TestHelpers
::
check_set_record
(
::
djinni_generated
::
SetRecord
::
toCpp
(
rec
));
return
::
djinni
::
Bool
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
DBPrimitiveList
*
)
getPrimitiveList
{
+
(
nonnull
DBPrimitiveList
*
)
getPrimitiveList
{
try
{
auto
r
=
::
TestHelpers
::
get_primitive_list
();
return
::
djinni_generated
::
PrimitiveList
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
BOOL
)
checkPrimitiveList
:(
DBPrimitiveList
*
)
pl
{
+
(
BOOL
)
checkPrimitiveList
:(
nonnull
DBPrimitiveList
*
)
pl
{
try
{
auto
r
=
::
TestHelpers
::
check_primitive_list
(
::
djinni_generated
::
PrimitiveList
::
toCpp
(
pl
));
return
::
djinni
::
Bool
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
DBNestedCollection
*
)
getNestedCollection
{
+
(
nonnull
DBNestedCollection
*
)
getNestedCollection
{
try
{
auto
r
=
::
TestHelpers
::
get_nested_collection
();
return
::
djinni_generated
::
NestedCollection
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
BOOL
)
checkNestedCollection
:(
DBNestedCollection
*
)
nc
{
+
(
BOOL
)
checkNestedCollection
:(
nonnull
DBNestedCollection
*
)
nc
{
try
{
auto
r
=
::
TestHelpers
::
check_nested_collection
(
::
djinni_generated
::
NestedCollection
::
toCpp
(
nc
));
return
::
djinni
::
Bool
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
NSDictionary
*
)
getMap
{
+
(
nonnull
NSDictionary
*
)
getMap
{
try
{
auto
r
=
::
TestHelpers
::
get_map
();
return
::
djinni
::
Map
<::
djinni
::
String
,
::
djinni
::
I64
>::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
BOOL
)
checkMap
:(
NSDictionary
*
)
m
{
+
(
BOOL
)
checkMap
:(
nonnull
NSDictionary
*
)
m
{
try
{
auto
r
=
::
TestHelpers
::
check_map
(
::
djinni
::
Map
<::
djinni
::
String
,
::
djinni
::
I64
>::
toCpp
(
m
));
return
::
djinni
::
Bool
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
NSDictionary
*
)
getEmptyMap
{
+
(
nonnull
NSDictionary
*
)
getEmptyMap
{
try
{
auto
r
=
::
TestHelpers
::
get_empty_map
();
return
::
djinni
::
Map
<::
djinni
::
String
,
::
djinni
::
I64
>::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
BOOL
)
checkEmptyMap
:(
NSDictionary
*
)
m
{
+
(
BOOL
)
checkEmptyMap
:(
nonnull
NSDictionary
*
)
m
{
try
{
auto
r
=
::
TestHelpers
::
check_empty_map
(
::
djinni
::
Map
<::
djinni
::
String
,
::
djinni
::
I64
>::
toCpp
(
m
));
return
::
djinni
::
Bool
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
DBMapListRecord
*
)
getMapListRecord
{
+
(
nonnull
DBMapListRecord
*
)
getMapListRecord
{
try
{
auto
r
=
::
TestHelpers
::
get_map_list_record
();
return
::
djinni_generated
::
MapListRecord
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
BOOL
)
checkMapListRecord
:(
DBMapListRecord
*
)
m
{
+
(
BOOL
)
checkMapListRecord
:(
nonnull
DBMapListRecord
*
)
m
{
try
{
auto
r
=
::
TestHelpers
::
check_map_list_record
(
::
djinni_generated
::
MapListRecord
::
toCpp
(
m
));
return
::
djinni
::
Bool
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
void
)
checkClientInterfaceAscii
:(
id
<
DBClientInterface
>
)
i
{
+
(
void
)
checkClientInterfaceAscii
:(
nullable
id
<
DBClientInterface
>
)
i
{
try
{
::
TestHelpers
::
check_client_interface_ascii
(
::
djinni_generated
::
ClientInterface
::
toCpp
(
i
));
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
void
)
checkClientInterfaceNonascii
:(
id
<
DBClientInterface
>
)
i
{
+
(
void
)
checkClientInterfaceNonascii
:(
nullable
id
<
DBClientInterface
>
)
i
{
try
{
::
TestHelpers
::
check_client_interface_nonascii
(
::
djinni_generated
::
ClientInterface
::
toCpp
(
i
));
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
void
)
checkEnumMap
:(
NSDictionary
*
)
m
{
+
(
void
)
checkEnumMap
:(
nonnull
NSDictionary
*
)
m
{
try
{
::
TestHelpers
::
check_enum_map
(
::
djinni
::
Map
<::
djinni
::
Enum
<::
color
,
DBColor
>
,
::
djinni
::
String
>::
toCpp
(
m
));
}
DJINNI_TRANSLATE_EXCEPTIONS
()
...
...
@@ -163,41 +163,41 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
DBToken
*
)
tokenId
:(
DBToken
*
)
t
{
+
(
nullable
DBToken
*
)
tokenId
:(
nullable
DBToken
*
)
t
{
try
{
auto
r
=
::
TestHelpers
::
token_id
(
::
djinni_generated
::
Token
::
toCpp
(
t
));
return
::
djinni_generated
::
Token
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
DBToken
*
)
createCppToken
{
+
(
nullable
DBToken
*
)
createCppToken
{
try
{
auto
r
=
::
TestHelpers
::
create_cpp_token
();
return
::
djinni_generated
::
Token
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
void
)
checkCppToken
:(
DBToken
*
)
t
{
+
(
void
)
checkCppToken
:(
nullable
DBToken
*
)
t
{
try
{
::
TestHelpers
::
check_cpp_token
(
::
djinni_generated
::
Token
::
toCpp
(
t
));
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
int64_t
)
cppTokenId
:(
DBToken
*
)
t
{
+
(
int64_t
)
cppTokenId
:(
nullable
DBToken
*
)
t
{
try
{
auto
r
=
::
TestHelpers
::
cpp_token_id
(
::
djinni_generated
::
Token
::
toCpp
(
t
));
return
::
djinni
::
I64
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
NSNumber
*
)
returnNone
{
+
(
nullable
NSNumber
*
)
returnNone
{
try
{
auto
r
=
::
TestHelpers
::
return_none
();
return
::
djinni
::
Optional
<
std
::
experimental
::
optional
,
::
djinni
::
I32
>::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
DBAssortedIntegers
*
)
assortedIntegersId
:(
DBAssortedIntegers
*
)
i
{
+
(
nonnull
DBAssortedIntegers
*
)
assortedIntegersId
:(
nonnull
DBAssortedIntegers
*
)
i
{
try
{
auto
r
=
::
TestHelpers
::
assorted_integers_id
(
::
djinni_generated
::
AssortedIntegers
::
toCpp
(
i
));
return
::
djinni_generated
::
AssortedIntegers
::
fromCpp
(
r
);
...
...
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