Commit 9da143f8 authored by Kenton Varda's avatar Kenton Varda

Have Node's enum and interface fields be groups with a single field, for future expandability.

parent 561f5ed2
...@@ -98,7 +98,7 @@ void enumerateDeps(schema::Node::Reader node, std::set<uint64_t>& deps) { ...@@ -98,7 +98,7 @@ void enumerateDeps(schema::Node::Reader node, std::set<uint64_t>& deps) {
break; break;
} }
case schema::Node::INTERFACE: case schema::Node::INTERFACE:
for (auto method: node.getInterface()) { for (auto method: node.getInterface().getMethods()) {
for (auto param: method.getParams()) { for (auto param: method.getParams()) {
enumerateDeps(param.getType(), deps); enumerateDeps(param.getType(), deps);
} }
......
...@@ -262,7 +262,7 @@ private: ...@@ -262,7 +262,7 @@ private:
case schema::Value::ENUM: { case schema::Value::ENUM: {
KJ_REQUIRE(type.which() == schema::Type::ENUM, "type/value mismatch"); KJ_REQUIRE(type.which() == schema::Type::ENUM, "type/value mismatch");
auto enumNode = scope.getDependency(type.getEnum()).asEnum().getProto(); auto enumNode = scope.getDependency(type.getEnum()).asEnum().getProto();
auto enumerants = enumNode.getEnum(); auto enumerants = enumNode.getEnum().getEnumerants();
KJ_REQUIRE(value.getEnum() < enumerants.size(), KJ_REQUIRE(value.getEnum() < enumerants.size(),
"Enum value out-of-range.", value.getEnum(), enumNode.getDisplayName()); "Enum value out-of-range.", value.getEnum(), enumNode.getDisplayName());
return kj::strTree(enumerants[value.getEnum()].getName()); return kj::strTree(enumerants[value.getEnum()].getName());
......
...@@ -715,13 +715,13 @@ void Compiler::Node::traverseNodeDependencies( ...@@ -715,13 +715,13 @@ void Compiler::Node::traverseNodeDependencies(
break; break;
case schema::Node::ENUM: case schema::Node::ENUM:
for (auto enumerant: schemaNode.getEnum()) { for (auto enumerant: schemaNode.getEnum().getEnumerants()) {
traverseAnnotations(enumerant.getAnnotations(), eagerness, seen); traverseAnnotations(enumerant.getAnnotations(), eagerness, seen);
} }
break; break;
case schema::Node::INTERFACE: case schema::Node::INTERFACE:
for (auto method: schemaNode.getInterface()) { for (auto method: schemaNode.getInterface().getMethods()) {
for (auto param: method.getParams()) { for (auto param: method.getParams()) {
traverseType(param.getType(), eagerness, seen); traverseType(param.getType(), eagerness, seen);
traverseAnnotations(param.getAnnotations(), eagerness, seen); traverseAnnotations(param.getAnnotations(), eagerness, seen);
......
...@@ -761,7 +761,7 @@ void NodeTranslator::compileEnum(Void decl, ...@@ -761,7 +761,7 @@ void NodeTranslator::compileEnum(Void decl,
} }
} }
auto list = builder.initEnum(enumerants.size()); auto list = builder.initEnum().initEnumerants(enumerants.size());
uint i = 0; uint i = 0;
DuplicateOrdinalDetector dupDetector(errorReporter); DuplicateOrdinalDetector dupDetector(errorReporter);
......
...@@ -351,7 +351,8 @@ private: ...@@ -351,7 +351,8 @@ private:
} }
} }
void validate(const List<schema::Enumerant>::Reader& enumerants) { void validate(const schema::Node::Enum::Reader& enumNode) {
auto enumerants = enumNode.getEnumerants();
KJ_STACK_ARRAY(bool, sawCodeOrder, enumerants.size(), 32, 256); KJ_STACK_ARRAY(bool, sawCodeOrder, enumerants.size(), 32, 256);
memset(sawCodeOrder.begin(), 0, sawCodeOrder.size() * sizeof(sawCodeOrder[0])); memset(sawCodeOrder.begin(), 0, sawCodeOrder.size() * sizeof(sawCodeOrder[0]));
...@@ -366,7 +367,8 @@ private: ...@@ -366,7 +367,8 @@ private:
} }
} }
void validate(const List<schema::Method>::Reader& methods) { void validate(const schema::Node::Interface::Reader& interfaceNode) {
auto methods = interfaceNode.getMethods();
KJ_STACK_ARRAY(bool, sawCodeOrder, methods.size(), 32, 256); KJ_STACK_ARRAY(bool, sawCodeOrder, methods.size(), 32, 256);
memset(sawCodeOrder.begin(), 0, sawCodeOrder.size() * sizeof(sawCodeOrder[0])); memset(sawCodeOrder.begin(), 0, sawCodeOrder.size() * sizeof(sawCodeOrder[0]));
...@@ -694,10 +696,10 @@ private: ...@@ -694,10 +696,10 @@ private:
} }
} }
void checkCompatibility(const List<schema::Enumerant>::Reader& enumerants, void checkCompatibility(const schema::Node::Enum::Reader& enumNode,
const List<schema::Enumerant>::Reader& replacementEnumerants) { const schema::Node::Enum::Reader& replacement) {
uint size = enumerants.size(); uint size = enumNode.getEnumerants().size();
uint replacementSize = replacementEnumerants.size(); uint replacementSize = replacement.getEnumerants().size();
if (replacementSize > size) { if (replacementSize > size) {
replacementIsNewer(); replacementIsNewer();
} else if (replacementSize < size) { } else if (replacementSize < size) {
...@@ -705,8 +707,11 @@ private: ...@@ -705,8 +707,11 @@ private:
} }
} }
void checkCompatibility(const List<schema::Method>::Reader& methods, void checkCompatibility(const schema::Node::Interface::Reader& interfaceNode,
const List<schema::Method>::Reader& replacementMethods) { const schema::Node::Interface::Reader& replacement) {
auto methods = interfaceNode.getMethods();
auto replacementMethods = replacement.getMethods();
if (replacementMethods.size() > methods.size()) { if (replacementMethods.size() > methods.size()) {
replacementIsNewer(); replacementIsNewer();
} else if (replacementMethods.size() < methods.size()) { } else if (replacementMethods.size() < methods.size()) {
...@@ -1169,8 +1174,8 @@ _::RawSchema* SchemaLoader::Impl::loadEmpty( ...@@ -1169,8 +1174,8 @@ _::RawSchema* SchemaLoader::Impl::loadEmpty(
node.setDisplayName(name); node.setDisplayName(name);
switch (kind) { switch (kind) {
case schema::Node::STRUCT: node.initStruct(); break; case schema::Node::STRUCT: node.initStruct(); break;
case schema::Node::ENUM: node.initEnum(0); break; case schema::Node::ENUM: node.initEnum(); break;
case schema::Node::INTERFACE: node.initInterface(0); break; case schema::Node::INTERFACE: node.initInterface(); break;
case schema::Node::FILE: case schema::Node::FILE:
case schema::Node::CONST: case schema::Node::CONST:
......
...@@ -131,7 +131,7 @@ TEST(Schema, Enums) { ...@@ -131,7 +131,7 @@ TEST(Schema, Enums) {
EXPECT_TRUE(schema.asEnum() == schema); EXPECT_TRUE(schema.asEnum() == schema);
ASSERT_EQ(schema.getEnumerants().size(), ASSERT_EQ(schema.getEnumerants().size(),
schema.getProto().getEnum().size()); schema.getProto().getEnum().getEnumerants().size());
EnumSchema::Enumerant enumerant = schema.getEnumerants()[0]; EnumSchema::Enumerant enumerant = schema.getEnumerants()[0];
EXPECT_EQ("foo", enumerant.getProto().getName()); EXPECT_EQ("foo", enumerant.getProto().getName());
EXPECT_TRUE(enumerant.getContainingEnum() == schema); EXPECT_TRUE(enumerant.getContainingEnum() == schema);
......
...@@ -189,7 +189,7 @@ uint32_t StructSchema::Field::getDefaultValueSchemaOffset() const { ...@@ -189,7 +189,7 @@ uint32_t StructSchema::Field::getDefaultValueSchemaOffset() const {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
EnumSchema::EnumerantList EnumSchema::getEnumerants() const { EnumSchema::EnumerantList EnumSchema::getEnumerants() const {
return EnumerantList(*this, getProto().getEnum()); return EnumerantList(*this, getProto().getEnum().getEnumerants());
} }
kj::Maybe<EnumSchema::Enumerant> EnumSchema::findEnumerantByName(kj::StringPtr name) const { kj::Maybe<EnumSchema::Enumerant> EnumSchema::findEnumerantByName(kj::StringPtr name) const {
...@@ -207,7 +207,7 @@ EnumSchema::Enumerant EnumSchema::getEnumerantByName(kj::StringPtr name) const { ...@@ -207,7 +207,7 @@ EnumSchema::Enumerant EnumSchema::getEnumerantByName(kj::StringPtr name) const {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
InterfaceSchema::MethodList InterfaceSchema::getMethods() const { InterfaceSchema::MethodList InterfaceSchema::getMethods() const {
return MethodList(*this, getProto().getInterface()); return MethodList(*this, getProto().getInterface().getMethods());
} }
kj::Maybe<InterfaceSchema::Method> InterfaceSchema::findMethodByName(kj::StringPtr name) const { kj::Maybe<InterfaceSchema::Method> InterfaceSchema::findMethodByName(kj::StringPtr name) const {
......
...@@ -120,11 +120,15 @@ struct Node { ...@@ -120,11 +120,15 @@ struct Node {
# most sense to use the field's index in this list rather than its ordinal. # most sense to use the field's index in this list rather than its ordinal.
} }
enum @14 :List(Enumerant); enum :group {
# Enumerants ordered by numeric value (ordinal). enumerants@14 :List(Enumerant);
# Enumerants ordered by numeric value (ordinal).
}
interface @15 :List(Method); interface :group {
# Methods ordered by ordinal. methods @15 :List(Method);
# Methods ordered by ordinal.
}
const :group { const :group {
type @16 :Type; type @16 :Type;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
namespace capnp { namespace capnp {
namespace schemas { namespace schemas {
static const ::capnp::_::AlignedData<189> b_e682ab4cf923a417 = { static const ::capnp::_::AlignedData<171> b_e682ab4cf923a417 = {
{ 0, 0, 0, 0, 5, 0, 5, 0, { 0, 0, 0, 0, 5, 0, 5, 0,
23, 164, 35, 249, 76, 171, 130, 230, 23, 164, 35, 249, 76, 171, 130, 230,
0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 1, 0, 5, 0,
...@@ -82,31 +82,31 @@ static const ::capnp::_::AlignedData<189> b_e682ab4cf923a417 = { ...@@ -82,31 +82,31 @@ static const ::capnp::_::AlignedData<189> b_e682ab4cf923a417 = {
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, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8, 0, 253, 255, 3, 0, 0, 0, 8, 0, 253, 255, 0, 0, 0, 0,
0, 0, 1, 0, 14, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 152, 245, 51, 67, 54, 179, 74, 181,
85, 1, 0, 0, 42, 0, 0, 0, 85, 1, 0, 0, 42, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
80, 1, 0, 0, 2, 0, 1, 0,
100, 1, 0, 0, 2, 0, 1, 0,
9, 0, 252, 255, 3, 0, 0, 0,
0, 0, 1, 0, 15, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
97, 1, 0, 0, 82, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
96, 1, 0, 0, 2, 0, 1, 0, 9, 0, 252, 255, 0, 0, 0, 0,
116, 1, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,
143, 33, 194, 240, 207, 83, 39, 232,
61, 1, 0, 0, 82, 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,
10, 0, 251, 255, 0, 0, 0, 0, 10, 0, 251, 255, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
32, 148, 13, 122, 172, 165, 138, 177, 32, 148, 13, 122, 172, 165, 138, 177,
113, 1, 0, 0, 50, 0, 0, 0, 41, 1, 0, 0, 50, 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, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
11, 0, 250, 255, 0, 0, 0, 0, 11, 0, 250, 255, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
144, 2, 10, 64, 212, 25, 22, 236, 144, 2, 10, 64, 212, 25, 22, 236,
89, 1, 0, 0, 90, 0, 0, 0, 17, 1, 0, 0, 90, 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, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
...@@ -172,43 +172,25 @@ static const ::capnp::_::AlignedData<189> b_e682ab4cf923a417 = { ...@@ -172,43 +172,25 @@ static const ::capnp::_::AlignedData<189> b_e682ab4cf923a417 = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
115, 116, 114, 117, 99, 116, 0, 0, 115, 116, 114, 117, 99, 116, 0, 0,
101, 110, 117, 109, 0, 0, 0, 0, 101, 110, 117, 109, 0, 0, 0, 0,
14, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 2, 0, 1, 0,
16, 0, 0, 0, 0, 0, 0, 0,
77, 154, 84, 220, 235, 124, 138, 151,
0, 0, 0, 0, 0, 0, 0, 0,
14, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
105, 110, 116, 101, 114, 102, 97, 99, 105, 110, 116, 101, 114, 102, 97, 99,
101, 0, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0,
14, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 2, 0, 1, 0,
16, 0, 0, 0, 0, 0, 0, 0,
128, 77, 51, 59, 226, 204, 0, 149,
0, 0, 0, 0, 0, 0, 0, 0,
14, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
99, 111, 110, 115, 116, 0, 0, 0, 99, 111, 110, 115, 116, 0, 0, 0,
97, 110, 110, 111, 116, 97, 116, 105, 97, 110, 110, 111, 116, 97, 116, 105,
111, 110, 0, 0, 0, 0, 0, 0, } 111, 110, 0, 0, 0, 0, 0, 0, }
}; };
static const ::capnp::_::RawSchema* const d_e682ab4cf923a417[] = { static const ::capnp::_::RawSchema* const d_e682ab4cf923a417[] = {
&s_9500cce23b334d80,
&s_978a7cebdc549a4d,
&s_9ea0b19b37fb4435, &s_9ea0b19b37fb4435,
&s_b18aa5ac7a0d9420, &s_b18aa5ac7a0d9420,
&s_b54ab3364333f598,
&s_debf55bbfa0fc242, &s_debf55bbfa0fc242,
&s_e82753cff0c2218f,
&s_ec1619d4400a0290, &s_ec1619d4400a0290,
&s_f1c8950dab257542, &s_f1c8950dab257542,
}; };
static const uint16_t m_e682ab4cf923a417[] = {11, 5, 10, 1, 2, 8, 6, 0, 9, 4, 3, 7}; static const uint16_t m_e682ab4cf923a417[] = {11, 5, 10, 1, 2, 8, 6, 0, 9, 4, 3, 7};
static const uint16_t i_e682ab4cf923a417[] = {6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5}; static const uint16_t i_e682ab4cf923a417[] = {6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5};
const ::capnp::_::RawSchema s_e682ab4cf923a417 = { const ::capnp::_::RawSchema s_e682ab4cf923a417 = {
0xe682ab4cf923a417, b_e682ab4cf923a417.words, 189, d_e682ab4cf923a417, m_e682ab4cf923a417, 0xe682ab4cf923a417, b_e682ab4cf923a417.words, 171, d_e682ab4cf923a417, m_e682ab4cf923a417,
7, 12, i_e682ab4cf923a417, nullptr, nullptr 7, 12, i_e682ab4cf923a417, nullptr, nullptr
}; };
static const ::capnp::_::AlignedData<46> b_debf55bbfa0fc242 = { static const ::capnp::_::AlignedData<46> b_debf55bbfa0fc242 = {
...@@ -407,6 +389,98 @@ const ::capnp::_::RawSchema s_9ea0b19b37fb4435 = { ...@@ -407,6 +389,98 @@ const ::capnp::_::RawSchema s_9ea0b19b37fb4435 = {
0x9ea0b19b37fb4435, b_9ea0b19b37fb4435.words, 127, d_9ea0b19b37fb4435, m_9ea0b19b37fb4435, 0x9ea0b19b37fb4435, b_9ea0b19b37fb4435.words, 127, d_9ea0b19b37fb4435, m_9ea0b19b37fb4435,
3, 7, i_9ea0b19b37fb4435, nullptr, nullptr 3, 7, i_9ea0b19b37fb4435, nullptr, nullptr
}; };
static const ::capnp::_::AlignedData<34> b_b54ab3364333f598 = {
{ 0, 0, 0, 0, 5, 0, 5, 0,
152, 245, 51, 67, 54, 179, 74, 181,
24, 0, 0, 0, 1, 0, 5, 0,
23, 164, 35, 249, 76, 171, 130, 230,
5, 0, 7, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
17, 0, 0, 0, 234, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
21, 0, 0, 0, 63, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
99, 97, 112, 110, 112, 47, 115, 99,
104, 101, 109, 97, 46, 99, 97, 112,
110, 112, 58, 78, 111, 100, 101, 46,
101, 110, 117, 109, 0, 0, 0, 0,
4, 0, 0, 0, 3, 0, 4, 0,
0, 0, 0, 0, 3, 0, 0, 0,
0, 0, 1, 0, 14, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
13, 0, 0, 0, 90, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
12, 0, 0, 0, 2, 0, 1, 0,
32, 0, 0, 0, 2, 0, 1, 0,
101, 110, 117, 109, 101, 114, 97, 110,
116, 115, 0, 0, 0, 0, 0, 0,
14, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 2, 0, 1, 0,
16, 0, 0, 0, 0, 0, 0, 0,
77, 154, 84, 220, 235, 124, 138, 151,
0, 0, 0, 0, 0, 0, 0, 0,
14, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, }
};
static const ::capnp::_::RawSchema* const d_b54ab3364333f598[] = {
&s_978a7cebdc549a4d,
&s_e682ab4cf923a417,
};
static const uint16_t m_b54ab3364333f598[] = {0};
static const uint16_t i_b54ab3364333f598[] = {0};
const ::capnp::_::RawSchema s_b54ab3364333f598 = {
0xb54ab3364333f598, b_b54ab3364333f598.words, 34, d_b54ab3364333f598, m_b54ab3364333f598,
2, 1, i_b54ab3364333f598, nullptr, nullptr
};
static const ::capnp::_::AlignedData<34> b_e82753cff0c2218f = {
{ 0, 0, 0, 0, 5, 0, 5, 0,
143, 33, 194, 240, 207, 83, 39, 232,
24, 0, 0, 0, 1, 0, 5, 0,
23, 164, 35, 249, 76, 171, 130, 230,
5, 0, 7, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
17, 0, 0, 0, 18, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
25, 0, 0, 0, 63, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
99, 97, 112, 110, 112, 47, 115, 99,
104, 101, 109, 97, 46, 99, 97, 112,
110, 112, 58, 78, 111, 100, 101, 46,
105, 110, 116, 101, 114, 102, 97, 99,
101, 0, 0, 0, 0, 0, 0, 0,
4, 0, 0, 0, 3, 0, 4, 0,
0, 0, 0, 0, 3, 0, 0, 0,
0, 0, 1, 0, 15, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
13, 0, 0, 0, 66, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 2, 0, 1, 0,
28, 0, 0, 0, 2, 0, 1, 0,
109, 101, 116, 104, 111, 100, 115, 0,
14, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 2, 0, 1, 0,
16, 0, 0, 0, 0, 0, 0, 0,
128, 77, 51, 59, 226, 204, 0, 149,
0, 0, 0, 0, 0, 0, 0, 0,
14, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, }
};
static const ::capnp::_::RawSchema* const d_e82753cff0c2218f[] = {
&s_9500cce23b334d80,
&s_e682ab4cf923a417,
};
static const uint16_t m_e82753cff0c2218f[] = {0};
static const uint16_t i_e82753cff0c2218f[] = {0};
const ::capnp::_::RawSchema s_e82753cff0c2218f = {
0xe82753cff0c2218f, b_e82753cff0c2218f.words, 34, d_e82753cff0c2218f, m_e82753cff0c2218f,
2, 1, i_e82753cff0c2218f, nullptr, nullptr
};
static const ::capnp::_::AlignedData<44> b_b18aa5ac7a0d9420 = { static const ::capnp::_::AlignedData<44> b_b18aa5ac7a0d9420 = {
{ 0, 0, 0, 0, 5, 0, 5, 0, { 0, 0, 0, 0, 5, 0, 5, 0,
32, 148, 13, 122, 172, 165, 138, 177, 32, 148, 13, 122, 172, 165, 138, 177,
...@@ -2161,6 +2235,10 @@ CAPNP_DEFINE_STRUCT( ...@@ -2161,6 +2235,10 @@ CAPNP_DEFINE_STRUCT(
::capnp::schema::Node::NestedNode); ::capnp::schema::Node::NestedNode);
CAPNP_DEFINE_STRUCT( CAPNP_DEFINE_STRUCT(
::capnp::schema::Node::Struct); ::capnp::schema::Node::Struct);
CAPNP_DEFINE_STRUCT(
::capnp::schema::Node::Enum);
CAPNP_DEFINE_STRUCT(
::capnp::schema::Node::Interface);
CAPNP_DEFINE_STRUCT( CAPNP_DEFINE_STRUCT(
::capnp::schema::Node::Const); ::capnp::schema::Node::Const);
CAPNP_DEFINE_STRUCT( CAPNP_DEFINE_STRUCT(
......
...@@ -24,6 +24,8 @@ struct Node { ...@@ -24,6 +24,8 @@ struct Node {
}; };
struct NestedNode; struct NestedNode;
struct Struct; struct Struct;
struct Enum;
struct Interface;
struct Const; struct Const;
struct Annotation; struct Annotation;
}; };
...@@ -42,6 +44,20 @@ struct Node::Struct { ...@@ -42,6 +44,20 @@ struct Node::Struct {
class Builder; class Builder;
}; };
struct Node::Enum {
Enum() = delete;
class Reader;
class Builder;
};
struct Node::Interface {
Interface() = delete;
class Reader;
class Builder;
};
struct Node::Const { struct Node::Const {
Const() = delete; Const() = delete;
...@@ -217,6 +233,8 @@ namespace schemas { ...@@ -217,6 +233,8 @@ namespace schemas {
extern const ::capnp::_::RawSchema s_e682ab4cf923a417; extern const ::capnp::_::RawSchema s_e682ab4cf923a417;
extern const ::capnp::_::RawSchema s_debf55bbfa0fc242; extern const ::capnp::_::RawSchema s_debf55bbfa0fc242;
extern const ::capnp::_::RawSchema s_9ea0b19b37fb4435; extern const ::capnp::_::RawSchema s_9ea0b19b37fb4435;
extern const ::capnp::_::RawSchema s_b54ab3364333f598;
extern const ::capnp::_::RawSchema s_e82753cff0c2218f;
extern const ::capnp::_::RawSchema s_b18aa5ac7a0d9420; extern const ::capnp::_::RawSchema s_b18aa5ac7a0d9420;
extern const ::capnp::_::RawSchema s_ec1619d4400a0290; extern const ::capnp::_::RawSchema s_ec1619d4400a0290;
extern const ::capnp::_::RawSchema s_9aad50a41f4af45f; extern const ::capnp::_::RawSchema s_9aad50a41f4af45f;
...@@ -245,6 +263,12 @@ CAPNP_DECLARE_STRUCT( ...@@ -245,6 +263,12 @@ CAPNP_DECLARE_STRUCT(
CAPNP_DECLARE_STRUCT( CAPNP_DECLARE_STRUCT(
::capnp::schema::Node::Struct, 9ea0b19b37fb4435, ::capnp::schema::Node::Struct, 9ea0b19b37fb4435,
5, 5, INLINE_COMPOSITE); 5, 5, INLINE_COMPOSITE);
CAPNP_DECLARE_STRUCT(
::capnp::schema::Node::Enum, b54ab3364333f598,
5, 5, INLINE_COMPOSITE);
CAPNP_DECLARE_STRUCT(
::capnp::schema::Node::Interface, e82753cff0c2218f,
5, 5, INLINE_COMPOSITE);
CAPNP_DECLARE_STRUCT( CAPNP_DECLARE_STRUCT(
::capnp::schema::Node::Const, b18aa5ac7a0d9420, ::capnp::schema::Node::Const, b18aa5ac7a0d9420,
5, 5, INLINE_COMPOSITE); 5, 5, INLINE_COMPOSITE);
...@@ -333,11 +357,9 @@ public: ...@@ -333,11 +357,9 @@ public:
inline Struct::Reader getStruct() const; inline Struct::Reader getStruct() const;
inline bool hasEnum() const; inline Enum::Reader getEnum() const;
inline ::capnp::List< ::capnp::schema::Enumerant>::Reader getEnum() const;
inline bool hasInterface() const; inline Interface::Reader getInterface() const;
inline ::capnp::List< ::capnp::schema::Method>::Reader getInterface() const;
inline Const::Reader getConst() const; inline Const::Reader getConst() const;
...@@ -412,19 +434,11 @@ public: ...@@ -412,19 +434,11 @@ public:
inline Struct::Builder getStruct(); inline Struct::Builder getStruct();
inline Struct::Builder initStruct(); inline Struct::Builder initStruct();
inline bool hasEnum(); inline Enum::Builder getEnum();
inline ::capnp::List< ::capnp::schema::Enumerant>::Builder getEnum(); inline Enum::Builder initEnum();
inline void setEnum( ::capnp::List< ::capnp::schema::Enumerant>::Reader value);
inline ::capnp::List< ::capnp::schema::Enumerant>::Builder initEnum(unsigned int size);
inline void adoptEnum(::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>>&& value);
inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>> disownEnum();
inline bool hasInterface(); inline Interface::Builder getInterface();
inline ::capnp::List< ::capnp::schema::Method>::Builder getInterface(); inline Interface::Builder initInterface();
inline void setInterface( ::capnp::List< ::capnp::schema::Method>::Reader value);
inline ::capnp::List< ::capnp::schema::Method>::Builder initInterface(unsigned int size);
inline void adoptInterface(::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>>&& value);
inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>> disownInterface();
inline Const::Builder getConst(); inline Const::Builder getConst();
inline Const::Builder initConst(); inline Const::Builder initConst();
...@@ -615,6 +629,128 @@ inline ::kj::StringTree KJ_STRINGIFY(Node::Struct::Builder builder) { ...@@ -615,6 +629,128 @@ inline ::kj::StringTree KJ_STRINGIFY(Node::Struct::Builder builder) {
return ::capnp::_::structString<Node::Struct>(builder._builder.asReader()); return ::capnp::_::structString<Node::Struct>(builder._builder.asReader());
} }
class Node::Enum::Reader {
public:
typedef Enum Reads;
Reader() = default;
inline explicit Reader(::capnp::_::StructReader base): _reader(base) {}
inline size_t totalSizeInWords() const {
return _reader.totalSize() / ::capnp::WORDS;
}
inline bool hasEnumerants() const;
inline ::capnp::List< ::capnp::schema::Enumerant>::Reader getEnumerants() const;
private:
::capnp::_::StructReader _reader;
template <typename T, ::capnp::Kind k>
friend struct ::capnp::ToDynamic_;
template <typename T, ::capnp::Kind k>
friend struct ::capnp::_::PointerHelpers;
template <typename T, ::capnp::Kind k>
friend struct ::capnp::List;
friend class ::capnp::MessageBuilder;
friend class ::capnp::Orphanage;
friend ::kj::StringTree KJ_STRINGIFY(Node::Enum::Reader reader);
};
inline ::kj::StringTree KJ_STRINGIFY(Node::Enum::Reader reader) {
return ::capnp::_::structString<Node::Enum>(reader._reader);
}
class Node::Enum::Builder {
public:
typedef Enum Builds;
Builder() = default;
inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {}
inline operator Reader() const { return Reader(_builder.asReader()); }
inline Reader asReader() const { return *this; }
inline size_t totalSizeInWords() { return asReader().totalSizeInWords(); }
inline bool hasEnumerants();
inline ::capnp::List< ::capnp::schema::Enumerant>::Builder getEnumerants();
inline void setEnumerants( ::capnp::List< ::capnp::schema::Enumerant>::Reader value);
inline ::capnp::List< ::capnp::schema::Enumerant>::Builder initEnumerants(unsigned int size);
inline void adoptEnumerants(::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>>&& value);
inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>> disownEnumerants();
private:
::capnp::_::StructBuilder _builder;
template <typename T, ::capnp::Kind k>
friend struct ::capnp::ToDynamic_;
friend class ::capnp::Orphanage;
friend ::kj::StringTree KJ_STRINGIFY(Node::Enum::Builder builder);
};
inline ::kj::StringTree KJ_STRINGIFY(Node::Enum::Builder builder) {
return ::capnp::_::structString<Node::Enum>(builder._builder.asReader());
}
class Node::Interface::Reader {
public:
typedef Interface Reads;
Reader() = default;
inline explicit Reader(::capnp::_::StructReader base): _reader(base) {}
inline size_t totalSizeInWords() const {
return _reader.totalSize() / ::capnp::WORDS;
}
inline bool hasMethods() const;
inline ::capnp::List< ::capnp::schema::Method>::Reader getMethods() const;
private:
::capnp::_::StructReader _reader;
template <typename T, ::capnp::Kind k>
friend struct ::capnp::ToDynamic_;
template <typename T, ::capnp::Kind k>
friend struct ::capnp::_::PointerHelpers;
template <typename T, ::capnp::Kind k>
friend struct ::capnp::List;
friend class ::capnp::MessageBuilder;
friend class ::capnp::Orphanage;
friend ::kj::StringTree KJ_STRINGIFY(Node::Interface::Reader reader);
};
inline ::kj::StringTree KJ_STRINGIFY(Node::Interface::Reader reader) {
return ::capnp::_::structString<Node::Interface>(reader._reader);
}
class Node::Interface::Builder {
public:
typedef Interface Builds;
Builder() = default;
inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {}
inline operator Reader() const { return Reader(_builder.asReader()); }
inline Reader asReader() const { return *this; }
inline size_t totalSizeInWords() { return asReader().totalSizeInWords(); }
inline bool hasMethods();
inline ::capnp::List< ::capnp::schema::Method>::Builder getMethods();
inline void setMethods( ::capnp::List< ::capnp::schema::Method>::Reader value);
inline ::capnp::List< ::capnp::schema::Method>::Builder initMethods(unsigned int size);
inline void adoptMethods(::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>>&& value);
inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>> disownMethods();
private:
::capnp::_::StructBuilder _builder;
template <typename T, ::capnp::Kind k>
friend struct ::capnp::ToDynamic_;
friend class ::capnp::Orphanage;
friend ::kj::StringTree KJ_STRINGIFY(Node::Interface::Builder builder);
};
inline ::kj::StringTree KJ_STRINGIFY(Node::Interface::Builder builder) {
return ::capnp::_::structString<Node::Interface>(builder._builder.asReader());
}
class Node::Const::Reader { class Node::Const::Reader {
public: public:
typedef Const Reads; typedef Const Reads;
...@@ -2276,102 +2412,36 @@ inline Node::Struct::Builder Node::Builder::initStruct() { ...@@ -2276,102 +2412,36 @@ inline Node::Struct::Builder Node::Builder::initStruct() {
6 * ::capnp::ELEMENTS, Node::STRUCT); 6 * ::capnp::ELEMENTS, Node::STRUCT);
return Node::Struct::Builder(_builder); return Node::Struct::Builder(_builder);
} }
inline bool Node::Reader::hasEnum() const { inline Node::Enum::Reader Node::Reader::getEnum() const {
KJ_IREQUIRE(which() == Node::ENUM,
"Must check which() before get()ing a union member.");
return !_reader.isPointerFieldNull(3 * ::capnp::POINTERS);
}
inline bool Node::Builder::hasEnum() {
KJ_IREQUIRE(which() == Node::ENUM, KJ_IREQUIRE(which() == Node::ENUM,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return !_builder.isPointerFieldNull(3 * ::capnp::POINTERS); return Node::Enum::Reader(_reader);
}
inline ::capnp::List< ::capnp::schema::Enumerant>::Reader Node::Reader::getEnum() const {
KJ_IREQUIRE(which() == Node::ENUM,
"Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::get(
_reader, 3 * ::capnp::POINTERS);
} }
inline ::capnp::List< ::capnp::schema::Enumerant>::Builder Node::Builder::getEnum() { inline Node::Enum::Builder Node::Builder::getEnum() {
KJ_IREQUIRE(which() == Node::ENUM, KJ_IREQUIRE(which() == Node::ENUM,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::get( return Node::Enum::Builder(_builder);
_builder, 3 * ::capnp::POINTERS);
}
inline void Node::Builder::setEnum( ::capnp::List< ::capnp::schema::Enumerant>::Reader value) {
_builder.setDataField<Node::Which>(
6 * ::capnp::ELEMENTS, Node::ENUM);
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::set(
_builder, 3 * ::capnp::POINTERS, value);
} }
inline ::capnp::List< ::capnp::schema::Enumerant>::Builder Node::Builder::initEnum(unsigned int size) { inline Node::Enum::Builder Node::Builder::initEnum() {
_builder.setDataField<Node::Which>( _builder.setDataField<Node::Which>(
6 * ::capnp::ELEMENTS, Node::ENUM); 6 * ::capnp::ELEMENTS, Node::ENUM);
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::init( return Node::Enum::Builder(_builder);
_builder, 3 * ::capnp::POINTERS, size);
}
inline void Node::Builder::adoptEnum(
::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>>&& value) {
_builder.setDataField<Node::Which>(
6 * ::capnp::ELEMENTS, Node::ENUM);
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::adopt(
_builder, 3 * ::capnp::POINTERS, kj::mv(value));
}
inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>> Node::Builder::disownEnum() {
KJ_IREQUIRE(which() == Node::ENUM,
"Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::disown(
_builder, 3 * ::capnp::POINTERS);
} }
inline Node::Interface::Reader Node::Reader::getInterface() const {
inline bool Node::Reader::hasInterface() const {
KJ_IREQUIRE(which() == Node::INTERFACE,
"Must check which() before get()ing a union member.");
return !_reader.isPointerFieldNull(3 * ::capnp::POINTERS);
}
inline bool Node::Builder::hasInterface() {
KJ_IREQUIRE(which() == Node::INTERFACE,
"Must check which() before get()ing a union member.");
return !_builder.isPointerFieldNull(3 * ::capnp::POINTERS);
}
inline ::capnp::List< ::capnp::schema::Method>::Reader Node::Reader::getInterface() const {
KJ_IREQUIRE(which() == Node::INTERFACE, KJ_IREQUIRE(which() == Node::INTERFACE,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::get( return Node::Interface::Reader(_reader);
_reader, 3 * ::capnp::POINTERS);
} }
inline ::capnp::List< ::capnp::schema::Method>::Builder Node::Builder::getInterface() { inline Node::Interface::Builder Node::Builder::getInterface() {
KJ_IREQUIRE(which() == Node::INTERFACE, KJ_IREQUIRE(which() == Node::INTERFACE,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::get( return Node::Interface::Builder(_builder);
_builder, 3 * ::capnp::POINTERS);
} }
inline void Node::Builder::setInterface( ::capnp::List< ::capnp::schema::Method>::Reader value) { inline Node::Interface::Builder Node::Builder::initInterface() {
_builder.setDataField<Node::Which>( _builder.setDataField<Node::Which>(
6 * ::capnp::ELEMENTS, Node::INTERFACE); 6 * ::capnp::ELEMENTS, Node::INTERFACE);
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::set( return Node::Interface::Builder(_builder);
_builder, 3 * ::capnp::POINTERS, value);
} }
inline ::capnp::List< ::capnp::schema::Method>::Builder Node::Builder::initInterface(unsigned int size) {
_builder.setDataField<Node::Which>(
6 * ::capnp::ELEMENTS, Node::INTERFACE);
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::init(
_builder, 3 * ::capnp::POINTERS, size);
}
inline void Node::Builder::adoptInterface(
::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>>&& value) {
_builder.setDataField<Node::Which>(
6 * ::capnp::ELEMENTS, Node::INTERFACE);
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::adopt(
_builder, 3 * ::capnp::POINTERS, kj::mv(value));
}
inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>> Node::Builder::disownInterface() {
KJ_IREQUIRE(which() == Node::INTERFACE,
"Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::disown(
_builder, 3 * ::capnp::POINTERS);
}
inline Node::Const::Reader Node::Reader::getConst() const { inline Node::Const::Reader Node::Reader::getConst() const {
KJ_IREQUIRE(which() == Node::CONST, KJ_IREQUIRE(which() == Node::CONST,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
...@@ -2613,6 +2683,70 @@ inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>> Node::Struct::Bu ...@@ -2613,6 +2683,70 @@ inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Field>> Node::Struct::Bu
_builder, 3 * ::capnp::POINTERS); _builder, 3 * ::capnp::POINTERS);
} }
inline bool Node::Enum::Reader::hasEnumerants() const {
return !_reader.isPointerFieldNull(3 * ::capnp::POINTERS);
}
inline bool Node::Enum::Builder::hasEnumerants() {
return !_builder.isPointerFieldNull(3 * ::capnp::POINTERS);
}
inline ::capnp::List< ::capnp::schema::Enumerant>::Reader Node::Enum::Reader::getEnumerants() const {
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::get(
_reader, 3 * ::capnp::POINTERS);
}
inline ::capnp::List< ::capnp::schema::Enumerant>::Builder Node::Enum::Builder::getEnumerants() {
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::get(
_builder, 3 * ::capnp::POINTERS);
}
inline void Node::Enum::Builder::setEnumerants( ::capnp::List< ::capnp::schema::Enumerant>::Reader value) {
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::set(
_builder, 3 * ::capnp::POINTERS, value);
}
inline ::capnp::List< ::capnp::schema::Enumerant>::Builder Node::Enum::Builder::initEnumerants(unsigned int size) {
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::init(
_builder, 3 * ::capnp::POINTERS, size);
}
inline void Node::Enum::Builder::adoptEnumerants(
::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>>&& value) {
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::adopt(
_builder, 3 * ::capnp::POINTERS, kj::mv(value));
}
inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Enumerant>> Node::Enum::Builder::disownEnumerants() {
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Enumerant>>::disown(
_builder, 3 * ::capnp::POINTERS);
}
inline bool Node::Interface::Reader::hasMethods() const {
return !_reader.isPointerFieldNull(3 * ::capnp::POINTERS);
}
inline bool Node::Interface::Builder::hasMethods() {
return !_builder.isPointerFieldNull(3 * ::capnp::POINTERS);
}
inline ::capnp::List< ::capnp::schema::Method>::Reader Node::Interface::Reader::getMethods() const {
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::get(
_reader, 3 * ::capnp::POINTERS);
}
inline ::capnp::List< ::capnp::schema::Method>::Builder Node::Interface::Builder::getMethods() {
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::get(
_builder, 3 * ::capnp::POINTERS);
}
inline void Node::Interface::Builder::setMethods( ::capnp::List< ::capnp::schema::Method>::Reader value) {
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::set(
_builder, 3 * ::capnp::POINTERS, value);
}
inline ::capnp::List< ::capnp::schema::Method>::Builder Node::Interface::Builder::initMethods(unsigned int size) {
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::init(
_builder, 3 * ::capnp::POINTERS, size);
}
inline void Node::Interface::Builder::adoptMethods(
::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>>&& value) {
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::adopt(
_builder, 3 * ::capnp::POINTERS, kj::mv(value));
}
inline ::capnp::Orphan< ::capnp::List< ::capnp::schema::Method>> Node::Interface::Builder::disownMethods() {
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::schema::Method>>::disown(
_builder, 3 * ::capnp::POINTERS);
}
inline bool Node::Const::Reader::hasType() const { inline bool Node::Const::Reader::hasType() const {
return !_reader.isPointerFieldNull(3 * ::capnp::POINTERS); return !_reader.isPointerFieldNull(3 * ::capnp::POINTERS);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment