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
cfc10236
Commit
cfc10236
authored
Aug 22, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regular -> nonGroup
parent
12243735
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
116 additions
and
115 deletions
+116
-115
capnpc-c++.c++
c++/src/capnp/compiler/capnpc-c++.c++
+8
-8
capnpc-capnp.c++
c++/src/capnp/compiler/capnpc-capnp.c++
+9
-9
compiler.c++
c++/src/capnp/compiler/compiler.c++
+2
-2
node-translator.c++
c++/src/capnp/compiler/node-translator.c++
+10
-10
dynamic.c++
c++/src/capnp/dynamic.c++
+0
-0
encoding-test.c++
c++/src/capnp/encoding-test.c++
+2
-2
schema-loader-test.c++
c++/src/capnp/schema-loader-test.c++
+2
-2
schema-loader.c++
c++/src/capnp/schema-loader.c++
+14
-14
schema-parser-test.c++
c++/src/capnp/schema-parser-test.c++
+1
-1
schema-test.c++
c++/src/capnp/schema-test.c++
+1
-1
schema.c++
c++/src/capnp/schema.c++
+1
-1
schema.capnp
c++/src/capnp/schema.capnp
+2
-2
schema.capnp.c++
c++/src/capnp/schema.capnp.c++
+14
-13
schema.capnp.h
c++/src/capnp/schema.capnp.h
+48
-48
stringify.c++
c++/src/capnp/stringify.c++
+2
-2
No files found.
c++/src/capnp/compiler/capnpc-c++.c++
View file @
cfc10236
...
...
@@ -84,8 +84,8 @@ void enumerateDeps(schema::Node::Reader node, std::set<uint64_t>& deps) {
auto
structNode
=
node
.
getStruct
();
for
(
auto
field
:
structNode
.
getFields
())
{
switch
(
field
.
which
())
{
case
schema
:
:
Field
::
REGULAR
:
enumerateDeps
(
field
.
get
Regular
().
getType
(),
deps
);
case
schema
:
:
Field
::
NON_GROUP
:
enumerateDeps
(
field
.
get
NonGroup
().
getType
(),
deps
);
break
;
case
schema
:
:
Field
::
GROUP
:
deps
.
insert
(
field
.
getGroup
());
...
...
@@ -289,7 +289,7 @@ private:
}
switch
(
proto
.
which
())
{
case
schema
:
:
Field
::
REGULAR
:
case
schema
:
:
Field
::
NON_GROUP
:
// Continue below.
break
;
...
...
@@ -321,18 +321,18 @@ private:
};
}
auto
regularField
=
proto
.
getRegular
();
auto
nonGroup
=
proto
.
getNonGroup
();
FieldKind
kind
;
kj
::
String
ownedType
;
kj
::
String
type
=
typeName
(
regularField
.
getType
()).
flatten
();
kj
::
String
type
=
typeName
(
nonGroup
.
getType
()).
flatten
();
kj
::
StringPtr
setterDefault
;
// only for void
kj
::
String
defaultMask
;
// primitives only
size_t
defaultOffset
=
0
;
// pointers only: offset of the default value within the schema.
size_t
defaultSize
=
0
;
// blobs only: byte size of the default value.
auto
typeBody
=
regularField
.
getType
();
auto
defaultBody
=
regularField
.
getDefaultValue
();
auto
typeBody
=
nonGroup
.
getType
();
auto
defaultBody
=
nonGroup
.
getDefaultValue
();
switch
(
typeBody
.
which
())
{
case
schema
:
:
Type
::
VOID
:
kind
=
FieldKind
::
PRIMITIVE
;
...
...
@@ -430,7 +430,7 @@ private:
defaultMaskParam
=
kj
::
str
(
", "
,
defaultMask
);
}
uint
offset
=
regularField
.
getOffset
();
uint
offset
=
nonGroup
.
getOffset
();
if
(
kind
==
FieldKind
::
PRIMITIVE
)
{
return
FieldText
{
...
...
c++/src/capnp/compiler/capnpc-capnp.c++
View file @
cfc10236
...
...
@@ -360,19 +360,19 @@ private:
kj
::
StringTree
genStructField
(
schema
::
Field
::
Reader
field
,
Schema
scope
,
Indent
indent
)
{
switch
(
field
.
which
())
{
case
schema
:
:
Field
::
REGULAR
:
{
auto
regularField
=
field
.
getRegular
();
int
size
=
typeSizeBits
(
regularField
.
getType
());
case
schema
:
:
Field
::
NON_GROUP
:
{
auto
nonGroup
=
field
.
getNonGroup
();
int
size
=
typeSizeBits
(
nonGroup
.
getType
());
return
kj
::
strTree
(
indent
,
field
.
getName
(),
" @"
,
field
.
getOrdinal
().
getExplicit
(),
" :"
,
genType
(
regularField
.
getType
(),
scope
),
isEmptyValue
(
regularField
.
getDefaultValue
())
?
kj
::
strTree
(
""
)
:
" :"
,
genType
(
nonGroup
.
getType
(),
scope
),
isEmptyValue
(
nonGroup
.
getDefaultValue
())
?
kj
::
strTree
(
""
)
:
kj
::
strTree
(
" = "
,
genValue
(
regularField
.
getType
(),
regularField
.
getDefaultValue
(),
scope
)),
nonGroup
.
getType
(),
nonGroup
.
getDefaultValue
(),
scope
)),
genAnnotations
(
field
.
getAnnotations
(),
scope
),
"; # "
,
size
==
-
1
?
kj
::
strTree
(
"ptr["
,
regularField
.
getOffset
(),
"]"
)
:
kj
::
strTree
(
"bits["
,
regularField
.
getOffset
()
*
size
,
", "
,
(
regularField
.
getOffset
()
+
1
)
*
size
,
")"
),
"; # "
,
size
==
-
1
?
kj
::
strTree
(
"ptr["
,
nonGroup
.
getOffset
(),
"]"
)
:
kj
::
strTree
(
"bits["
,
nonGroup
.
getOffset
()
*
size
,
", "
,
(
nonGroup
.
getOffset
()
+
1
)
*
size
,
")"
),
field
.
hasDiscriminantValue
()
?
kj
::
strTree
(
", union tag = "
,
field
.
getDiscriminantValue
())
:
kj
::
strTree
(),
"
\n
"
);
...
...
c++/src/capnp/compiler/compiler.c++
View file @
cfc10236
...
...
@@ -702,8 +702,8 @@ void Compiler::Node::traverseNodeDependencies(
case
schema
:
:
Node
::
STRUCT
:
for
(
auto
field
:
schemaNode
.
getStruct
().
getFields
())
{
switch
(
field
.
which
())
{
case
schema
:
:
Field
::
REGULAR
:
traverseType
(
field
.
get
Regular
().
getType
(),
eagerness
,
seen
);
case
schema
:
:
Field
::
NON_GROUP
:
traverseType
(
field
.
get
NonGroup
().
getType
(),
eagerness
,
seen
);
break
;
case
schema
:
:
Field
::
GROUP
:
// Aux node will be scanned later.
...
...
c++/src/capnp/compiler/node-translator.c++
View file @
cfc10236
...
...
@@ -809,20 +809,20 @@ public:
switch
(
member
.
decl
.
which
())
{
case
Declaration
:
:
FIELD
:
{
auto
fieldReader
=
member
.
decl
.
getField
();
auto
regularField
=
fieldBuilder
.
initRegular
();
auto
typeBuilder
=
regularField
.
initType
();
auto
nonGroup
=
fieldBuilder
.
initNonGroup
();
auto
typeBuilder
=
nonGroup
.
initType
();
if
(
translator
.
compileType
(
fieldReader
.
getType
(),
typeBuilder
))
{
switch
(
fieldReader
.
getDefaultValue
().
which
())
{
case
Declaration
:
:
Field
::
DefaultValue
::
VALUE
:
translator
.
compileBootstrapValue
(
fieldReader
.
getDefaultValue
().
getValue
(),
typeBuilder
,
regularField
.
initDefaultValue
());
typeBuilder
,
nonGroup
.
initDefaultValue
());
break
;
case
Declaration
:
:
Field
::
DefaultValue
::
NONE
:
translator
.
compileDefaultDefaultValue
(
typeBuilder
,
regularField
.
initDefaultValue
());
translator
.
compileDefaultDefaultValue
(
typeBuilder
,
nonGroup
.
initDefaultValue
());
break
;
}
}
else
{
translator
.
compileDefaultDefaultValue
(
typeBuilder
,
regularField
.
initDefaultValue
());
translator
.
compileDefaultDefaultValue
(
typeBuilder
,
nonGroup
.
initDefaultValue
());
}
int
lgSize
=
-
1
;
...
...
@@ -851,13 +851,13 @@ public:
if
(
lgSize
==
-
2
)
{
// pointer
regularField
.
setOffset
(
member
.
fieldScope
->
addPointer
());
nonGroup
.
setOffset
(
member
.
fieldScope
->
addPointer
());
}
else
if
(
lgSize
==
-
1
)
{
// void
member
.
fieldScope
->
addVoid
();
regularField
.
setOffset
(
0
);
nonGroup
.
setOffset
(
0
);
}
else
{
regularField
.
setOffset
(
member
.
fieldScope
->
addData
(
lgSize
));
nonGroup
.
setOffset
(
member
.
fieldScope
->
addData
(
lgSize
));
}
break
;
}
...
...
@@ -1455,8 +1455,8 @@ private:
static
kj
::
Maybe
<
uint64_t
>
enumIdForField
(
StructSchema
::
Field
field
)
{
schema
::
Field
::
Reader
proto
=
field
.
getProto
();
if
(
proto
.
which
()
==
schema
::
Field
::
REGULAR
)
{
auto
type
=
proto
.
get
Regular
().
getType
();
if
(
proto
.
which
()
==
schema
::
Field
::
NON_GROUP
)
{
auto
type
=
proto
.
get
NonGroup
().
getType
();
if
(
type
.
which
()
==
schema
::
Type
::
ENUM
)
{
return
type
.
getEnum
();
}
...
...
c++/src/capnp/dynamic.c++
View file @
cfc10236
This diff is collapsed.
Click to expand it.
c++/src/capnp/encoding-test.c++
View file @
cfc10236
...
...
@@ -392,8 +392,8 @@ TEST(Encoding, UnnamedUnion) {
// The discriminant is allocated just before allocating "bar".
EXPECT_EQ
(
2
,
schema
.
getProto
().
getStruct
().
getDiscriminantOffset
());
EXPECT_EQ
(
0
,
schema
.
getFieldByName
(
"foo"
).
getProto
().
get
Regular
().
getOffset
());
EXPECT_EQ
(
2
,
schema
.
getFieldByName
(
"bar"
).
getProto
().
get
Regular
().
getOffset
());
EXPECT_EQ
(
0
,
schema
.
getFieldByName
(
"foo"
).
getProto
().
get
NonGroup
().
getOffset
());
EXPECT_EQ
(
2
,
schema
.
getFieldByName
(
"bar"
).
getProto
().
get
NonGroup
().
getOffset
());
}
TEST
(
Encoding
,
Groups
)
{
...
...
c++/src/capnp/schema-loader-test.c++
View file @
cfc10236
...
...
@@ -183,8 +183,8 @@ Schema loadUnderAlternateTypeId(SchemaLoader& loader, uint64_t id) {
// If the struct contains any self-referential members, change their type IDs as well.
auto
fields
=
root
.
getStruct
().
getFields
();
for
(
auto
field
:
fields
)
{
if
(
field
.
which
()
==
schema
::
Field
::
REGULAR
)
{
auto
type
=
field
.
get
Regular
().
getType
();
if
(
field
.
which
()
==
schema
::
Field
::
NON_GROUP
)
{
auto
type
=
field
.
get
NonGroup
().
getType
();
if
(
type
.
which
()
==
schema
::
Type
::
STRUCT
&&
type
.
getStruct
()
==
typeId
<
T
>
())
{
type
.
setStruct
(
id
);
...
...
c++/src/capnp/schema-loader.c++
View file @
cfc10236
...
...
@@ -309,17 +309,17 @@ private:
}
switch
(
field
.
which
())
{
case
schema
:
:
Field
::
REGULAR
:
{
auto
regularField
=
field
.
getRegular
();
case
schema
:
:
Field
::
NON_GROUP
:
{
auto
nonGroup
=
field
.
getNonGroup
();
uint
fieldBits
;
bool
fieldIsPointer
;
validate
(
regularField
.
getType
(),
regularField
.
getDefaultValue
(),
validate
(
nonGroup
.
getType
(),
nonGroup
.
getDefaultValue
(),
&
fieldBits
,
&
fieldIsPointer
);
VALIDATE_SCHEMA
(
fieldBits
*
(
regularField
.
getOffset
()
+
1
)
<=
dataSizeInBits
&&
fieldIsPointer
*
(
regularField
.
getOffset
()
+
1
)
<=
pointerCount
,
VALIDATE_SCHEMA
(
fieldBits
*
(
nonGroup
.
getOffset
()
+
1
)
<=
dataSizeInBits
&&
fieldIsPointer
*
(
nonGroup
.
getOffset
()
+
1
)
<=
pointerCount
,
"field offset out-of-bounds"
,
regularField
.
getOffset
(),
dataSizeInBits
,
pointerCount
);
nonGroup
.
getOffset
(),
dataSizeInBits
,
pointerCount
);
break
;
}
...
...
@@ -676,16 +676,16 @@ private:
"group field replaced with non-group or vice versa"
);
switch
(
field
.
which
())
{
case
schema
:
:
Field
::
REGULAR
:
{
auto
regularField
=
field
.
getRegular
();
auto
replacement
RegularField
=
replacement
.
getRegular
();
case
schema
:
:
Field
::
NON_GROUP
:
{
auto
nonGroup
=
field
.
getNonGroup
();
auto
replacement
NonGroup
=
replacement
.
getNonGroup
();
checkCompatibility
(
regularField
.
getType
(),
replacementRegularField
.
getType
(),
checkCompatibility
(
nonGroup
.
getType
(),
replacementNonGroup
.
getType
(),
NO_UPGRADE_TO_STRUCT
);
checkDefaultCompatibility
(
regularField
.
getDefaultValue
(),
replacement
RegularField
.
getDefaultValue
());
checkDefaultCompatibility
(
nonGroup
.
getDefaultValue
(),
replacement
NonGroup
.
getDefaultValue
());
VALIDATE_SCHEMA
(
regularField
.
getOffset
()
==
replacementRegularField
.
getOffset
(),
VALIDATE_SCHEMA
(
nonGroup
.
getOffset
()
==
replacementNonGroup
.
getOffset
(),
"field position changed"
);
break
;
}
...
...
@@ -933,7 +933,7 @@ private:
field
.
setName
(
"member0"
);
field
.
getOrdinal
().
setExplicit
(
0
);
field
.
setCodeOrder
(
0
);
field
.
init
Regular
().
setType
(
type
);
field
.
init
NonGroup
().
setType
(
type
);
loader
.
load
(
node
,
true
);
}
...
...
c++/src/capnp/schema-parser-test.c++
View file @
cfc10236
...
...
@@ -54,7 +54,7 @@ private:
static
uint64_t
getFieldTypeFileId
(
StructSchema
::
Field
field
)
{
return
field
.
getContainingStruct
()
.
getDependency
(
field
.
getProto
().
get
Regular
().
getType
().
getStruct
())
.
getDependency
(
field
.
getProto
().
get
NonGroup
().
getType
().
getStruct
())
.
getProto
().
getScopeId
();
}
...
...
c++/src/capnp/schema-test.c++
View file @
cfc10236
...
...
@@ -228,7 +228,7 @@ TEST(Schema, Lists) {
{
auto
context
=
Schema
::
from
<
TestAllTypes
>
();
auto
type
=
context
.
getFieldByName
(
"enumList"
).
getProto
().
get
Regular
().
getType
();
auto
type
=
context
.
getFieldByName
(
"enumList"
).
getProto
().
get
NonGroup
().
getType
();
ListSchema
schema
=
ListSchema
::
of
(
type
.
getList
(),
context
);
EXPECT_EQ
(
schema
::
Type
::
ENUM
,
schema
.
whichElementType
());
...
...
c++/src/capnp/schema.c++
View file @
cfc10236
...
...
@@ -159,7 +159,7 @@ kj::Maybe<StructSchema::Field> StructSchema::getFieldByDiscriminant(uint16_t dis
}
uint32_t
StructSchema
::
Field
::
getDefaultValueSchemaOffset
()
const
{
auto
defaultValue
=
proto
.
get
Regular
().
getDefaultValue
();
auto
defaultValue
=
proto
.
get
NonGroup
().
getDefaultValue
();
const
word
*
ptr
;
switch
(
defaultValue
.
which
())
{
...
...
c++/src/capnp/schema.capnp
View file @
cfc10236
...
...
@@ -178,8 +178,8 @@ struct Field {
# returns false).
union {
regular
:group {
# A regular
(non-group)
field.
nonGroup
:group {
# A regular
, non-group,
field.
offset @4 :UInt32;
# Offset, in units of the field's size, from the beginning of the section in which the field
...
...
c++/src/capnp/schema.capnp.c++
View file @
cfc10236
...
...
@@ -762,7 +762,7 @@ const ::capnp::_::RawSchema s_ec1619d4400a0290 = {
0xec1619d4400a0290
,
b_ec1619d4400a0290
.
words
,
214
,
d_ec1619d4400a0290
,
m_ec1619d4400a0290
,
2
,
13
,
i_ec1619d4400a0290
,
nullptr
,
nullptr
};
static
const
::
capnp
::
_
::
AlignedData
<
11
0
>
b_9aad50a41f4af45f
=
{
static
const
::
capnp
::
_
::
AlignedData
<
11
1
>
b_9aad50a41f4af45f
=
{
{
0
,
0
,
0
,
0
,
5
,
0
,
5
,
0
,
95
,
244
,
74
,
31
,
164
,
80
,
173
,
154
,
0
,
0
,
0
,
0
,
1
,
0
,
3
,
0
,
...
...
@@ -811,21 +811,21 @@ static const ::capnp::_::AlignedData<110> b_9aad50a41f4af45f = {
4
,
0
,
255
,
255
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
111
,
116
,
180
,
107
,
71
,
5
,
35
,
196
,
209
,
0
,
0
,
0
,
66
,
0
,
0
,
0
,
209
,
0
,
0
,
0
,
74
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
5
,
0
,
254
,
255
,
2
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
7
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
18
5
,
0
,
0
,
0
,
50
,
0
,
0
,
0
,
18
9
,
0
,
0
,
0
,
50
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
18
0
,
0
,
0
,
0
,
2
,
0
,
1
,
0
,
1
88
,
0
,
0
,
0
,
2
,
0
,
1
,
0
,
18
4
,
0
,
0
,
0
,
2
,
0
,
1
,
0
,
1
92
,
0
,
0
,
0
,
2
,
0
,
1
,
0
,
6
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
230
,
11
,
135
,
135
,
194
,
213
,
144
,
187
,
18
5
,
0
,
0
,
0
,
66
,
0
,
0
,
0
,
18
9
,
0
,
0
,
0
,
66
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
...
...
@@ -864,7 +864,8 @@ static const ::capnp::_::AlignedData<110> b_9aad50a41f4af45f = {
7
,
0
,
255
,
255
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
114
,
101
,
103
,
117
,
108
,
97
,
114
,
0
,
110
,
111
,
110
,
71
,
114
,
111
,
117
,
112
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
103
,
114
,
111
,
117
,
112
,
0
,
0
,
0
,
9
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
...
...
@@ -879,10 +880,10 @@ static const ::capnp::_::RawSchema* const d_9aad50a41f4af45f[] = {
&
s_c42305476bb4746f
,
&
s_f1c8950dab257542
,
};
static
const
uint16_t
m_9aad50a41f4af45f
[]
=
{
2
,
1
,
3
,
5
,
0
,
6
,
4
};
static
const
uint16_t
m_9aad50a41f4af45f
[]
=
{
2
,
1
,
3
,
5
,
0
,
4
,
6
};
static
const
uint16_t
i_9aad50a41f4af45f
[]
=
{
4
,
5
,
0
,
1
,
2
,
3
,
6
};
const
::
capnp
::
_
::
RawSchema
s_9aad50a41f4af45f
=
{
0x9aad50a41f4af45f
,
b_9aad50a41f4af45f
.
words
,
11
0
,
d_9aad50a41f4af45f
,
m_9aad50a41f4af45f
,
0x9aad50a41f4af45f
,
b_9aad50a41f4af45f
.
words
,
11
1
,
d_9aad50a41f4af45f
,
m_9aad50a41f4af45f
,
3
,
7
,
i_9aad50a41f4af45f
,
nullptr
,
nullptr
};
static
const
::
capnp
::
_
::
AlignedData
<
60
>
b_c42305476bb4746f
=
{
...
...
@@ -892,7 +893,7 @@ static const ::capnp::_::AlignedData<60> b_c42305476bb4746f = {
95
,
244
,
74
,
31
,
164
,
80
,
173
,
154
,
4
,
0
,
7
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
17
,
0
,
0
,
0
,
1
0
,
1
,
0
,
0
,
17
,
0
,
0
,
0
,
1
8
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
25
,
0
,
0
,
0
,
175
,
0
,
0
,
0
,
...
...
@@ -900,8 +901,8 @@ static const ::capnp::_::AlignedData<60> b_c42305476bb4746f = {
99
,
97
,
112
,
110
,
112
,
47
,
115
,
99
,
104
,
101
,
109
,
97
,
46
,
99
,
97
,
112
,
110
,
112
,
58
,
70
,
105
,
101
,
108
,
100
,
46
,
11
4
,
101
,
103
,
117
,
108
,
97
,
114
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
46
,
11
0
,
111
,
110
,
71
,
114
,
111
,
117
,
112
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
12
,
0
,
0
,
0
,
3
,
0
,
4
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
1
,
0
,
4
,
0
,
0
,
0
,
...
...
@@ -2244,7 +2245,7 @@ CAPNP_DEFINE_STRUCT(
CAPNP_DEFINE_STRUCT
(
::
capnp
::
schema
::
Field
);
CAPNP_DEFINE_STRUCT
(
::
capnp
::
schema
::
Field
::
Regular
);
::
capnp
::
schema
::
Field
::
NonGroup
);
CAPNP_DEFINE_STRUCT
(
::
capnp
::
schema
::
Field
::
Ordinal
);
CAPNP_DEFINE_STRUCT
(
...
...
c++/src/capnp/schema.capnp.h
View file @
cfc10236
...
...
@@ -78,15 +78,15 @@ struct Field {
class
Reader
;
class
Builder
;
enum
Which
:
uint16_t
{
REGULAR
,
NON_GROUP
,
GROUP
,
};
struct
Regular
;
struct
NonGroup
;
struct
Ordinal
;
};
struct
Field
::
Regular
{
Regular
()
=
delete
;
struct
Field
::
NonGroup
{
NonGroup
()
=
delete
;
class
Reader
;
class
Builder
;
...
...
@@ -279,7 +279,7 @@ CAPNP_DECLARE_STRUCT(
::
capnp
::
schema
::
Field
,
9
aad50a41f4af45f
,
3
,
4
,
INLINE_COMPOSITE
);
CAPNP_DECLARE_STRUCT
(
::
capnp
::
schema
::
Field
::
Regular
,
c42305476bb4746f
,
::
capnp
::
schema
::
Field
::
NonGroup
,
c42305476bb4746f
,
3
,
4
,
INLINE_COMPOSITE
);
CAPNP_DECLARE_STRUCT
(
::
capnp
::
schema
::
Field
::
Ordinal
,
bb90d5c287870be6
,
...
...
@@ -991,7 +991,7 @@ public:
inline
bool
hasDiscriminantValue
()
const
;
inline
::
uint16_t
getDiscriminantValue
()
const
;
inline
Regular
::
Reader
getRegular
()
const
;
inline
NonGroup
::
Reader
getNonGroup
()
const
;
inline
bool
hasGroup
()
const
;
inline
::
uint64_t
getGroup
()
const
;
...
...
@@ -1049,8 +1049,8 @@ public:
inline
::
uint16_t
getDiscriminantValue
();
inline
void
setDiscriminantValue
(
::
uint16_t
value
);
inline
Regular
::
Builder
getRegular
();
inline
Regular
::
Builder
initRegular
();
inline
NonGroup
::
Builder
getNonGroup
();
inline
NonGroup
::
Builder
initNonGroup
();
inline
bool
hasGroup
();
inline
::
uint64_t
getGroup
();
...
...
@@ -1071,9 +1071,9 @@ inline ::kj::StringTree KJ_STRINGIFY(Field::Builder builder) {
return
::
capnp
::
_
::
structString
<
Field
>
(
builder
.
_builder
.
asReader
());
}
class
Field
::
Regular
::
Reader
{
class
Field
::
NonGroup
::
Reader
{
public
:
typedef
Regular
Reads
;
typedef
NonGroup
Reads
;
Reader
()
=
default
;
inline
explicit
Reader
(
::
capnp
::
_
::
StructReader
base
)
:
_reader
(
base
)
{}
...
...
@@ -1101,16 +1101,16 @@ private:
friend
struct
::
capnp
::
List
;
friend
class
::
capnp
::
MessageBuilder
;
friend
class
::
capnp
::
Orphanage
;
friend
::
kj
::
StringTree
KJ_STRINGIFY
(
Field
::
Regular
::
Reader
reader
);
friend
::
kj
::
StringTree
KJ_STRINGIFY
(
Field
::
NonGroup
::
Reader
reader
);
};
inline
::
kj
::
StringTree
KJ_STRINGIFY
(
Field
::
Regular
::
Reader
reader
)
{
return
::
capnp
::
_
::
structString
<
Field
::
Regular
>
(
reader
.
_reader
);
inline
::
kj
::
StringTree
KJ_STRINGIFY
(
Field
::
NonGroup
::
Reader
reader
)
{
return
::
capnp
::
_
::
structString
<
Field
::
NonGroup
>
(
reader
.
_reader
);
}
class
Field
::
Regular
::
Builder
{
class
Field
::
NonGroup
::
Builder
{
public
:
typedef
Regular
Builds
;
typedef
NonGroup
Builds
;
Builder
()
=
default
;
inline
explicit
Builder
(
::
capnp
::
_
::
StructBuilder
base
)
:
_builder
(
base
)
{}
...
...
@@ -1142,11 +1142,11 @@ private:
template
<
typename
T
,
::
capnp
::
Kind
k
>
friend
struct
::
capnp
::
ToDynamic_
;
friend
class
::
capnp
::
Orphanage
;
friend
::
kj
::
StringTree
KJ_STRINGIFY
(
Field
::
Regular
::
Builder
builder
);
friend
::
kj
::
StringTree
KJ_STRINGIFY
(
Field
::
NonGroup
::
Builder
builder
);
};
inline
::
kj
::
StringTree
KJ_STRINGIFY
(
Field
::
Regular
::
Builder
builder
)
{
return
::
capnp
::
_
::
structString
<
Field
::
Regular
>
(
builder
.
_builder
.
asReader
());
inline
::
kj
::
StringTree
KJ_STRINGIFY
(
Field
::
NonGroup
::
Builder
builder
)
{
return
::
capnp
::
_
::
structString
<
Field
::
NonGroup
>
(
builder
.
_builder
.
asReader
());
}
class
Field
::
Ordinal
::
Reader
{
...
...
@@ -3208,20 +3208,20 @@ inline void Field::Builder::setDiscriminantValue( ::uint16_t value) {
1
*
::
capnp
::
ELEMENTS
,
value
,
65535u
);
}
inline
Field
::
Regular
::
Reader
Field
::
Reader
::
getRegular
()
const
{
KJ_IREQUIRE
(
which
()
==
Field
::
REGULAR
,
inline
Field
::
NonGroup
::
Reader
Field
::
Reader
::
getNonGroup
()
const
{
KJ_IREQUIRE
(
which
()
==
Field
::
NON_GROUP
,
"Must check which() before get()ing a union member."
);
return
Field
::
Regular
::
Reader
(
_reader
);
return
Field
::
NonGroup
::
Reader
(
_reader
);
}
inline
Field
::
Regular
::
Builder
Field
::
Builder
::
getRegular
()
{
KJ_IREQUIRE
(
which
()
==
Field
::
REGULAR
,
inline
Field
::
NonGroup
::
Builder
Field
::
Builder
::
getNonGroup
()
{
KJ_IREQUIRE
(
which
()
==
Field
::
NON_GROUP
,
"Must check which() before get()ing a union member."
);
return
Field
::
Regular
::
Builder
(
_builder
);
return
Field
::
NonGroup
::
Builder
(
_builder
);
}
inline
Field
::
Regular
::
Builder
Field
::
Builder
::
initRegular
()
{
inline
Field
::
NonGroup
::
Builder
Field
::
Builder
::
initNonGroup
()
{
_builder
.
setDataField
<
Field
::
Which
>
(
4
*
::
capnp
::
ELEMENTS
,
Field
::
REGULAR
);
return
Field
::
Regular
::
Builder
(
_builder
);
4
*
::
capnp
::
ELEMENTS
,
Field
::
NON_GROUP
);
return
Field
::
NonGroup
::
Builder
(
_builder
);
}
inline
bool
Field
::
Reader
::
hasGroup
()
const
{
KJ_IREQUIRE
(
which
()
==
Field
::
GROUP
,
...
...
@@ -3263,87 +3263,87 @@ inline Field::Ordinal::Builder Field::Builder::getOrdinal() {
inline
Field
::
Ordinal
::
Builder
Field
::
Builder
::
initOrdinal
()
{
return
Field
::
Ordinal
::
Builder
(
_builder
);
}
inline
bool
Field
::
Regular
::
Reader
::
hasOffset
()
const
{
inline
bool
Field
::
NonGroup
::
Reader
::
hasOffset
()
const
{
return
_reader
.
hasDataField
<
::
uint32_t
>
(
1
*
::
capnp
::
ELEMENTS
);
}
inline
bool
Field
::
Regular
::
Builder
::
hasOffset
()
{
inline
bool
Field
::
NonGroup
::
Builder
::
hasOffset
()
{
return
_builder
.
hasDataField
<
::
uint32_t
>
(
1
*
::
capnp
::
ELEMENTS
);
}
inline
::
uint32_t
Field
::
Regular
::
Reader
::
getOffset
()
const
{
inline
::
uint32_t
Field
::
NonGroup
::
Reader
::
getOffset
()
const
{
return
_reader
.
getDataField
<
::
uint32_t
>
(
1
*
::
capnp
::
ELEMENTS
);
}
inline
::
uint32_t
Field
::
Regular
::
Builder
::
getOffset
()
{
inline
::
uint32_t
Field
::
NonGroup
::
Builder
::
getOffset
()
{
return
_builder
.
getDataField
<
::
uint32_t
>
(
1
*
::
capnp
::
ELEMENTS
);
}
inline
void
Field
::
Regular
::
Builder
::
setOffset
(
::
uint32_t
value
)
{
inline
void
Field
::
NonGroup
::
Builder
::
setOffset
(
::
uint32_t
value
)
{
_builder
.
setDataField
<
::
uint32_t
>
(
1
*
::
capnp
::
ELEMENTS
,
value
);
}
inline
bool
Field
::
Regular
::
Reader
::
hasType
()
const
{
inline
bool
Field
::
NonGroup
::
Reader
::
hasType
()
const
{
return
!
_reader
.
isPointerFieldNull
(
2
*
::
capnp
::
POINTERS
);
}
inline
bool
Field
::
Regular
::
Builder
::
hasType
()
{
inline
bool
Field
::
NonGroup
::
Builder
::
hasType
()
{
return
!
_builder
.
isPointerFieldNull
(
2
*
::
capnp
::
POINTERS
);
}
inline
::
capnp
::
schema
::
Type
::
Reader
Field
::
Regular
::
Reader
::
getType
()
const
{
inline
::
capnp
::
schema
::
Type
::
Reader
Field
::
NonGroup
::
Reader
::
getType
()
const
{
return
::
capnp
::
_
::
PointerHelpers
<
::
capnp
::
schema
::
Type
>::
get
(
_reader
,
2
*
::
capnp
::
POINTERS
);
}
inline
::
capnp
::
schema
::
Type
::
Builder
Field
::
Regular
::
Builder
::
getType
()
{
inline
::
capnp
::
schema
::
Type
::
Builder
Field
::
NonGroup
::
Builder
::
getType
()
{
return
::
capnp
::
_
::
PointerHelpers
<
::
capnp
::
schema
::
Type
>::
get
(
_builder
,
2
*
::
capnp
::
POINTERS
);
}
inline
void
Field
::
Regular
::
Builder
::
setType
(
::
capnp
::
schema
::
Type
::
Reader
value
)
{
inline
void
Field
::
NonGroup
::
Builder
::
setType
(
::
capnp
::
schema
::
Type
::
Reader
value
)
{
::
capnp
::
_
::
PointerHelpers
<
::
capnp
::
schema
::
Type
>::
set
(
_builder
,
2
*
::
capnp
::
POINTERS
,
value
);
}
inline
::
capnp
::
schema
::
Type
::
Builder
Field
::
Regular
::
Builder
::
initType
()
{
inline
::
capnp
::
schema
::
Type
::
Builder
Field
::
NonGroup
::
Builder
::
initType
()
{
return
::
capnp
::
_
::
PointerHelpers
<
::
capnp
::
schema
::
Type
>::
init
(
_builder
,
2
*
::
capnp
::
POINTERS
);
}
inline
void
Field
::
Regular
::
Builder
::
adoptType
(
inline
void
Field
::
NonGroup
::
Builder
::
adoptType
(
::
capnp
::
Orphan
<
::
capnp
::
schema
::
Type
>&&
value
)
{
::
capnp
::
_
::
PointerHelpers
<
::
capnp
::
schema
::
Type
>::
adopt
(
_builder
,
2
*
::
capnp
::
POINTERS
,
kj
::
mv
(
value
));
}
inline
::
capnp
::
Orphan
<
::
capnp
::
schema
::
Type
>
Field
::
Regular
::
Builder
::
disownType
()
{
inline
::
capnp
::
Orphan
<
::
capnp
::
schema
::
Type
>
Field
::
NonGroup
::
Builder
::
disownType
()
{
return
::
capnp
::
_
::
PointerHelpers
<
::
capnp
::
schema
::
Type
>::
disown
(
_builder
,
2
*
::
capnp
::
POINTERS
);
}
inline
bool
Field
::
Regular
::
Reader
::
hasDefaultValue
()
const
{
inline
bool
Field
::
NonGroup
::
Reader
::
hasDefaultValue
()
const
{
return
!
_reader
.
isPointerFieldNull
(
3
*
::
capnp
::
POINTERS
);
}
inline
bool
Field
::
Regular
::
Builder
::
hasDefaultValue
()
{
inline
bool
Field
::
NonGroup
::
Builder
::
hasDefaultValue
()
{
return
!
_builder
.
isPointerFieldNull
(
3
*
::
capnp
::
POINTERS
);
}
inline
::
capnp
::
schema
::
Value
::
Reader
Field
::
Regular
::
Reader
::
getDefaultValue
()
const
{
inline
::
capnp
::
schema
::
Value
::
Reader
Field
::
NonGroup
::
Reader
::
getDefaultValue
()
const
{
return
::
capnp
::
_
::
PointerHelpers
<
::
capnp
::
schema
::
Value
>::
get
(
_reader
,
3
*
::
capnp
::
POINTERS
);
}
inline
::
capnp
::
schema
::
Value
::
Builder
Field
::
Regular
::
Builder
::
getDefaultValue
()
{
inline
::
capnp
::
schema
::
Value
::
Builder
Field
::
NonGroup
::
Builder
::
getDefaultValue
()
{
return
::
capnp
::
_
::
PointerHelpers
<
::
capnp
::
schema
::
Value
>::
get
(
_builder
,
3
*
::
capnp
::
POINTERS
);
}
inline
void
Field
::
Regular
::
Builder
::
setDefaultValue
(
::
capnp
::
schema
::
Value
::
Reader
value
)
{
inline
void
Field
::
NonGroup
::
Builder
::
setDefaultValue
(
::
capnp
::
schema
::
Value
::
Reader
value
)
{
::
capnp
::
_
::
PointerHelpers
<
::
capnp
::
schema
::
Value
>::
set
(
_builder
,
3
*
::
capnp
::
POINTERS
,
value
);
}
inline
::
capnp
::
schema
::
Value
::
Builder
Field
::
Regular
::
Builder
::
initDefaultValue
()
{
inline
::
capnp
::
schema
::
Value
::
Builder
Field
::
NonGroup
::
Builder
::
initDefaultValue
()
{
return
::
capnp
::
_
::
PointerHelpers
<
::
capnp
::
schema
::
Value
>::
init
(
_builder
,
3
*
::
capnp
::
POINTERS
);
}
inline
void
Field
::
Regular
::
Builder
::
adoptDefaultValue
(
inline
void
Field
::
NonGroup
::
Builder
::
adoptDefaultValue
(
::
capnp
::
Orphan
<
::
capnp
::
schema
::
Value
>&&
value
)
{
::
capnp
::
_
::
PointerHelpers
<
::
capnp
::
schema
::
Value
>::
adopt
(
_builder
,
3
*
::
capnp
::
POINTERS
,
kj
::
mv
(
value
));
}
inline
::
capnp
::
Orphan
<
::
capnp
::
schema
::
Value
>
Field
::
Regular
::
Builder
::
disownDefaultValue
()
{
inline
::
capnp
::
Orphan
<
::
capnp
::
schema
::
Value
>
Field
::
NonGroup
::
Builder
::
disownDefaultValue
()
{
return
::
capnp
::
_
::
PointerHelpers
<
::
capnp
::
schema
::
Value
>::
disown
(
_builder
,
3
*
::
capnp
::
POINTERS
);
}
...
...
c++/src/capnp/stringify.c++
View file @
cfc10236
...
...
@@ -102,8 +102,8 @@ private:
static
schema
::
Type
::
Which
whichFieldType
(
const
StructSchema
::
Field
&
field
)
{
auto
proto
=
field
.
getProto
();
switch
(
proto
.
which
())
{
case
schema
:
:
Field
::
REGULAR
:
return
proto
.
get
Regular
().
getType
().
which
();
case
schema
:
:
Field
::
NON_GROUP
:
return
proto
.
get
NonGroup
().
getType
().
which
();
case
schema
:
:
Field
::
GROUP
:
return
schema
::
Type
::
STRUCT
;
}
...
...
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