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
ba88bbe7
Commit
ba88bbe7
authored
Nov 07, 2014
by
Steven Kabbes
Committed by
Jacob Potter
Nov 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose record constructors in public ObjC headers
parent
047a3afe
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
32 additions
and
29 deletions
+32
-29
example/generated-src/objc/TXSItemList+Private.h
example/generated-src/objc/TXSItemList+Private.h
+0
-2
example/generated-src/objc/TXSItemList.h
example/generated-src/objc/TXSItemList.h
+2
-0
src/source/ObjcGenerator.scala
src/source/ObjcGenerator.scala
+14
-11
test-suite/generated-src/objc/DBClientReturnedRecord+Private.h
...suite/generated-src/objc/DBClientReturnedRecord+Private.h
+0
-2
test-suite/generated-src/objc/DBClientReturnedRecord.h
test-suite/generated-src/objc/DBClientReturnedRecord.h
+2
-0
test-suite/generated-src/objc/DBMapListRecord+Private.h
test-suite/generated-src/objc/DBMapListRecord+Private.h
+0
-2
test-suite/generated-src/objc/DBMapListRecord.h
test-suite/generated-src/objc/DBMapListRecord.h
+2
-0
test-suite/generated-src/objc/DBMapRecord+Private.h
test-suite/generated-src/objc/DBMapRecord+Private.h
+0
-2
test-suite/generated-src/objc/DBMapRecord.h
test-suite/generated-src/objc/DBMapRecord.h
+2
-0
test-suite/generated-src/objc/DBNestedCollection+Private.h
test-suite/generated-src/objc/DBNestedCollection+Private.h
+0
-2
test-suite/generated-src/objc/DBNestedCollection.h
test-suite/generated-src/objc/DBNestedCollection.h
+2
-0
test-suite/generated-src/objc/DBPrimitiveList+Private.h
test-suite/generated-src/objc/DBPrimitiveList+Private.h
+0
-2
test-suite/generated-src/objc/DBPrimitiveList.h
test-suite/generated-src/objc/DBPrimitiveList.h
+2
-0
test-suite/generated-src/objc/DBRecordWithDerivings+Private.h
...-suite/generated-src/objc/DBRecordWithDerivings+Private.h
+0
-2
test-suite/generated-src/objc/DBRecordWithDerivings.h
test-suite/generated-src/objc/DBRecordWithDerivings.h
+2
-0
test-suite/generated-src/objc/DBRecordWithNestedDerivings+Private.h
.../generated-src/objc/DBRecordWithNestedDerivings+Private.h
+0
-2
test-suite/generated-src/objc/DBRecordWithNestedDerivings.h
test-suite/generated-src/objc/DBRecordWithNestedDerivings.h
+2
-0
test-suite/generated-src/objc/DBSetRecord+Private.h
test-suite/generated-src/objc/DBSetRecord+Private.h
+0
-2
test-suite/generated-src/objc/DBSetRecord.h
test-suite/generated-src/objc/DBSetRecord.h
+2
-0
No files found.
example/generated-src/objc/TXSItemList+Private.h
View file @
ba88bbe7
...
@@ -7,8 +7,6 @@
...
@@ -7,8 +7,6 @@
@interface
TXSItemList
()
@interface
TXSItemList
()
-
(
id
)
initWithItemList
:(
TXSItemList
*
)
itemList
;
-
(
id
)
initWithItems
:(
NSMutableArray
*
)
items
;
-
(
id
)
initWithCppItemList
:(
const
::
textsort
::
ItemList
&
)
itemList
;
-
(
id
)
initWithCppItemList
:(
const
::
textsort
::
ItemList
&
)
itemList
;
-
(
::
textsort
::
ItemList
)
cppItemList
;
-
(
::
textsort
::
ItemList
)
cppItemList
;
...
...
example/generated-src/objc/TXSItemList.h
View file @
ba88bbe7
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
@interface
TXSItemList
:
NSObject
@interface
TXSItemList
:
NSObject
-
(
id
)
initWithItemList
:(
TXSItemList
*
)
itemList
;
-
(
id
)
initWithItems
:(
NSMutableArray
*
)
items
;
@property
(
nonatomic
,
readonly
)
NSMutableArray
*
items
;
@property
(
nonatomic
,
readonly
)
NSMutableArray
*
items
;
...
...
src/source/ObjcGenerator.scala
View file @
ba88bbe7
...
@@ -399,6 +399,7 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
...
@@ -399,6 +399,7 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
if
(
r
.
ext
.
objc
)
{
if
(
r
.
ext
.
objc
)
{
refs
.
body
.
add
(
"#import "
+
q
(
"../"
+
headerName
(
ident
)))
refs
.
body
.
add
(
"#import "
+
q
(
"../"
+
headerName
(
ident
)))
refs
.
privHeader
.
add
(
"#import "
+
q
(
"../"
+
headerName
(
ident
)))
refs
.
privHeader
.
add
(
"#import "
+
q
(
"../"
+
headerName
(
ident
)))
refs
.
header
.
add
(
s
"@class ${idObjc.ty(ident.name)};"
)
}
}
def
checkMutable
(
tm
:
MExpr
)
:
Boolean
=
tm
.
base
match
{
def
checkMutable
(
tm
:
MExpr
)
:
Boolean
=
tm
.
base
match
{
...
@@ -416,6 +417,19 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
...
@@ -416,6 +417,19 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
}
}
w
.
wl
w
.
wl
w
.
wl
(
s
"@interface $self : NSObject"
)
w
.
wl
(
s
"@interface $self : NSObject"
)
// Deep copy construtor
w
.
wl
(
s
"- (id)${idObjc.method("
init_with_
" + ident.name)}:(${idObjc.ty(ident)} *)${idObjc.field(ident)};"
)
if
(!
r
.
fields
.
isEmpty
)
{
val
head
=
r
.
fields
.
head
val
skipFirst
=
SkipFirst
()
w
.
w
(
s
"- (id)${idObjc.method("
init_with_
" + head.ident.name)}:(${toObjcFullType(head.ty)})${idObjc.local(head.ident)}"
)
for
(
f
<-
r
.
fields
)
skipFirst
{
w
.
w
(
s
" ${idObjc.field(f.ident)}:(${toObjcFullType(f.ty)})${idObjc.field(f.ident)}"
)
}
w
.
wl
(
";"
)
}
for
(
f
<-
r
.
fields
)
{
for
(
f
<-
r
.
fields
)
{
w
.
wl
w
.
wl
writeDoc
(
w
,
f
.
doc
)
writeDoc
(
w
,
f
.
doc
)
...
@@ -433,16 +447,6 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
...
@@ -433,16 +447,6 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
w
.
wl
(
s
"@interface $self ()"
)
w
.
wl
(
s
"@interface $self ()"
)
w
.
wl
w
.
wl
// Deep copy constructor
// Deep copy constructor
w
.
wl
(
s
"- (id)${idObjc.method("
init_with_
" + ident.name)}:(${idObjc.ty(ident)} *)${idObjc.field(ident)};"
)
if
(!
r
.
fields
.
isEmpty
)
{
val
head
=
r
.
fields
.
head
val
skipFirst
=
SkipFirst
()
w
.
w
(
s
"- (id)${idObjc.method("
init_with_
" + head.ident.name)}:(${toObjcFullType(head.ty)})${idObjc.local(head.ident)}"
)
for
(
f
<-
r
.
fields
)
skipFirst
{
w
.
w
(
s
" ${idObjc.field(f.ident)}:(${toObjcFullType(f.ty)})${idObjc.field(f.ident)}"
)
}
w
.
wl
(
";"
)
}
w
.
wl
(
s
"- (id)${idObjc.method("
init_with_cpp_
" + ident.name)}:(const $cppSelf &)${idObjc.local(ident)};"
)
w
.
wl
(
s
"- (id)${idObjc.method("
init_with_cpp_
" + ident.name)}:(const $cppSelf &)${idObjc.local(ident)};"
)
w
.
wl
(
s
"- ($cppSelf)${idObjc.method("
cpp_
" + ident.name)};"
)
w
.
wl
(
s
"- ($cppSelf)${idObjc.method("
cpp_
" + ident.name)};"
)
w
.
wl
w
.
wl
...
@@ -455,7 +459,6 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
...
@@ -455,7 +459,6 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
w
.
wl
w
.
wl
w
.
wl
(
s
"@implementation $self"
)
w
.
wl
(
s
"@implementation $self"
)
w
.
wl
w
.
wl
// Deep copy construtor
w
.
wl
(
s
"- (id)${idObjc.method("
init_with_
" + ident.name)}:(${idObjc.ty(ident)} *)${idObjc.local(ident)}"
)
w
.
wl
(
s
"- (id)${idObjc.method("
init_with_
" + ident.name)}:(${idObjc.ty(ident)} *)${idObjc.local(ident)}"
)
w
.
braced
{
w
.
braced
{
w
.
w
(
"if (self = [super init])"
).
braced
{
w
.
w
(
"if (self = [super init])"
).
braced
{
...
...
test-suite/generated-src/objc/DBClientReturnedRecord+Private.h
View file @
ba88bbe7
...
@@ -7,8 +7,6 @@
...
@@ -7,8 +7,6 @@
@interface
DBClientReturnedRecord
()
@interface
DBClientReturnedRecord
()
-
(
id
)
initWithClientReturnedRecord
:(
DBClientReturnedRecord
*
)
clientReturnedRecord
;
-
(
id
)
initWithContent
:(
NSString
*
)
content
;
-
(
id
)
initWithCppClientReturnedRecord
:(
const
ClientReturnedRecord
&
)
clientReturnedRecord
;
-
(
id
)
initWithCppClientReturnedRecord
:(
const
ClientReturnedRecord
&
)
clientReturnedRecord
;
-
(
ClientReturnedRecord
)
cppClientReturnedRecord
;
-
(
ClientReturnedRecord
)
cppClientReturnedRecord
;
...
...
test-suite/generated-src/objc/DBClientReturnedRecord.h
View file @
ba88bbe7
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
@interface
DBClientReturnedRecord
:
NSObject
@interface
DBClientReturnedRecord
:
NSObject
-
(
id
)
initWithClientReturnedRecord
:(
DBClientReturnedRecord
*
)
clientReturnedRecord
;
-
(
id
)
initWithContent
:(
NSString
*
)
content
;
@property
(
nonatomic
,
readonly
)
NSString
*
content
;
@property
(
nonatomic
,
readonly
)
NSString
*
content
;
...
...
test-suite/generated-src/objc/DBMapListRecord+Private.h
View file @
ba88bbe7
...
@@ -7,8 +7,6 @@
...
@@ -7,8 +7,6 @@
@interface
DBMapListRecord
()
@interface
DBMapListRecord
()
-
(
id
)
initWithMapListRecord
:(
DBMapListRecord
*
)
mapListRecord
;
-
(
id
)
initWithMapList
:(
NSMutableArray
*
)
mapList
;
-
(
id
)
initWithCppMapListRecord
:(
const
MapListRecord
&
)
mapListRecord
;
-
(
id
)
initWithCppMapListRecord
:(
const
MapListRecord
&
)
mapListRecord
;
-
(
MapListRecord
)
cppMapListRecord
;
-
(
MapListRecord
)
cppMapListRecord
;
...
...
test-suite/generated-src/objc/DBMapListRecord.h
View file @
ba88bbe7
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
@interface
DBMapListRecord
:
NSObject
@interface
DBMapListRecord
:
NSObject
-
(
id
)
initWithMapListRecord
:(
DBMapListRecord
*
)
mapListRecord
;
-
(
id
)
initWithMapList
:(
NSMutableArray
*
)
mapList
;
@property
(
nonatomic
,
readonly
)
NSMutableArray
*
mapList
;
@property
(
nonatomic
,
readonly
)
NSMutableArray
*
mapList
;
...
...
test-suite/generated-src/objc/DBMapRecord+Private.h
View file @
ba88bbe7
...
@@ -7,8 +7,6 @@
...
@@ -7,8 +7,6 @@
@interface
DBMapRecord
()
@interface
DBMapRecord
()
-
(
id
)
initWithMapRecord
:(
DBMapRecord
*
)
mapRecord
;
-
(
id
)
initWithMap
:(
NSMutableDictionary
*
)
map
;
-
(
id
)
initWithCppMapRecord
:(
const
MapRecord
&
)
mapRecord
;
-
(
id
)
initWithCppMapRecord
:(
const
MapRecord
&
)
mapRecord
;
-
(
MapRecord
)
cppMapRecord
;
-
(
MapRecord
)
cppMapRecord
;
...
...
test-suite/generated-src/objc/DBMapRecord.h
View file @
ba88bbe7
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
@interface
DBMapRecord
:
NSObject
@interface
DBMapRecord
:
NSObject
-
(
id
)
initWithMapRecord
:(
DBMapRecord
*
)
mapRecord
;
-
(
id
)
initWithMap
:(
NSMutableDictionary
*
)
map
;
@property
(
nonatomic
,
readonly
)
NSMutableDictionary
*
map
;
@property
(
nonatomic
,
readonly
)
NSMutableDictionary
*
map
;
...
...
test-suite/generated-src/objc/DBNestedCollection+Private.h
View file @
ba88bbe7
...
@@ -7,8 +7,6 @@
...
@@ -7,8 +7,6 @@
@interface
DBNestedCollection
()
@interface
DBNestedCollection
()
-
(
id
)
initWithNestedCollection
:(
DBNestedCollection
*
)
nestedCollection
;
-
(
id
)
initWithSetList
:(
NSMutableArray
*
)
setList
;
-
(
id
)
initWithCppNestedCollection
:(
const
NestedCollection
&
)
nestedCollection
;
-
(
id
)
initWithCppNestedCollection
:(
const
NestedCollection
&
)
nestedCollection
;
-
(
NestedCollection
)
cppNestedCollection
;
-
(
NestedCollection
)
cppNestedCollection
;
...
...
test-suite/generated-src/objc/DBNestedCollection.h
View file @
ba88bbe7
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
@interface
DBNestedCollection
:
NSObject
@interface
DBNestedCollection
:
NSObject
-
(
id
)
initWithNestedCollection
:(
DBNestedCollection
*
)
nestedCollection
;
-
(
id
)
initWithSetList
:(
NSMutableArray
*
)
setList
;
@property
(
nonatomic
,
readonly
)
NSMutableArray
*
setList
;
@property
(
nonatomic
,
readonly
)
NSMutableArray
*
setList
;
...
...
test-suite/generated-src/objc/DBPrimitiveList+Private.h
View file @
ba88bbe7
...
@@ -7,8 +7,6 @@
...
@@ -7,8 +7,6 @@
@interface
DBPrimitiveList
()
@interface
DBPrimitiveList
()
-
(
id
)
initWithPrimitiveList
:(
DBPrimitiveList
*
)
primitiveList
;
-
(
id
)
initWithList
:(
NSMutableArray
*
)
list
;
-
(
id
)
initWithCppPrimitiveList
:(
const
PrimitiveList
&
)
primitiveList
;
-
(
id
)
initWithCppPrimitiveList
:(
const
PrimitiveList
&
)
primitiveList
;
-
(
PrimitiveList
)
cppPrimitiveList
;
-
(
PrimitiveList
)
cppPrimitiveList
;
...
...
test-suite/generated-src/objc/DBPrimitiveList.h
View file @
ba88bbe7
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
@interface
DBPrimitiveList
:
NSObject
@interface
DBPrimitiveList
:
NSObject
-
(
id
)
initWithPrimitiveList
:(
DBPrimitiveList
*
)
primitiveList
;
-
(
id
)
initWithList
:(
NSMutableArray
*
)
list
;
@property
(
nonatomic
,
readonly
)
NSMutableArray
*
list
;
@property
(
nonatomic
,
readonly
)
NSMutableArray
*
list
;
...
...
test-suite/generated-src/objc/DBRecordWithDerivings+Private.h
View file @
ba88bbe7
...
@@ -7,8 +7,6 @@
...
@@ -7,8 +7,6 @@
@interface
DBRecordWithDerivings
()
@interface
DBRecordWithDerivings
()
-
(
id
)
initWithRecordWithDerivings
:(
DBRecordWithDerivings
*
)
recordWithDerivings
;
-
(
id
)
initWithKey1
:(
int32_t
)
key1
key2
:(
NSString
*
)
key2
;
-
(
id
)
initWithCppRecordWithDerivings
:(
const
RecordWithDerivings
&
)
recordWithDerivings
;
-
(
id
)
initWithCppRecordWithDerivings
:(
const
RecordWithDerivings
&
)
recordWithDerivings
;
-
(
RecordWithDerivings
)
cppRecordWithDerivings
;
-
(
RecordWithDerivings
)
cppRecordWithDerivings
;
...
...
test-suite/generated-src/objc/DBRecordWithDerivings.h
View file @
ba88bbe7
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
@interface
DBRecordWithDerivings
:
NSObject
@interface
DBRecordWithDerivings
:
NSObject
-
(
id
)
initWithRecordWithDerivings
:(
DBRecordWithDerivings
*
)
recordWithDerivings
;
-
(
id
)
initWithKey1
:(
int32_t
)
key1
key2
:(
NSString
*
)
key2
;
@property
(
nonatomic
,
readonly
)
int32_t
key1
;
@property
(
nonatomic
,
readonly
)
int32_t
key1
;
...
...
test-suite/generated-src/objc/DBRecordWithNestedDerivings+Private.h
View file @
ba88bbe7
...
@@ -7,8 +7,6 @@
...
@@ -7,8 +7,6 @@
@interface
DBRecordWithNestedDerivings
()
@interface
DBRecordWithNestedDerivings
()
-
(
id
)
initWithRecordWithNestedDerivings
:(
DBRecordWithNestedDerivings
*
)
recordWithNestedDerivings
;
-
(
id
)
initWithKey
:(
int32_t
)
key
rec
:(
DBRecordWithDerivings
*
)
rec
;
-
(
id
)
initWithCppRecordWithNestedDerivings
:(
const
RecordWithNestedDerivings
&
)
recordWithNestedDerivings
;
-
(
id
)
initWithCppRecordWithNestedDerivings
:(
const
RecordWithNestedDerivings
&
)
recordWithNestedDerivings
;
-
(
RecordWithNestedDerivings
)
cppRecordWithNestedDerivings
;
-
(
RecordWithNestedDerivings
)
cppRecordWithNestedDerivings
;
...
...
test-suite/generated-src/objc/DBRecordWithNestedDerivings.h
View file @
ba88bbe7
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
@interface
DBRecordWithNestedDerivings
:
NSObject
@interface
DBRecordWithNestedDerivings
:
NSObject
-
(
id
)
initWithRecordWithNestedDerivings
:(
DBRecordWithNestedDerivings
*
)
recordWithNestedDerivings
;
-
(
id
)
initWithKey
:(
int32_t
)
key
rec
:(
DBRecordWithDerivings
*
)
rec
;
@property
(
nonatomic
,
readonly
)
int32_t
key
;
@property
(
nonatomic
,
readonly
)
int32_t
key
;
...
...
test-suite/generated-src/objc/DBSetRecord+Private.h
View file @
ba88bbe7
...
@@ -7,8 +7,6 @@
...
@@ -7,8 +7,6 @@
@interface
DBSetRecord
()
@interface
DBSetRecord
()
-
(
id
)
initWithSetRecord
:(
DBSetRecord
*
)
setRecord
;
-
(
id
)
initWithSet
:(
NSMutableSet
*
)
set
;
-
(
id
)
initWithCppSetRecord
:(
const
SetRecord
&
)
setRecord
;
-
(
id
)
initWithCppSetRecord
:(
const
SetRecord
&
)
setRecord
;
-
(
SetRecord
)
cppSetRecord
;
-
(
SetRecord
)
cppSetRecord
;
...
...
test-suite/generated-src/objc/DBSetRecord.h
View file @
ba88bbe7
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
@interface
DBSetRecord
:
NSObject
@interface
DBSetRecord
:
NSObject
-
(
id
)
initWithSetRecord
:(
DBSetRecord
*
)
setRecord
;
-
(
id
)
initWithSet
:(
NSMutableSet
*
)
set
;
@property
(
nonatomic
,
readonly
)
NSMutableSet
*
set
;
@property
(
nonatomic
,
readonly
)
NSMutableSet
*
set
;
...
...
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