Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
f5074edd
Commit
f5074edd
authored
May 13, 2014
by
Jason Choy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added name annotation support for interfaces, methods and params
parent
e8154d95
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
capnpc-c++.c++
c++/src/capnp/compiler/capnpc-c++.c++
+3
-3
encoding-test.c++
c++/src/capnp/encoding-test.c++
+3
-0
test.capnp
c++/src/capnp/test.capnp
+4
-0
No files found.
c++/src/capnp/compiler/capnpc-c++.c++
View file @
f5074edd
...
...
@@ -1243,7 +1243,7 @@ private:
MethodText
makeMethodText
(
kj
::
StringPtr
interfaceName
,
InterfaceSchema
::
Method
method
)
{
auto
proto
=
method
.
getProto
();
auto
name
=
proto
.
getName
(
);
auto
name
=
proto
Name
(
proto
);
auto
titleCase
=
toTitleCase
(
name
);
auto
paramSchema
=
schemaLoader
.
get
(
proto
.
getParamStructType
()).
asStruct
();
auto
resultSchema
=
schemaLoader
.
get
(
proto
.
getResultStructType
()).
asStruct
();
...
...
@@ -1593,7 +1593,7 @@ private:
auto
paramsProto
=
schemaLoader
.
get
(
method
.
getParamStructType
()).
getProto
();
if
(
paramsProto
.
getScopeId
()
==
0
)
{
nestedTexts
.
add
(
makeNodeText
(
namespace_
,
subScope
,
toTitleCase
(
kj
::
str
(
method
.
getName
(
),
"Params"
)),
params
));
toTitleCase
(
kj
::
str
(
protoName
(
method
),
"Params"
)),
params
));
}
}
{
...
...
@@ -1601,7 +1601,7 @@ private:
auto
resultsProto
=
schemaLoader
.
get
(
method
.
getResultStructType
()).
getProto
();
if
(
resultsProto
.
getScopeId
()
==
0
)
{
nestedTexts
.
add
(
makeNodeText
(
namespace_
,
subScope
,
toTitleCase
(
kj
::
str
(
method
.
getName
(
),
"Results"
)),
results
));
toTitleCase
(
kj
::
str
(
protoName
(
method
),
"Results"
)),
results
));
}
}
}
...
...
c++/src/capnp/encoding-test.c++
View file @
f5074edd
...
...
@@ -1683,6 +1683,9 @@ TEST(Encoding, NameAnnotation) {
nestedFieldBuilder
.
setGoodNestedFieldName
(
true
);
EXPECT_EQ
(
true
,
nestedFieldBuilder
.
getGoodNestedFieldName
());
EXPECT_FALSE
(
nestedFieldBuilder
.
hasAnotherGoodNestedFieldName
());
test
::
RenamedInterface
::
RenamedMethodParams
::
Reader
renamedInterfaceParams
;
renamedInterfaceParams
.
getRenamedParam
();
}
}
// namespace
...
...
c++/src/capnp/test.capnp
View file @
f5074edd
...
...
@@ -720,3 +720,7 @@ struct TestNameAnnotation $Cxx.name("RenamedStruct") {
baz @5 :NestedStruct $Cxx.name("qux");
}
}
interface TestNameAnnotationInterface $Cxx.name("RenamedInterface") {
badlyNamedMethod @0 (badlyNamedParam :UInt8 $Cxx.name("renamedParam")) $Cxx.name("renamedMethod");
}
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