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
b0a4bf54
Commit
b0a4bf54
authored
Jan 22, 2015
by
Damien DeVille
Committed by
Jacob Potter
Jan 22, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change djinni objc generator to generate immutable collections
parent
c4171880
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
100 additions
and
78 deletions
+100
-78
src/source/ObjcGenerator.scala
src/source/ObjcGenerator.scala
+21
-15
test-suite/generated-src/objc/DBMapListRecord.h
test-suite/generated-src/objc/DBMapListRecord.h
+2
-2
test-suite/generated-src/objc/DBMapListRecord.mm
test-suite/generated-src/objc/DBMapListRecord.mm
+15
-11
test-suite/generated-src/objc/DBMapRecord.h
test-suite/generated-src/objc/DBMapRecord.h
+2
-2
test-suite/generated-src/objc/DBMapRecord.mm
test-suite/generated-src/objc/DBMapRecord.mm
+7
-5
test-suite/generated-src/objc/DBNestedCollection.h
test-suite/generated-src/objc/DBNestedCollection.h
+2
-2
test-suite/generated-src/objc/DBNestedCollection.mm
test-suite/generated-src/objc/DBNestedCollection.mm
+15
-11
test-suite/generated-src/objc/DBPrimitiveList.h
test-suite/generated-src/objc/DBPrimitiveList.h
+2
-2
test-suite/generated-src/objc/DBPrimitiveList.mm
test-suite/generated-src/objc/DBPrimitiveList.mm
+7
-5
test-suite/generated-src/objc/DBSetRecord.h
test-suite/generated-src/objc/DBSetRecord.h
+2
-2
test-suite/generated-src/objc/DBSetRecord.mm
test-suite/generated-src/objc/DBSetRecord.mm
+7
-5
test-suite/generated-src/objc/DBTestHelpers.h
test-suite/generated-src/objc/DBTestHelpers.h
+5
-5
test-suite/generated-src/objc/DBTestHelpersCppProxy.mm
test-suite/generated-src/objc/DBTestHelpersCppProxy.mm
+11
-9
test-suite/handwritten-src/objc/tests/DBMapRecordTests.mm
test-suite/handwritten-src/objc/tests/DBMapRecordTests.mm
+2
-2
No files found.
src/source/ObjcGenerator.scala
View file @
b0a4bf54
...
@@ -641,25 +641,27 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
...
@@ -641,25 +641,27 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
case
MList
=>
{
case
MList
=>
{
val
copyName
=
"copiedValue_"
+
valueLevel
val
copyName
=
"copiedValue_"
+
valueLevel
val
currentName
=
"currentValue_"
+
valueLevel
val
currentName
=
"currentValue_"
+
valueLevel
w
.
wl
(
s
"
$to
= [NSMutableArray arrayWithCapacity:[$from count]];"
)
w
.
wl
(
s
"
NSMutableArray *${to}TempArray
= [NSMutableArray arrayWithCapacity:[$from count]];"
)
w
.
w
(
s
"for (${toObjcTypeDef(tm.args.head, true)}$currentName in $from)"
).
braced
{
w
.
w
(
s
"for (${toObjcTypeDef(tm.args.head, true)}$currentName in $from)"
).
braced
{
w
.
wl
(
s
"id $copyName;"
)
w
.
wl
(
s
"id $copyName;"
)
f
(
copyName
,
currentName
,
tm
.
args
.
head
,
true
,
w
,
valueLevel
+
1
)
f
(
copyName
,
currentName
,
tm
.
args
.
head
,
true
,
w
,
valueLevel
+
1
)
w
.
wl
(
s
"[$
to
addObject:$copyName];"
)
w
.
wl
(
s
"[$
{to}TempArray
addObject:$copyName];"
)
}
}
w
.
wl
(
s
"$to = ${to}TempArray;"
)
}
}
case
MSet
=>
{
case
MSet
=>
{
val
copyName
=
"copiedValue_"
+
valueLevel
val
copyName
=
"copiedValue_"
+
valueLevel
val
currentName
=
"currentValue_"
+
valueLevel
val
currentName
=
"currentValue_"
+
valueLevel
w
.
wl
(
s
"
$to
= [NSMutableSet setWithCapacity:[$from count]];"
)
w
.
wl
(
s
"
NSMutableSet *${to}TempSet
= [NSMutableSet setWithCapacity:[$from count]];"
)
w
.
w
(
s
"for (${toObjcTypeDef(tm.args.head, true)}$currentName in $from)"
).
braced
{
w
.
w
(
s
"for (${toObjcTypeDef(tm.args.head, true)}$currentName in $from)"
).
braced
{
w
.
wl
(
s
"id $copyName;"
)
w
.
wl
(
s
"id $copyName;"
)
f
(
copyName
,
currentName
,
tm
.
args
.
head
,
true
,
w
,
valueLevel
+
1
)
f
(
copyName
,
currentName
,
tm
.
args
.
head
,
true
,
w
,
valueLevel
+
1
)
w
.
wl
(
s
"[$
to
addObject:$copyName];"
)
w
.
wl
(
s
"[$
{to}TempSet
addObject:$copyName];"
)
}
}
w
.
wl
(
s
"$to = ${to}TempSet;"
)
}
}
case
MMap
=>
{
case
MMap
=>
{
w
.
wl
(
s
"
$to
= [NSMutableDictionary dictionaryWithCapacity:[$from count]];"
)
w
.
wl
(
s
"
NSMutableDictionary *${to}TempDictionary
= [NSMutableDictionary dictionaryWithCapacity:[$from count]];"
)
val
keyName
=
"key_"
+
valueLevel
val
keyName
=
"key_"
+
valueLevel
val
valueName
=
"value_"
+
valueLevel
val
valueName
=
"value_"
+
valueLevel
val
copiedKeyName
=
"copiedKey_"
+
valueLevel
val
copiedKeyName
=
"copiedKey_"
+
valueLevel
...
@@ -669,8 +671,9 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
...
@@ -669,8 +671,9 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
f
(
copiedKeyName
,
keyName
,
tm
.
args
.
apply
(
0
),
true
,
w
,
valueLevel
+
1
)
f
(
copiedKeyName
,
keyName
,
tm
.
args
.
apply
(
0
),
true
,
w
,
valueLevel
+
1
)
w
.
wl
(
s
"id $valueName = [$from objectForKey:$keyName];"
)
w
.
wl
(
s
"id $valueName = [$from objectForKey:$keyName];"
)
f
(
copiedValueName
,
valueName
,
tm
.
args
.
apply
(
1
),
true
,
w
,
valueLevel
+
1
)
f
(
copiedValueName
,
valueName
,
tm
.
args
.
apply
(
1
),
true
,
w
,
valueLevel
+
1
)
w
.
wl
(
s
"[$
to
setObject:$copiedValueName forKey:$copiedKeyName];"
)
w
.
wl
(
s
"[$
{to}TempDictionary
setObject:$copiedValueName forKey:$copiedKeyName];"
)
}
}
w
.
wl
(
s
"$to = ${to}TempDictionary;"
)
}
}
case
d
:
MDef
=>
{
case
d
:
MDef
=>
{
val
typeName
=
d
.
name
val
typeName
=
d
.
name
...
@@ -737,31 +740,34 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
...
@@ -737,31 +740,34 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
case
MList
=>
case
MList
=>
val
objcName
=
"objcValue_"
+
valueLevel
val
objcName
=
"objcValue_"
+
valueLevel
val
cppName
=
"cppValue_"
+
valueLevel
val
cppName
=
"cppValue_"
+
valueLevel
w
.
wl
(
s
"
$objcType$objcIdent
= [NSMutableArray arrayWithCapacity:${cppIdent}.size()];"
)
w
.
wl
(
s
"
NSMutableArray *${objcIdent}TempArray
= [NSMutableArray arrayWithCapacity:${cppIdent}.size()];"
)
w
.
w
(
s
"for (const auto & $cppName : ${cppIdent})"
)
w
.
w
(
s
"for (const auto & $cppName : ${cppIdent})"
)
w
.
braced
{
w
.
braced
{
f
(
objcName
,
cppName
,
tm
.
args
.
head
,
true
,
true
,
w
,
valueLevel
+
1
)
f
(
objcName
,
cppName
,
tm
.
args
.
head
,
true
,
true
,
w
,
valueLevel
+
1
)
w
.
wl
(
s
"[$
objcIdent
addObject:$objcName];"
)
w
.
wl
(
s
"[$
{objcIdent}TempArray
addObject:$objcName];"
)
}
}
w
.
wl
(
s
"$objcType$objcIdent = ${objcIdent}TempArray;"
)
case
MSet
=>
case
MSet
=>
val
objcName
=
"objcValue_"
+
valueLevel
val
objcName
=
"objcValue_"
+
valueLevel
val
cppName
=
"cppValue_"
+
valueLevel
val
cppName
=
"cppValue_"
+
valueLevel
w
.
wl
(
s
"
$objcType$objcIden
t = [NSMutableSet setWithCapacity:${cppIdent}.size()];"
)
w
.
wl
(
s
"
NSMutableSet *${objcIdent}TempSe
t = [NSMutableSet setWithCapacity:${cppIdent}.size()];"
)
w
.
w
(
s
"for (const auto & $cppName : ${cppIdent})"
)
w
.
w
(
s
"for (const auto & $cppName : ${cppIdent})"
)
w
.
braced
{
w
.
braced
{
f
(
objcName
,
cppName
,
tm
.
args
.
head
,
true
,
true
,
w
,
valueLevel
+
1
)
f
(
objcName
,
cppName
,
tm
.
args
.
head
,
true
,
true
,
w
,
valueLevel
+
1
)
w
.
wl
(
s
"[$
objcIden
t addObject:$objcName];"
)
w
.
wl
(
s
"[$
{objcIdent}TempSe
t addObject:$objcName];"
)
}
}
w
.
wl
(
s
"$objcType$objcIdent = ${objcIdent}TempSet;"
)
case
MMap
=>
{
case
MMap
=>
{
val
cppPairName
=
"cppPair_"
+
valueLevel
val
cppPairName
=
"cppPair_"
+
valueLevel
val
objcKeyName
=
"objcKey_"
+
valueLevel
val
objcKeyName
=
"objcKey_"
+
valueLevel
val
objcValueName
=
"objcValue_"
+
valueLevel
val
objcValueName
=
"objcValue_"
+
valueLevel
w
.
wl
(
s
"
$objcType$objcIdent
= [NSMutableDictionary dictionaryWithCapacity:${cppIdent}.size()];"
)
w
.
wl
(
s
"
NSMutableDictionary *${objcIdent}TempDictionary
= [NSMutableDictionary dictionaryWithCapacity:${cppIdent}.size()];"
)
w
.
w
(
s
"for (const auto & $cppPairName : ${cppIdent})"
).
braced
{
w
.
w
(
s
"for (const auto & $cppPairName : ${cppIdent})"
).
braced
{
f
(
objcKeyName
,
cppPairName
+
".first"
,
tm
.
args
.
apply
(
0
),
true
,
true
,
w
,
valueLevel
+
1
)
f
(
objcKeyName
,
cppPairName
+
".first"
,
tm
.
args
.
apply
(
0
),
true
,
true
,
w
,
valueLevel
+
1
)
f
(
objcValueName
,
cppPairName
+
".second"
,
tm
.
args
.
apply
(
1
),
true
,
true
,
w
,
valueLevel
+
1
)
f
(
objcValueName
,
cppPairName
+
".second"
,
tm
.
args
.
apply
(
1
),
true
,
true
,
w
,
valueLevel
+
1
)
w
.
wl
(
s
"[$
objcIdent
setObject:$objcValueName forKey:$objcKeyName];"
)
w
.
wl
(
s
"[$
{objcIdent}TempDictionary
setObject:$objcValueName forKey:$objcKeyName];"
)
}
}
w
.
wl
(
s
"$objcType$objcIdent = ${objcIdent}TempDictionary;"
)
}
}
case
d
:
MDef
=>
{
case
d
:
MDef
=>
{
val
typeName
=
d
.
name
val
typeName
=
d
.
name
...
@@ -909,9 +915,9 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
...
@@ -909,9 +915,9 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
case
MString
=>
(
"NSString"
,
true
)
case
MString
=>
(
"NSString"
,
true
)
case
MBinary
=>
(
"NSData"
,
true
)
case
MBinary
=>
(
"NSData"
,
true
)
case
MOptional
=>
throw
new
AssertionError
(
"optional should have been special cased"
)
case
MOptional
=>
throw
new
AssertionError
(
"optional should have been special cased"
)
case
MList
=>
(
"NS
Mutable
Array"
,
true
)
case
MList
=>
(
"NSArray"
,
true
)
case
MSet
=>
(
"NS
Mutable
Set"
,
true
)
case
MSet
=>
(
"NSSet"
,
true
)
case
MMap
=>
(
"NS
Mutable
Dictionary"
,
true
)
case
MMap
=>
(
"NSDictionary"
,
true
)
case
d
:
MDef
=>
d
.
defType
match
{
case
d
:
MDef
=>
d
.
defType
match
{
case
DEnum
=>
if
(
needRef
)
(
"NSNumber"
,
true
)
else
(
idObjc
.
ty
(
d
.
name
),
false
)
case
DEnum
=>
if
(
needRef
)
(
"NSNumber"
,
true
)
else
(
idObjc
.
ty
(
d
.
name
),
false
)
case
DRecord
=>
(
idObjc
.
ty
(
d
.
name
),
true
)
case
DRecord
=>
(
idObjc
.
ty
(
d
.
name
),
true
)
...
...
test-suite/generated-src/objc/DBMapListRecord.h
View file @
b0a4bf54
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
@interface
DBMapListRecord
:
NSObject
@interface
DBMapListRecord
:
NSObject
-
(
id
)
initWithMapListRecord
:(
DBMapListRecord
*
)
mapListRecord
;
-
(
id
)
initWithMapListRecord
:(
DBMapListRecord
*
)
mapListRecord
;
-
(
id
)
initWithMapList
:(
NS
Mutable
Array
*
)
mapList
;
-
(
id
)
initWithMapList
:(
NSArray
*
)
mapList
;
@property
(
nonatomic
,
readonly
)
NS
Mutable
Array
*
mapList
;
@property
(
nonatomic
,
readonly
)
NSArray
*
mapList
;
@end
@end
test-suite/generated-src/objc/DBMapListRecord.mm
View file @
b0a4bf54
...
@@ -12,24 +12,26 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -12,24 +12,26 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
-
(
id
)
initWithMapListRecord
:(
DBMapListRecord
*
)
mapListRecord
-
(
id
)
initWithMapListRecord
:(
DBMapListRecord
*
)
mapListRecord
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_mapList
=
[
NSMutableArray
arrayWithCapacity
:[
mapListRecord
.
mapList
count
]];
NSMutableArray
*
_mapListTempArray
=
[
NSMutableArray
arrayWithCapacity
:[
mapListRecord
.
mapList
count
]];
for
(
NS
Mutable
Dictionary
*
currentValue_0
in
mapListRecord
.
mapList
)
{
for
(
NSDictionary
*
currentValue_0
in
mapListRecord
.
mapList
)
{
id
copiedValue_0
;
id
copiedValue_0
;
copiedValue_0
=
[
NSMutableDictionary
dictionaryWithCapacity
:[
currentValue_0
count
]];
NSMutableDictionary
*
copiedValue_0TempDictionary
=
[
NSMutableDictionary
dictionaryWithCapacity
:[
currentValue_0
count
]];
for
(
id
key_1
in
currentValue_0
)
{
for
(
id
key_1
in
currentValue_0
)
{
id
copiedKey_1
,
copiedValue_1
;
id
copiedKey_1
,
copiedValue_1
;
copiedKey_1
=
[
key_1
copy
];
copiedKey_1
=
[
key_1
copy
];
id
value_1
=
[
currentValue_0
objectForKey
:
key_1
];
id
value_1
=
[
currentValue_0
objectForKey
:
key_1
];
copiedValue_1
=
value_1
;
copiedValue_1
=
value_1
;
[
copiedValue_0
setObject
:
copiedValue_1
forKey
:
copiedKey_1
];
[
copiedValue_0
TempDictionary
setObject
:
copiedValue_1
forKey
:
copiedKey_1
];
}
}
[
_mapList
addObject
:
copiedValue_0
];
copiedValue_0
=
copiedValue_0TempDictionary
;
[
_mapListTempArray
addObject
:
copiedValue_0
];
}
}
_mapList
=
_mapListTempArray
;
}
}
return
self
;
return
self
;
}
}
-
(
id
)
initWithMapList
:(
NS
Mutable
Array
*
)
mapList
-
(
id
)
initWithMapList
:(
NSArray
*
)
mapList
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_mapList
=
mapList
;
_mapList
=
mapList
;
...
@@ -40,18 +42,20 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -40,18 +42,20 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
-
(
id
)
initWithCppMapListRecord
:(
const
MapListRecord
&
)
mapListRecord
-
(
id
)
initWithCppMapListRecord
:(
const
MapListRecord
&
)
mapListRecord
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_mapList
=
[
NSMutableArray
arrayWithCapacity
:
mapListRecord
.
map_list
.
size
()];
NSMutableArray
*
_mapListTempArray
=
[
NSMutableArray
arrayWithCapacity
:
mapListRecord
.
map_list
.
size
()];
for
(
const
auto
&
cppValue_0
:
mapListRecord
.
map_list
)
{
for
(
const
auto
&
cppValue_0
:
mapListRecord
.
map_list
)
{
NSMutableDictionary
*
objcValue_0
=
[
NSMutableDictionary
dictionaryWithCapacity
:
cppValue_0
.
size
()];
NSMutableDictionary
*
objcValue_0
TempDictionary
=
[
NSMutableDictionary
dictionaryWithCapacity
:
cppValue_0
.
size
()];
for
(
const
auto
&
cppPair_1
:
cppValue_0
)
{
for
(
const
auto
&
cppPair_1
:
cppValue_0
)
{
NSString
*
objcKey_1
=
[[
NSString
alloc
]
initWithBytes
:
cppPair_1
.
first
.
data
()
NSString
*
objcKey_1
=
[[
NSString
alloc
]
initWithBytes
:
cppPair_1
.
first
.
data
()
length:
cppPair_1
.
first
.
length
()
length:
cppPair_1
.
first
.
length
()
encoding:
NSUTF8StringEncoding
];
encoding:
NSUTF8StringEncoding
];
NSNumber
*
objcValue_1
=
[
NSNumber
numberWithLongLong
:
cppPair_1
.
second
];
NSNumber
*
objcValue_1
=
[
NSNumber
numberWithLongLong
:
cppPair_1
.
second
];
[
objcValue_0
setObject
:
objcValue_1
forKey
:
objcKey_1
];
[
objcValue_0
TempDictionary
setObject
:
objcValue_1
forKey
:
objcKey_1
];
}
}
[
_mapList
addObject
:
objcValue_0
];
NSDictionary
*
objcValue_0
=
objcValue_0TempDictionary
;
[
_mapListTempArray
addObject
:
objcValue_0
];
}
}
_mapList
=
_mapListTempArray
;
}
}
return
self
;
return
self
;
}
}
...
@@ -60,7 +64,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -60,7 +64,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
{
{
std
::
vector
<
std
::
unordered_map
<
std
::
string
,
int64_t
>>
mapList
;
std
::
vector
<
std
::
unordered_map
<
std
::
string
,
int64_t
>>
mapList
;
mapList
.
reserve
([
_mapList
count
]);
mapList
.
reserve
([
_mapList
count
]);
for
(
NS
Mutable
Dictionary
*
objcValue_0
in
_mapList
)
{
for
(
NSDictionary
*
objcValue_0
in
_mapList
)
{
std
::
unordered_map
<
std
::
string
,
int64_t
>
cppValue_0
;
std
::
unordered_map
<
std
::
string
,
int64_t
>
cppValue_0
;
for
(
id
objcKey_1
in
objcValue_0
)
{
for
(
id
objcKey_1
in
objcValue_0
)
{
std
::
string
cppKey_1
([
objcKey_1
UTF8String
],
[
objcKey_1
lengthOfBytesUsingEncoding
:
NSUTF8StringEncoding
]);
std
::
string
cppKey_1
([
objcKey_1
UTF8String
],
[
objcKey_1
lengthOfBytesUsingEncoding
:
NSUTF8StringEncoding
]);
...
...
test-suite/generated-src/objc/DBMapRecord.h
View file @
b0a4bf54
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
@interface
DBMapRecord
:
NSObject
@interface
DBMapRecord
:
NSObject
-
(
id
)
initWithMapRecord
:(
DBMapRecord
*
)
mapRecord
;
-
(
id
)
initWithMapRecord
:(
DBMapRecord
*
)
mapRecord
;
-
(
id
)
initWithMap
:(
NS
Mutable
Dictionary
*
)
map
;
-
(
id
)
initWithMap
:(
NSDictionary
*
)
map
;
@property
(
nonatomic
,
readonly
)
NS
Mutable
Dictionary
*
map
;
@property
(
nonatomic
,
readonly
)
NSDictionary
*
map
;
@end
@end
test-suite/generated-src/objc/DBMapRecord.mm
View file @
b0a4bf54
...
@@ -12,19 +12,20 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -12,19 +12,20 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
-
(
id
)
initWithMapRecord
:(
DBMapRecord
*
)
mapRecord
-
(
id
)
initWithMapRecord
:(
DBMapRecord
*
)
mapRecord
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_map
=
[
NSMutableDictionary
dictionaryWithCapacity
:[
mapRecord
.
map
count
]];
NSMutableDictionary
*
_mapTempDictionary
=
[
NSMutableDictionary
dictionaryWithCapacity
:[
mapRecord
.
map
count
]];
for
(
id
key_0
in
mapRecord
.
map
)
{
for
(
id
key_0
in
mapRecord
.
map
)
{
id
copiedKey_0
,
copiedValue_0
;
id
copiedKey_0
,
copiedValue_0
;
copiedKey_0
=
[
key_0
copy
];
copiedKey_0
=
[
key_0
copy
];
id
value_0
=
[
mapRecord
.
map
objectForKey
:
key_0
];
id
value_0
=
[
mapRecord
.
map
objectForKey
:
key_0
];
copiedValue_0
=
value_0
;
copiedValue_0
=
value_0
;
[
_map
setObject
:
copiedValue_0
forKey
:
copiedKey_0
];
[
_map
TempDictionary
setObject
:
copiedValue_0
forKey
:
copiedKey_0
];
}
}
_map
=
_mapTempDictionary
;
}
}
return
self
;
return
self
;
}
}
-
(
id
)
initWithMap
:(
NS
Mutable
Dictionary
*
)
map
-
(
id
)
initWithMap
:(
NSDictionary
*
)
map
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_map
=
map
;
_map
=
map
;
...
@@ -35,14 +36,15 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -35,14 +36,15 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
-
(
id
)
initWithCppMapRecord
:(
const
MapRecord
&
)
mapRecord
-
(
id
)
initWithCppMapRecord
:(
const
MapRecord
&
)
mapRecord
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_map
=
[
NSMutableDictionary
dictionaryWithCapacity
:
mapRecord
.
map
.
size
()];
NSMutableDictionary
*
_mapTempDictionary
=
[
NSMutableDictionary
dictionaryWithCapacity
:
mapRecord
.
map
.
size
()];
for
(
const
auto
&
cppPair_0
:
mapRecord
.
map
)
{
for
(
const
auto
&
cppPair_0
:
mapRecord
.
map
)
{
NSString
*
objcKey_0
=
[[
NSString
alloc
]
initWithBytes
:
cppPair_0
.
first
.
data
()
NSString
*
objcKey_0
=
[[
NSString
alloc
]
initWithBytes
:
cppPair_0
.
first
.
data
()
length:
cppPair_0
.
first
.
length
()
length:
cppPair_0
.
first
.
length
()
encoding:
NSUTF8StringEncoding
];
encoding:
NSUTF8StringEncoding
];
NSNumber
*
objcValue_0
=
[
NSNumber
numberWithLongLong
:
cppPair_0
.
second
];
NSNumber
*
objcValue_0
=
[
NSNumber
numberWithLongLong
:
cppPair_0
.
second
];
[
_map
setObject
:
objcValue_0
forKey
:
objcKey_0
];
[
_map
TempDictionary
setObject
:
objcValue_0
forKey
:
objcKey_0
];
}
}
_map
=
_mapTempDictionary
;
}
}
return
self
;
return
self
;
}
}
...
...
test-suite/generated-src/objc/DBNestedCollection.h
View file @
b0a4bf54
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
@interface
DBNestedCollection
:
NSObject
@interface
DBNestedCollection
:
NSObject
-
(
id
)
initWithNestedCollection
:(
DBNestedCollection
*
)
nestedCollection
;
-
(
id
)
initWithNestedCollection
:(
DBNestedCollection
*
)
nestedCollection
;
-
(
id
)
initWithSetList
:(
NS
Mutable
Array
*
)
setList
;
-
(
id
)
initWithSetList
:(
NSArray
*
)
setList
;
@property
(
nonatomic
,
readonly
)
NS
Mutable
Array
*
setList
;
@property
(
nonatomic
,
readonly
)
NSArray
*
setList
;
@end
@end
test-suite/generated-src/objc/DBNestedCollection.mm
View file @
b0a4bf54
...
@@ -12,22 +12,24 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -12,22 +12,24 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
-
(
id
)
initWithNestedCollection
:(
DBNestedCollection
*
)
nestedCollection
-
(
id
)
initWithNestedCollection
:(
DBNestedCollection
*
)
nestedCollection
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_setList
=
[
NSMutableArray
arrayWithCapacity
:[
nestedCollection
.
setList
count
]];
NSMutableArray
*
_setListTempArray
=
[
NSMutableArray
arrayWithCapacity
:[
nestedCollection
.
setList
count
]];
for
(
NS
Mutable
Set
*
currentValue_0
in
nestedCollection
.
setList
)
{
for
(
NSSet
*
currentValue_0
in
nestedCollection
.
setList
)
{
id
copiedValue_0
;
id
copiedValue_0
;
copiedValue_0
=
[
NSMutableSet
setWithCapacity
:[
currentValue_0
count
]];
NSMutableSet
*
copiedValue_0TempSet
=
[
NSMutableSet
setWithCapacity
:[
currentValue_0
count
]];
for
(
NSString
*
currentValue_1
in
currentValue_0
)
{
for
(
NSString
*
currentValue_1
in
currentValue_0
)
{
id
copiedValue_1
;
id
copiedValue_1
;
copiedValue_1
=
[
currentValue_1
copy
];
copiedValue_1
=
[
currentValue_1
copy
];
[
copiedValue_0
addObject
:
copiedValue_1
];
[
copiedValue_0
TempSet
addObject
:
copiedValue_1
];
}
}
[
_setList
addObject
:
copiedValue_0
];
copiedValue_0
=
copiedValue_0TempSet
;
[
_setListTempArray
addObject
:
copiedValue_0
];
}
}
_setList
=
_setListTempArray
;
}
}
return
self
;
return
self
;
}
}
-
(
id
)
initWithSetList
:(
NS
Mutable
Array
*
)
setList
-
(
id
)
initWithSetList
:(
NSArray
*
)
setList
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_setList
=
setList
;
_setList
=
setList
;
...
@@ -38,17 +40,19 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -38,17 +40,19 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
-
(
id
)
initWithCppNestedCollection
:(
const
NestedCollection
&
)
nestedCollection
-
(
id
)
initWithCppNestedCollection
:(
const
NestedCollection
&
)
nestedCollection
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_setList
=
[
NSMutableArray
arrayWithCapacity
:
nestedCollection
.
set_list
.
size
()];
NSMutableArray
*
_setListTempArray
=
[
NSMutableArray
arrayWithCapacity
:
nestedCollection
.
set_list
.
size
()];
for
(
const
auto
&
cppValue_0
:
nestedCollection
.
set_list
)
{
for
(
const
auto
&
cppValue_0
:
nestedCollection
.
set_list
)
{
NSMutableSet
*
objcValue_0
=
[
NSMutableSet
setWithCapacity
:
cppValue_0
.
size
()];
NSMutableSet
*
objcValue_0
TempSet
=
[
NSMutableSet
setWithCapacity
:
cppValue_0
.
size
()];
for
(
const
auto
&
cppValue_1
:
cppValue_0
)
{
for
(
const
auto
&
cppValue_1
:
cppValue_0
)
{
NSString
*
objcValue_1
=
[[
NSString
alloc
]
initWithBytes
:
cppValue_1
.
data
()
NSString
*
objcValue_1
=
[[
NSString
alloc
]
initWithBytes
:
cppValue_1
.
data
()
length:
cppValue_1
.
length
()
length:
cppValue_1
.
length
()
encoding:
NSUTF8StringEncoding
];
encoding:
NSUTF8StringEncoding
];
[
objcValue_0
addObject
:
objcValue_1
];
[
objcValue_0
TempSet
addObject
:
objcValue_1
];
}
}
[
_setList
addObject
:
objcValue_0
];
NSSet
*
objcValue_0
=
objcValue_0TempSet
;
[
_setListTempArray
addObject
:
objcValue_0
];
}
}
_setList
=
_setListTempArray
;
}
}
return
self
;
return
self
;
}
}
...
@@ -57,7 +61,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -57,7 +61,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
{
{
std
::
vector
<
std
::
unordered_set
<
std
::
string
>>
setList
;
std
::
vector
<
std
::
unordered_set
<
std
::
string
>>
setList
;
setList
.
reserve
([
_setList
count
]);
setList
.
reserve
([
_setList
count
]);
for
(
NS
Mutable
Set
*
objcValue_0
in
_setList
)
{
for
(
NSSet
*
objcValue_0
in
_setList
)
{
std
::
unordered_set
<
std
::
string
>
cppValue_0
;
std
::
unordered_set
<
std
::
string
>
cppValue_0
;
for
(
NSString
*
objcValue_1
in
objcValue_0
)
{
for
(
NSString
*
objcValue_1
in
objcValue_0
)
{
std
::
string
cppValue_1
([
objcValue_1
UTF8String
],
[
objcValue_1
lengthOfBytesUsingEncoding
:
NSUTF8StringEncoding
]);
std
::
string
cppValue_1
([
objcValue_1
UTF8String
],
[
objcValue_1
lengthOfBytesUsingEncoding
:
NSUTF8StringEncoding
]);
...
...
test-suite/generated-src/objc/DBPrimitiveList.h
View file @
b0a4bf54
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
@interface
DBPrimitiveList
:
NSObject
@interface
DBPrimitiveList
:
NSObject
-
(
id
)
initWithPrimitiveList
:(
DBPrimitiveList
*
)
primitiveList
;
-
(
id
)
initWithPrimitiveList
:(
DBPrimitiveList
*
)
primitiveList
;
-
(
id
)
initWithList
:(
NS
Mutable
Array
*
)
list
;
-
(
id
)
initWithList
:(
NSArray
*
)
list
;
@property
(
nonatomic
,
readonly
)
NS
Mutable
Array
*
list
;
@property
(
nonatomic
,
readonly
)
NSArray
*
list
;
@end
@end
test-suite/generated-src/objc/DBPrimitiveList.mm
View file @
b0a4bf54
...
@@ -12,17 +12,18 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -12,17 +12,18 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
-
(
id
)
initWithPrimitiveList
:(
DBPrimitiveList
*
)
primitiveList
-
(
id
)
initWithPrimitiveList
:(
DBPrimitiveList
*
)
primitiveList
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_list
=
[
NSMutableArray
arrayWithCapacity
:[
primitiveList
.
list
count
]];
NSMutableArray
*
_listTempArray
=
[
NSMutableArray
arrayWithCapacity
:[
primitiveList
.
list
count
]];
for
(
NSNumber
*
currentValue_0
in
primitiveList
.
list
)
{
for
(
NSNumber
*
currentValue_0
in
primitiveList
.
list
)
{
id
copiedValue_0
;
id
copiedValue_0
;
copiedValue_0
=
currentValue_0
;
copiedValue_0
=
currentValue_0
;
[
_list
addObject
:
copiedValue_0
];
[
_list
TempArray
addObject
:
copiedValue_0
];
}
}
_list
=
_listTempArray
;
}
}
return
self
;
return
self
;
}
}
-
(
id
)
initWithList
:(
NS
Mutable
Array
*
)
list
-
(
id
)
initWithList
:(
NSArray
*
)
list
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_list
=
list
;
_list
=
list
;
...
@@ -33,11 +34,12 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -33,11 +34,12 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
-
(
id
)
initWithCppPrimitiveList
:(
const
PrimitiveList
&
)
primitiveList
-
(
id
)
initWithCppPrimitiveList
:(
const
PrimitiveList
&
)
primitiveList
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_list
=
[
NSMutableArray
arrayWithCapacity
:
primitiveList
.
list
.
size
()];
NSMutableArray
*
_listTempArray
=
[
NSMutableArray
arrayWithCapacity
:
primitiveList
.
list
.
size
()];
for
(
const
auto
&
cppValue_0
:
primitiveList
.
list
)
{
for
(
const
auto
&
cppValue_0
:
primitiveList
.
list
)
{
NSNumber
*
objcValue_0
=
[
NSNumber
numberWithLongLong
:
cppValue_0
];
NSNumber
*
objcValue_0
=
[
NSNumber
numberWithLongLong
:
cppValue_0
];
[
_list
addObject
:
objcValue_0
];
[
_list
TempArray
addObject
:
objcValue_0
];
}
}
_list
=
_listTempArray
;
}
}
return
self
;
return
self
;
}
}
...
...
test-suite/generated-src/objc/DBSetRecord.h
View file @
b0a4bf54
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
@interface
DBSetRecord
:
NSObject
@interface
DBSetRecord
:
NSObject
-
(
id
)
initWithSetRecord
:(
DBSetRecord
*
)
setRecord
;
-
(
id
)
initWithSetRecord
:(
DBSetRecord
*
)
setRecord
;
-
(
id
)
initWithSet
:(
NS
Mutable
Set
*
)
set
;
-
(
id
)
initWithSet
:(
NSSet
*
)
set
;
@property
(
nonatomic
,
readonly
)
NS
Mutable
Set
*
set
;
@property
(
nonatomic
,
readonly
)
NSSet
*
set
;
@end
@end
test-suite/generated-src/objc/DBSetRecord.mm
View file @
b0a4bf54
...
@@ -12,17 +12,18 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -12,17 +12,18 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
-
(
id
)
initWithSetRecord
:(
DBSetRecord
*
)
setRecord
-
(
id
)
initWithSetRecord
:(
DBSetRecord
*
)
setRecord
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_s
et
=
[
NSMutableSet
setWithCapacity
:[
setRecord
.
set
count
]];
NSMutableSet
*
_setTempS
et
=
[
NSMutableSet
setWithCapacity
:[
setRecord
.
set
count
]];
for
(
NSString
*
currentValue_0
in
setRecord
.
set
)
{
for
(
NSString
*
currentValue_0
in
setRecord
.
set
)
{
id
copiedValue_0
;
id
copiedValue_0
;
copiedValue_0
=
[
currentValue_0
copy
];
copiedValue_0
=
[
currentValue_0
copy
];
[
_set
addObject
:
copiedValue_0
];
[
_set
TempSet
addObject
:
copiedValue_0
];
}
}
_set
=
_setTempSet
;
}
}
return
self
;
return
self
;
}
}
-
(
id
)
initWithSet
:(
NS
Mutable
Set
*
)
set
-
(
id
)
initWithSet
:(
NSSet
*
)
set
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_set
=
set
;
_set
=
set
;
...
@@ -33,13 +34,14 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -33,13 +34,14 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
-
(
id
)
initWithCppSetRecord
:(
const
SetRecord
&
)
setRecord
-
(
id
)
initWithCppSetRecord
:(
const
SetRecord
&
)
setRecord
{
{
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
_s
et
=
[
NSMutableSet
setWithCapacity
:
setRecord
.
set
.
size
()];
NSMutableSet
*
_setTempS
et
=
[
NSMutableSet
setWithCapacity
:
setRecord
.
set
.
size
()];
for
(
const
auto
&
cppValue_0
:
setRecord
.
set
)
{
for
(
const
auto
&
cppValue_0
:
setRecord
.
set
)
{
NSString
*
objcValue_0
=
[[
NSString
alloc
]
initWithBytes
:
cppValue_0
.
data
()
NSString
*
objcValue_0
=
[[
NSString
alloc
]
initWithBytes
:
cppValue_0
.
data
()
length:
cppValue_0
.
length
()
length:
cppValue_0
.
length
()
encoding:
NSUTF8StringEncoding
];
encoding:
NSUTF8StringEncoding
];
[
_set
addObject
:
objcValue_0
];
[
_set
TempSet
addObject
:
objcValue_0
];
}
}
_set
=
_setTempSet
;
}
}
return
self
;
return
self
;
}
}
...
...
test-suite/generated-src/objc/DBTestHelpers.h
View file @
b0a4bf54
...
@@ -26,13 +26,13 @@
...
@@ -26,13 +26,13 @@
+
(
BOOL
)
checkNestedCollection
:(
DBNestedCollection
*
)
nc
;
+
(
BOOL
)
checkNestedCollection
:(
DBNestedCollection
*
)
nc
;
+
(
NS
Mutable
Dictionary
*
)
getMap
;
+
(
NSDictionary
*
)
getMap
;
+
(
BOOL
)
checkMap
:(
NS
Mutable
Dictionary
*
)
m
;
+
(
BOOL
)
checkMap
:(
NSDictionary
*
)
m
;
+
(
NS
Mutable
Dictionary
*
)
getEmptyMap
;
+
(
NSDictionary
*
)
getEmptyMap
;
+
(
BOOL
)
checkEmptyMap
:(
NS
Mutable
Dictionary
*
)
m
;
+
(
BOOL
)
checkEmptyMap
:(
NSDictionary
*
)
m
;
+
(
DBMapListRecord
*
)
getMapListRecord
;
+
(
DBMapListRecord
*
)
getMapListRecord
;
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
+
(
void
)
checkClientInterfaceNonascii
:(
id
<
DBClientInterface
>
)
i
;
+
(
void
)
checkClientInterfaceNonascii
:(
id
<
DBClientInterface
>
)
i
;
+
(
void
)
checkEnumMap
:(
NS
Mutable
Dictionary
*
)
m
;
+
(
void
)
checkEnumMap
:(
NSDictionary
*
)
m
;
+
(
id
<
DBToken
>
)
tokenId
:(
id
<
DBToken
>
)
t
;
+
(
id
<
DBToken
>
)
tokenId
:(
id
<
DBToken
>
)
t
;
...
...
test-suite/generated-src/objc/DBTestHelpersCppProxy.mm
View file @
b0a4bf54
...
@@ -91,22 +91,23 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -91,22 +91,23 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
}
+
(
NS
Mutable
Dictionary
*
)
getMap
{
+
(
NSDictionary
*
)
getMap
{
try
{
try
{
std
::
unordered_map
<
std
::
string
,
int64_t
>
cppRet
=
TestHelpers
::
get_map
();
std
::
unordered_map
<
std
::
string
,
int64_t
>
cppRet
=
TestHelpers
::
get_map
();
NSMutableDictionary
*
objcRet
=
[
NSMutableDictionary
dictionaryWithCapacity
:
cppRet
.
size
()];
NSMutableDictionary
*
objcRet
TempDictionary
=
[
NSMutableDictionary
dictionaryWithCapacity
:
cppRet
.
size
()];
for
(
const
auto
&
cppPair_0
:
cppRet
)
{
for
(
const
auto
&
cppPair_0
:
cppRet
)
{
NSString
*
objcKey_0
=
[[
NSString
alloc
]
initWithBytes
:
cppPair_0
.
first
.
data
()
NSString
*
objcKey_0
=
[[
NSString
alloc
]
initWithBytes
:
cppPair_0
.
first
.
data
()
length:
cppPair_0
.
first
.
length
()
length:
cppPair_0
.
first
.
length
()
encoding:
NSUTF8StringEncoding
];
encoding:
NSUTF8StringEncoding
];
NSNumber
*
objcValue_0
=
[
NSNumber
numberWithLongLong
:
cppPair_0
.
second
];
NSNumber
*
objcValue_0
=
[
NSNumber
numberWithLongLong
:
cppPair_0
.
second
];
[
objcRet
setObject
:
objcValue_0
forKey
:
objcKey_0
];
[
objcRet
TempDictionary
setObject
:
objcValue_0
forKey
:
objcKey_0
];
}
}
NSDictionary
*
objcRet
=
objcRetTempDictionary
;
return
objcRet
;
return
objcRet
;
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
}
+
(
BOOL
)
checkMap
:(
NS
Mutable
Dictionary
*
)
m
{
+
(
BOOL
)
checkMap
:(
NSDictionary
*
)
m
{
try
{
try
{
std
::
unordered_map
<
std
::
string
,
int64_t
>
cppM
;
std
::
unordered_map
<
std
::
string
,
int64_t
>
cppM
;
for
(
id
objcKey_0
in
m
)
{
for
(
id
objcKey_0
in
m
)
{
...
@@ -120,22 +121,23 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -120,22 +121,23 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
}
+
(
NS
Mutable
Dictionary
*
)
getEmptyMap
{
+
(
NSDictionary
*
)
getEmptyMap
{
try
{
try
{
std
::
unordered_map
<
std
::
string
,
int64_t
>
cppRet
=
TestHelpers
::
get_empty_map
();
std
::
unordered_map
<
std
::
string
,
int64_t
>
cppRet
=
TestHelpers
::
get_empty_map
();
NSMutableDictionary
*
objcRet
=
[
NSMutableDictionary
dictionaryWithCapacity
:
cppRet
.
size
()];
NSMutableDictionary
*
objcRet
TempDictionary
=
[
NSMutableDictionary
dictionaryWithCapacity
:
cppRet
.
size
()];
for
(
const
auto
&
cppPair_0
:
cppRet
)
{
for
(
const
auto
&
cppPair_0
:
cppRet
)
{
NSString
*
objcKey_0
=
[[
NSString
alloc
]
initWithBytes
:
cppPair_0
.
first
.
data
()
NSString
*
objcKey_0
=
[[
NSString
alloc
]
initWithBytes
:
cppPair_0
.
first
.
data
()
length:
cppPair_0
.
first
.
length
()
length:
cppPair_0
.
first
.
length
()
encoding:
NSUTF8StringEncoding
];
encoding:
NSUTF8StringEncoding
];
NSNumber
*
objcValue_0
=
[
NSNumber
numberWithLongLong
:
cppPair_0
.
second
];
NSNumber
*
objcValue_0
=
[
NSNumber
numberWithLongLong
:
cppPair_0
.
second
];
[
objcRet
setObject
:
objcValue_0
forKey
:
objcKey_0
];
[
objcRet
TempDictionary
setObject
:
objcValue_0
forKey
:
objcKey_0
];
}
}
NSDictionary
*
objcRet
=
objcRetTempDictionary
;
return
objcRet
;
return
objcRet
;
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
}
+
(
BOOL
)
checkEmptyMap
:(
NS
Mutable
Dictionary
*
)
m
{
+
(
BOOL
)
checkEmptyMap
:(
NSDictionary
*
)
m
{
try
{
try
{
std
::
unordered_map
<
std
::
string
,
int64_t
>
cppM
;
std
::
unordered_map
<
std
::
string
,
int64_t
>
cppM
;
for
(
id
objcKey_0
in
m
)
{
for
(
id
objcKey_0
in
m
)
{
...
@@ -180,7 +182,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
...
@@ -180,7 +182,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
}
+
(
void
)
checkEnumMap
:(
NS
Mutable
Dictionary
*
)
m
{
+
(
void
)
checkEnumMap
:(
NSDictionary
*
)
m
{
try
{
try
{
std
::
unordered_map
<
color
,
std
::
string
>
cppM
;
std
::
unordered_map
<
color
,
std
::
string
>
cppM
;
for
(
id
objcKey_0
in
m
)
{
for
(
id
objcKey_0
in
m
)
{
...
...
test-suite/handwritten-src/objc/tests/DBMapRecordTests.mm
View file @
b0a4bf54
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
{
{
MapListRecord
cppMapListRecord
{
{
[
self
getCppMap
]
}
};
MapListRecord
cppMapListRecord
{
{
[
self
getCppMap
]
}
};
DBMapListRecord
*
objcMapListRecord
=
[[
DBMapListRecord
alloc
]
initWithCppMapListRecord
:
cppMapListRecord
];
DBMapListRecord
*
objcMapListRecord
=
[[
DBMapListRecord
alloc
]
initWithCppMapListRecord
:
cppMapListRecord
];
NS
Mutable
Array
*
objcMapList
=
objcMapListRecord
.
mapList
;
NSArray
*
objcMapList
=
objcMapListRecord
.
mapList
;
XCTAssertEqual
([
objcMapList
count
],
1
,
@"List with 1 map expected, actual no: %lu"
,
(
unsigned
long
)[
objcMapList
count
]);
XCTAssertEqual
([
objcMapList
count
],
1
,
@"List with 1 map expected, actual no: %lu"
,
(
unsigned
long
)[
objcMapList
count
]);
[
self
checkObjcMap
:[
objcMapList
objectAtIndex
:
0
]];
[
self
checkObjcMap
:[
objcMapList
objectAtIndex
:
0
]];
}
}
...
@@ -77,7 +77,7 @@
...
@@ -77,7 +77,7 @@
XCTAssertEqual
(
cppMap
.
at
(
"String3"
),
3
,
@"
\"
String3 -> 3
\"
expected"
);
XCTAssertEqual
(
cppMap
.
at
(
"String3"
),
3
,
@"
\"
String3 -> 3
\"
expected"
);
}
}
-
(
void
)
checkObjcMap
:(
NS
Mutable
Dictionary
*
)
objcMap
-
(
void
)
checkObjcMap
:(
NSDictionary
*
)
objcMap
{
{
XCTAssertEqual
([
objcMap
count
],
3
,
@"Count 3 expected, actual: %lu"
,
(
unsigned
long
)[
objcMap
count
]);
XCTAssertEqual
([
objcMap
count
],
3
,
@"Count 3 expected, actual: %lu"
,
(
unsigned
long
)[
objcMap
count
]);
XCTAssertEqual
([
objcMap
objectForKey
:
@"String1"
],
[
NSNumber
numberWithLongLong
:
1
],
@"
\"
String1 -> 1
\"
expected"
);
XCTAssertEqual
([
objcMap
objectForKey
:
@"String1"
],
[
NSNumber
numberWithLongLong
:
1
],
@"
\"
String1 -> 1
\"
expected"
);
...
...
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