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
eea8759e
Commit
eea8759e
authored
Aug 14, 2017
by
Ross Light
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add canonical format to capnp convert
parent
44130fba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
capnp.c++
c++/src/capnp/compiler/capnp.c++
+11
-1
No files found.
c++/src/capnp/compiler/capnp.c++
View file @
eea8759e
...
...
@@ -127,6 +127,7 @@ public:
" packed packed binary format (deflates zeroes)
\n
"
" flat binary single segment, no segment table (rare)
\n
"
" flat-packed flat and packed
\n
"
" canonical canonicalized binary single segment, no segment table
\n
"
" text schema language struct literal format
\n
"
" json JSON format
\n
"
"When using
\"
text
\"
or
\"
json
\"
format, you must specify <schema-file> and <type> "
...
...
@@ -641,6 +642,7 @@ private:
PACKED
,
FLAT
,
FLAT_PACKED
,
CANONICAL
,
TEXT
,
JSON
};
...
...
@@ -650,6 +652,7 @@ private:
if
(
name
==
"packed"
)
return
Format
::
PACKED
;
if
(
name
==
"flat"
)
return
Format
::
FLAT
;
if
(
name
==
"flat-packed"
)
return
Format
::
FLAT_PACKED
;
if
(
name
==
"canonical"
)
return
Format
::
CANONICAL
;
if
(
name
==
"text"
)
return
Format
::
TEXT
;
if
(
name
==
"json"
)
return
Format
::
JSON
;
...
...
@@ -662,6 +665,7 @@ private:
case
Format
:
:
PACKED
:
return
"packed"
;
case
Format
:
:
FLAT
:
return
"flat"
;
case
Format
:
:
FLAT_PACKED
:
return
"flat-packed"
;
case
Format
:
:
CANONICAL
:
return
"canonical"
;
case
Format
:
:
TEXT
:
return
"text"
;
case
Format
:
:
JSON
:
return
"json"
;
}
...
...
@@ -989,7 +993,8 @@ private:
capnp
::
PackedMessageReader
message
(
input
,
options
);
return
writeConversion
(
message
.
getRoot
<
AnyStruct
>
(),
output
);
}
case
Format
:
:
FLAT
:
{
case
Format
:
:
FLAT
:
case
Format
:
:
CANONICAL
:
{
auto
allBytes
=
readAll
(
input
);
// Technically we don't know if the bytes are aligned so we'd better copy them to a new
...
...
@@ -1074,6 +1079,11 @@ private:
packed
.
write
(
words
.
begin
(),
words
.
asBytes
().
size
());
return
;
}
case
Format
:
:
CANONICAL
:
{
auto
words
=
reader
.
canonicalize
();
output
.
write
(
words
.
begin
(),
words
.
asBytes
().
size
());
return
;
}
case
Format
:
:
TEXT
:
{
TextCodec
codec
;
codec
.
setPrettyPrint
(
pretty
);
...
...
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