mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-24 00:21:47 +00:00
Cleaned up namespace handling.
A Namespace object is now guaranteed unique. This cleaned up some old workarounds and latent bugs. Change-Id: Ic3f12d89947871b03b2c449ba51b3186f953adde Tested: on Linux. Bug: 21336857
This commit is contained in:
@@ -21,6 +21,58 @@ export enum Any{
|
||||
MyGame_Example2_Monster= 3
|
||||
}};
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
export namespace MyGame{
|
||||
export class InParentNamespace {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
bb_pos:number = 0;
|
||||
/**
|
||||
* @param {number} i
|
||||
* @param {flatbuffers.ByteBuffer} bb
|
||||
* @returns {InParentNamespace}
|
||||
*/
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):InParentNamespace {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.ByteBuffer} bb
|
||||
* @param {InParentNamespace=} obj
|
||||
* @returns {InParentNamespace}
|
||||
*/
|
||||
static getRootAsInParentNamespace(bb:flatbuffers.ByteBuffer, obj?:InParentNamespace):InParentNamespace {
|
||||
return (obj || new InParentNamespace).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
*/
|
||||
static startInParentNamespace(builder:flatbuffers.Builder) {
|
||||
builder.startObject(0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @returns {flatbuffers.Offset}
|
||||
*/
|
||||
static endInParentNamespace(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
var offset = builder.endObject();
|
||||
return offset;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
@@ -1347,11 +1399,20 @@ vectorOfDoublesArray():Float64Array|null {
|
||||
return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {MyGame.InParentNamespace=} obj
|
||||
* @returns {MyGame.InParentNamespace|null}
|
||||
*/
|
||||
parentNamespaceTest(obj?:MyGame.InParentNamespace):MyGame.InParentNamespace|null {
|
||||
var offset = this.bb.__offset(this.bb_pos, 72);
|
||||
return offset ? (obj || new MyGame.InParentNamespace).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
*/
|
||||
static startMonster(builder:flatbuffers.Builder) {
|
||||
builder.startObject(34);
|
||||
builder.startObject(35);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1831,6 +1892,14 @@ static startVectorOfDoublesVector(builder:flatbuffers.Builder, numElems:number)
|
||||
builder.startVector(8, numElems, 8);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {flatbuffers.Offset} parentNamespaceTestOffset
|
||||
*/
|
||||
static addParentNamespaceTest(builder:flatbuffers.Builder, parentNamespaceTestOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(34, parentNamespaceTestOffset, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @returns {flatbuffers.Offset}
|
||||
|
||||
Reference in New Issue
Block a user