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
0fbd8647
Commit
0fbd8647
authored
May 14, 2015
by
Miro Knejp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proper handling of templates in Obj-C translators
parent
bc42dcc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
13 deletions
+11
-13
src/source/ObjcppMarshal.scala
src/source/ObjcppMarshal.scala
+11
-13
No files found.
src/source/ObjcppMarshal.scala
View file @
0fbd8647
...
@@ -24,12 +24,10 @@ class ObjcppMarshal(spec: Spec) extends Marshal(spec) {
...
@@ -24,12 +24,10 @@ class ObjcppMarshal(spec: Spec) extends Marshal(spec) {
override
def
fqFieldType
(
tm
:
MExpr
)
:
String
=
throw
new
AssertionError
(
"not applicable"
)
override
def
fqFieldType
(
tm
:
MExpr
)
:
String
=
throw
new
AssertionError
(
"not applicable"
)
override
def
toCpp
(
tm
:
MExpr
,
expr
:
String
)
:
String
=
{
override
def
toCpp
(
tm
:
MExpr
,
expr
:
String
)
:
String
=
{
val
helper
=
helperName
(
tm
)
+
helperTemplates
(
tm
)
s
"${helperClass(tm)}::toCpp($expr)"
s
"$helper::toCpp($expr)"
}
}
override
def
fromCpp
(
tm
:
MExpr
,
expr
:
String
)
:
String
=
{
override
def
fromCpp
(
tm
:
MExpr
,
expr
:
String
)
:
String
=
{
val
helper
=
helperName
(
tm
)
+
helperTemplates
(
tm
)
s
"${helperClass(tm)}::fromCpp($expr)"
s
"$helper::fromCpp($expr)"
}
}
def
references
(
m
:
Meta
)
:
Seq
[
SymbolReference
]
=
m
match
{
def
references
(
m
:
Meta
)
:
Seq
[
SymbolReference
]
=
m
match
{
...
@@ -49,6 +47,7 @@ class ObjcppMarshal(spec: Spec) extends Marshal(spec) {
...
@@ -49,6 +47,7 @@ class ObjcppMarshal(spec: Spec) extends Marshal(spec) {
}
}
def
helperClass
(
name
:
String
)
=
idCpp
.
ty
(
name
)
def
helperClass
(
name
:
String
)
=
idCpp
.
ty
(
name
)
private
def
helperClass
(
tm
:
MExpr
)
:
String
=
helperName
(
tm
)
+
helperTemplates
(
tm
)
def
privateHeaderName
(
ident
:
String
)
:
String
=
idObjc
.
ty
(
ident
)
+
"+Private."
+
spec
.
objcHeaderExt
def
privateHeaderName
(
ident
:
String
)
:
String
=
idObjc
.
ty
(
ident
)
+
"+Private."
+
spec
.
objcHeaderExt
...
@@ -78,21 +77,20 @@ class ObjcppMarshal(spec: Spec) extends Marshal(spec) {
...
@@ -78,21 +77,20 @@ class ObjcppMarshal(spec: Spec) extends Marshal(spec) {
})
})
}
}
private
def
helperTemplates
(
tm
:
MExpr
)
:
String
=
tm
.
base
match
{
private
def
helperTemplates
(
tm
:
MExpr
)
:
String
=
{
def
f
()
=
if
(
tm
.
args
.
isEmpty
)
""
else
tm
.
args
.
map
(
helperClass
).
mkString
(
"<"
,
", "
,
">"
)
tm
.
base
match
{
case
MOptional
=>
case
MOptional
=>
assert
(
tm
.
args
.
size
==
1
)
assert
(
tm
.
args
.
size
==
1
)
val
argHelperClass
=
helper
Name
(
tm
.
args
.
head
)
+
helperTemplate
s
(
tm
.
args
.
head
)
val
argHelperClass
=
helper
Clas
s
(
tm
.
args
.
head
)
s
"<${spec.cppOptionalTemplate}, $argHelperClass>"
s
"<${spec.cppOptionalTemplate}, $argHelperClass>"
case
MList
|
MSet
=>
case
MList
|
MSet
=>
assert
(
tm
.
args
.
size
==
1
)
assert
(
tm
.
args
.
size
==
1
)
val
argHelperClass
=
helperName
(
tm
.
args
.
head
)
+
helperTemplates
(
tm
.
args
.
head
)
f
s
"<$argHelperClass>"
case
MMap
=>
case
MMap
=>
assert
(
tm
.
args
.
size
==
2
)
assert
(
tm
.
args
.
size
==
2
)
val
keyHelperClass
=
helperName
(
tm
.
args
.
head
)
+
helperTemplates
(
tm
.
args
.
head
)
f
val
valueHelperClass
=
helperName
(
tm
.
args
.
tail
.
head
)
+
helperTemplates
(
tm
.
args
.
tail
.
head
)
case
_
=>
f
s
"<$keyHelperClass, $valueHelperClass>"
}
case
_
=>
""
}
}
}
}
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