How to use the flatbuffers.Builder function in flatbuffers

To help you get started, we’ve selected a few flatbuffers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
bb.writeFloat32(0, 10);
// $ExpectError
bb.writeFloat32(0);
// $ExpectError
bb.writeFloat32("s", "t");

bb.writeFloat64(0, 10);
// $ExpectError
bb.writeFloat64(0);
// $ExpectError
bb.writeFloat64("s", "t");

/**
 * Builder
 */
let b = new fb.Builder();
new fb.Builder(0);
// $ExpectError
new fb.Builder("s");

fb.Builder.growByteBuffer(bb);
// $ExpectError
fb.Builder.growByteBuffer();
// $ExpectError
fb.Builder.growByteBuffer(0);
// $ExpectError
fb.Builder.growByteBuffer("s");

b.forceDefaults(true);
// $ExpectError
b.forceDefaults(0);
// $ExpectError
github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
// $ExpectError
bb.writeFloat32(0);
// $ExpectError
bb.writeFloat32("s", "t");

bb.writeFloat64(0, 10);
// $ExpectError
bb.writeFloat64(0);
// $ExpectError
bb.writeFloat64("s", "t");

/**
 * Builder
 */
let b = new fb.Builder();
new fb.Builder(0);
// $ExpectError
new fb.Builder("s");

fb.Builder.growByteBuffer(bb);
// $ExpectError
fb.Builder.growByteBuffer();
// $ExpectError
fb.Builder.growByteBuffer(0);
// $ExpectError
fb.Builder.growByteBuffer("s");

b.forceDefaults(true);
// $ExpectError
b.forceDefaults(0);
// $ExpectError
b.forceDefaults("str");
github flow-typed / flow-typed / definitions / npm / flatbuffers_v1.5.x / flow_v0.104.x- / test_flatbuffers_v1.5.x.js View on Github external
// $ExpectError
bb.writeFloat32("s", "t");

bb.writeFloat64(0, 10);
// $ExpectError
bb.writeFloat64(0);
// $ExpectError
bb.writeFloat64("s", "t");

/**
 * Builder
 */
let b = new fb.Builder();
new fb.Builder(0);
// $ExpectError
new fb.Builder("s");

fb.Builder.growByteBuffer(bb);
// $ExpectError
fb.Builder.growByteBuffer();
// $ExpectError
fb.Builder.growByteBuffer(0);
// $ExpectError
fb.Builder.growByteBuffer("s");

b.forceDefaults(true);
// $ExpectError
b.forceDefaults(0);
// $ExpectError
b.forceDefaults("str");

b.dataBuffer();
github jkcfg / jk / std / std_param.js View on Github external
function getParameter(type, path, defaultValue) {
  const builder = new flatbuffers.Builder(512);
  const pathOffset = builder.createString(path);
  const isObject = type === __std.ParamType.Object;
  const defaultValueOffset = isObject
    && defaultValue !== undefined
    && builder.createString(JSON.stringify(defaultValue));

  __std.ParamArgs.startParamArgs(builder);
  __std.ParamArgs.addPath(builder, pathOffset);
  __std.ParamArgs.addType(builder, type);
  if (isObject) {
    __std.ParamArgs.addDefaultValue(builder, defaultValueOffset);
  }
  const argsOffset = __std.ParamArgs.endParamArgs(builder);

  __std.Message.startMessage(builder);
  __std.Message.addArgsType(builder, __std.Args.ParamArgs);