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
a0f17dd5
Commit
a0f17dd5
authored
Aug 14, 2015
by
Peter Steinberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement description for record types in Objective-C.
parent
79462ca1
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
112 additions
and
0 deletions
+112
-0
src/source/ObjcGenerator.scala
src/source/ObjcGenerator.scala
+37
-0
test-suite/generated-src/objc/DBAssortedPrimitives.mm
test-suite/generated-src/objc/DBAssortedPrimitives.mm
+5
-0
test-suite/generated-src/objc/DBClientReturnedRecord.mm
test-suite/generated-src/objc/DBClientReturnedRecord.mm
+5
-0
test-suite/generated-src/objc/DBConstants.mm
test-suite/generated-src/objc/DBConstants.mm
+5
-0
test-suite/generated-src/objc/DBDateRecord.mm
test-suite/generated-src/objc/DBDateRecord.mm
+5
-0
test-suite/generated-src/objc/DBEmptyRecord.mm
test-suite/generated-src/objc/DBEmptyRecord.mm
+5
-0
test-suite/generated-src/objc/DBExternRecordWithDerivings.mm
test-suite/generated-src/objc/DBExternRecordWithDerivings.mm
+5
-0
test-suite/generated-src/objc/DBMapDateRecord.mm
test-suite/generated-src/objc/DBMapDateRecord.mm
+5
-0
test-suite/generated-src/objc/DBMapListRecord.mm
test-suite/generated-src/objc/DBMapListRecord.mm
+5
-0
test-suite/generated-src/objc/DBMapRecord.mm
test-suite/generated-src/objc/DBMapRecord.mm
+5
-0
test-suite/generated-src/objc/DBNestedCollection.mm
test-suite/generated-src/objc/DBNestedCollection.mm
+5
-0
test-suite/generated-src/objc/DBPrimitiveList.mm
test-suite/generated-src/objc/DBPrimitiveList.mm
+5
-0
test-suite/generated-src/objc/DBRecordWithDerivings.mm
test-suite/generated-src/objc/DBRecordWithDerivings.mm
+5
-0
test-suite/generated-src/objc/DBRecordWithDurationAndDerivings.mm
...te/generated-src/objc/DBRecordWithDurationAndDerivings.mm
+5
-0
test-suite/generated-src/objc/DBRecordWithNestedDerivings.mm
test-suite/generated-src/objc/DBRecordWithNestedDerivings.mm
+5
-0
test-suite/generated-src/objc/DBSetRecord.mm
test-suite/generated-src/objc/DBSetRecord.mm
+5
-0
No files found.
src/source/ObjcGenerator.scala
View file @
a0f17dd5
...
@@ -385,6 +385,43 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
...
@@ -385,6 +385,43 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
}
}
w
.
wl
w
.
wl
}
}
w
.
wl
(
"- (NSString *)description"
)
w
.
braced
{
w
.
w
(
s
"return "
).
nestedN
(
2
)
{
w
.
w
(
"[NSString stringWithFormat:@\"<%@ %p"
)
for
(
f
<-
r
.
fields
)
w
.
w
(
s
" ${idObjc.field(f.ident)}:%@"
)
w
.
w
(
">\", self.class, self"
)
for
(
f
<-
r
.
fields
)
{
w
.
w
(
", "
)
f
.
ty
.
resolved
.
base
match
{
case
MOptional
=>
f
.
ty
.
resolved
.
args
.
head
.
base
match
{
case
df
:
MDef
if
df.defType
=
=
DEnum
=>
w
.
w
(
s
"@(self.${idObjc.field(f.ident)})"
)
case
_
=>
w
.
w
(
s
"self.${idObjc.field(f.ident)}"
)
}
case
t
:
MPrimitive
=>
w
.
w
(
s
"@(self.${idObjc.field(f.ident)})"
)
case
df
:
MDef
=>
df
.
defType
match
{
case
DEnum
=>
w
.
w
(
s
"@(self.${idObjc.field(f.ident)})"
)
case
_
=>
w
.
w
(
s
"self.${idObjc.field(f.ident)}"
)
}
case
e
:
MExtern
=>
if
(
e
.
objc
.
pointer
)
{
w
.
w
(
s
"self.${idObjc.field(f.ident)}"
)
}
else
{
w
.
w
(
s
"@(self.${idObjc.field(f.ident)})"
)
}
case
_
=>
w
.
w
(
s
"self.${idObjc.field(f.ident)}"
)
}
}
}
w
.
wl
(
"];"
)
}
w
.
wl
w
.
wl
(
"@end"
)
w
.
wl
(
"@end"
)
})
})
}
}
...
...
test-suite/generated-src/objc/DBAssortedPrimitives.mm
View file @
a0f17dd5
...
@@ -112,4 +112,9 @@
...
@@ -112,4 +112,9 @@
self
.
oFsixtyfour
.
hash
;
self
.
oFsixtyfour
.
hash
;
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p b:%@ eight:%@ sixteen:%@ thirtytwo:%@ sixtyfour:%@ fthirtytwo:%@ fsixtyfour:%@ oB:%@ oEight:%@ oSixteen:%@ oThirtytwo:%@ oSixtyfour:%@ oFthirtytwo:%@ oFsixtyfour:%@>"
,
self
.
class
,
self
,
@
(
self
.
b
),
@
(
self
.
eight
),
@
(
self
.
sixteen
),
@
(
self
.
thirtytwo
),
@
(
self
.
sixtyfour
),
@
(
self
.
fthirtytwo
),
@
(
self
.
fsixtyfour
),
self
.
oB
,
self
.
oEight
,
self
.
oSixteen
,
self
.
oThirtytwo
,
self
.
oSixtyfour
,
self
.
oFthirtytwo
,
self
.
oFsixtyfour
];
}
@end
@end
test-suite/generated-src/objc/DBClientReturnedRecord.mm
View file @
a0f17dd5
...
@@ -27,4 +27,9 @@
...
@@ -27,4 +27,9 @@
misc:
misc
];
misc:
misc
];
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p recordId:%@ content:%@ misc:%@>"
,
self
.
class
,
self
,
@
(
self
.
recordId
),
self
.
content
,
self
.
misc
];
}
@end
@end
test-suite/generated-src/objc/DBConstants.mm
View file @
a0f17dd5
...
@@ -48,4 +48,9 @@ DBConstants * __nonnull const DBConstantsObjectConstant = [[DBConstants alloc] i
...
@@ -48,4 +48,9 @@ DBConstants * __nonnull const DBConstantsObjectConstant = [[DBConstants alloc] i
someString:
someString
];
someString:
someString
];
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p someInteger:%@ someString:%@>"
,
self
.
class
,
self
,
@
(
self
.
someInteger
),
self
.
someString
];
}
@end
@end
test-suite/generated-src/objc/DBDateRecord.mm
View file @
a0f17dd5
...
@@ -44,4 +44,9 @@
...
@@ -44,4 +44,9 @@
return
NSOrderedSame
;
return
NSOrderedSame
;
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p createdAt:%@>"
,
self
.
class
,
self
,
self
.
createdAt
];
}
@end
@end
test-suite/generated-src/objc/DBEmptyRecord.mm
View file @
a0f17dd5
...
@@ -18,4 +18,9 @@
...
@@ -18,4 +18,9 @@
return
[[
self
alloc
]
init
];
return
[[
self
alloc
]
init
];
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p>"
,
self
.
class
,
self
];
}
@end
@end
test-suite/generated-src/objc/DBExternRecordWithDerivings.mm
View file @
a0f17dd5
...
@@ -60,4 +60,9 @@
...
@@ -60,4 +60,9 @@
return
NSOrderedSame
;
return
NSOrderedSame
;
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p member:%@ e:%@>"
,
self
.
class
,
self
,
self
.
member
,
@
(
self
.
e
)];
}
@end
@end
test-suite/generated-src/objc/DBMapDateRecord.mm
View file @
a0f17dd5
...
@@ -19,4 +19,9 @@
...
@@ -19,4 +19,9 @@
return
[[
self
alloc
]
initWithDatesById
:
datesById
];
return
[[
self
alloc
]
initWithDatesById
:
datesById
];
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p datesById:%@>"
,
self
.
class
,
self
,
self
.
datesById
];
}
@end
@end
test-suite/generated-src/objc/DBMapListRecord.mm
View file @
a0f17dd5
...
@@ -19,4 +19,9 @@
...
@@ -19,4 +19,9 @@
return
[[
self
alloc
]
initWithMapList
:
mapList
];
return
[[
self
alloc
]
initWithMapList
:
mapList
];
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p mapList:%@>"
,
self
.
class
,
self
,
self
.
mapList
];
}
@end
@end
test-suite/generated-src/objc/DBMapRecord.mm
View file @
a0f17dd5
...
@@ -23,4 +23,9 @@
...
@@ -23,4 +23,9 @@
imap:
imap
];
imap:
imap
];
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p map:%@ imap:%@>"
,
self
.
class
,
self
,
self
.
map
,
self
.
imap
];
}
@end
@end
test-suite/generated-src/objc/DBNestedCollection.mm
View file @
a0f17dd5
...
@@ -19,4 +19,9 @@
...
@@ -19,4 +19,9 @@
return
[[
self
alloc
]
initWithSetList
:
setList
];
return
[[
self
alloc
]
initWithSetList
:
setList
];
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p setList:%@>"
,
self
.
class
,
self
,
self
.
setList
];
}
@end
@end
test-suite/generated-src/objc/DBPrimitiveList.mm
View file @
a0f17dd5
...
@@ -19,4 +19,9 @@
...
@@ -19,4 +19,9 @@
return
[[
self
alloc
]
initWithList
:
list
];
return
[[
self
alloc
]
initWithList
:
list
];
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p list:%@>"
,
self
.
class
,
self
,
self
.
list
];
}
@end
@end
test-suite/generated-src/objc/DBRecordWithDerivings.mm
View file @
a0f17dd5
...
@@ -60,4 +60,9 @@
...
@@ -60,4 +60,9 @@
return
NSOrderedSame
;
return
NSOrderedSame
;
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p key1:%@ key2:%@>"
,
self
.
class
,
self
,
@
(
self
.
key1
),
self
.
key2
];
}
@end
@end
test-suite/generated-src/objc/DBRecordWithDurationAndDerivings.mm
View file @
a0f17dd5
...
@@ -50,4 +50,9 @@
...
@@ -50,4 +50,9 @@
return
NSOrderedSame
;
return
NSOrderedSame
;
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p dt:%@>"
,
self
.
class
,
self
,
@
(
self
.
dt
)];
}
@end
@end
test-suite/generated-src/objc/DBRecordWithNestedDerivings.mm
View file @
a0f17dd5
...
@@ -60,4 +60,9 @@
...
@@ -60,4 +60,9 @@
return
NSOrderedSame
;
return
NSOrderedSame
;
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p key:%@ rec:%@>"
,
self
.
class
,
self
,
@
(
self
.
key
),
self
.
rec
];
}
@end
@end
test-suite/generated-src/objc/DBSetRecord.mm
View file @
a0f17dd5
...
@@ -23,4 +23,9 @@
...
@@ -23,4 +23,9 @@
iset:
iset
];
iset:
iset
];
}
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"<%@ %p set:%@ iset:%@>"
,
self
.
class
,
self
,
self
.
set
,
self
.
iset
];
}
@end
@end
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