filling in the holes
This commit is contained in:
parent
4773300ac3
commit
e05c743134
3 changed files with 46 additions and 2 deletions
|
@ -1046,7 +1046,7 @@ private:
|
|||
spaces(indent), " }\n",
|
||||
|
||||
spaces(indent), " public final ", type, ".Builder init", titleCase, "(int size) {\n",
|
||||
spaces(indent), " throw new Error();\n",
|
||||
spaces(indent), " return _builder.getPointerField(", offset, ").init", blobKind, "(size);\n",
|
||||
spaces(indent), " }\n"),
|
||||
};
|
||||
} else if (kind == FieldKind::LIST) {
|
||||
|
@ -1086,7 +1086,7 @@ private:
|
|||
spaces(indent), " }\n",
|
||||
|
||||
spaces(indent), " public final void set", titleCase, "(", readerClass, " value) {\n",
|
||||
spaces(indent), " throw new Error();\n",
|
||||
spaces(indent), " _builder.getPointerField(", offset, ").setList(value.reader);\n",
|
||||
spaces(indent), " }\n",
|
||||
|
||||
spaces(indent), " public final ", builderClass,
|
||||
|
|
|
@ -72,6 +72,18 @@ public final class PointerBuilder {
|
|||
return WireHelpers.initStructListPointer(this.pointer, this.segment, elementCount, elementSize);
|
||||
}
|
||||
|
||||
public final Text.Builder initText(int size) {
|
||||
return WireHelpers.initTextPointer(this.pointer, this.segment, size);
|
||||
}
|
||||
|
||||
public final Data.Builder initData(int size) {
|
||||
return WireHelpers.initDataPointer(this.pointer, this.segment, size);
|
||||
}
|
||||
|
||||
public final void setList(ListReader value) {
|
||||
WireHelpers.setListPointer(this.segment, this.pointer, value);
|
||||
}
|
||||
|
||||
public final void setStruct(StructReader value) {
|
||||
WireHelpers.setStructPointer(this.segment, this.pointer, value);
|
||||
}
|
||||
|
|
|
@ -462,6 +462,38 @@ final class WireHelpers {
|
|||
throw new Error("setStructPointer is unimplemented");
|
||||
};
|
||||
|
||||
static SegmentBuilder setListPointer(SegmentBuilder segment, int refOffset, ListReader value) {
|
||||
int totalSize = roundBitsUpToWords(value.elementCount * value.step);
|
||||
|
||||
if (value.step <= Constants.BITS_PER_WORD) {
|
||||
//# List of non-structs.
|
||||
AllocateResult allocation = allocate(refOffset, segment, totalSize, WirePointer.LIST);
|
||||
|
||||
if (value.structPointerCount == 1) {
|
||||
//# List of pointers.
|
||||
ListPointer.set(allocation.segment.buffer, allocation.refOffset, FieldSize.POINTER, value.elementCount);
|
||||
for (int i = 0; i < value.elementCount; ++i) {
|
||||
//copyPointer(segment);
|
||||
}
|
||||
} else {
|
||||
//# List of data.
|
||||
}
|
||||
} else {
|
||||
//# List of structs.
|
||||
}
|
||||
|
||||
throw new Error("setListPointer is unimplemented");
|
||||
}
|
||||
|
||||
static SegmentBuilder copyPointer(SegmentBuilder dstSegment, int dstOffset,
|
||||
SegmentReader srcSegment, int srcOffset, int nestingLimit) {
|
||||
// Deep-copy the object pointed to by src into dst. It turns out we can't reuse
|
||||
// readStructPointer(), etc. because they do type checking whereas here we want to accept any
|
||||
// valid pointer.
|
||||
|
||||
throw new Error("copyPointer is unimplemented");
|
||||
}
|
||||
|
||||
static ListReader readListPointer(SegmentReader segment,
|
||||
int refOffset,
|
||||
SegmentReader defaultSegment,
|
||||
|
|
Loading…
Reference in a new issue