ducjs
Version:
The duc 2D CAD file format is a cornerstone of our advanced design system, conceived to cater to professionals seeking precision and efficiency in their design work.
76 lines (75 loc) • 3.17 kB
JavaScript
// automatically generated by the FlatBuffers compiler, do not modify
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
import * as flatbuffers from 'flatbuffers';
import { _UnitSystemBase } from '../duc/unit-system-base';
export class LinearUnitSystem {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsLinearUnitSystem(bb, obj) {
return (obj || new LinearUnitSystem()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsLinearUnitSystem(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new LinearUnitSystem()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
base(obj) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? (obj || new _UnitSystemBase()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
format() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readUint8(this.bb_pos + offset) : null;
}
decimalSeparator() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readUint8(this.bb_pos + offset) : null;
}
suppressZeroFeet() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
suppressZeroInches() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
static startLinearUnitSystem(builder) {
builder.startObject(5);
}
static addBase(builder, baseOffset) {
builder.addFieldOffset(0, baseOffset, 0);
}
static addFormat(builder, format) {
builder.addFieldInt8(1, format, null);
}
static addDecimalSeparator(builder, decimalSeparator) {
builder.addFieldInt8(2, decimalSeparator, null);
}
static addSuppressZeroFeet(builder, suppressZeroFeet) {
builder.addFieldInt8(3, +suppressZeroFeet, +false);
}
static addSuppressZeroInches(builder, suppressZeroInches) {
builder.addFieldInt8(4, +suppressZeroInches, +false);
}
static endLinearUnitSystem(builder) {
const offset = builder.endObject();
return offset;
}
static createLinearUnitSystem(builder, baseOffset, format, decimalSeparator, suppressZeroFeet, suppressZeroInches) {
LinearUnitSystem.startLinearUnitSystem(builder);
LinearUnitSystem.addBase(builder, baseOffset);
if (format !== null)
LinearUnitSystem.addFormat(builder, format);
if (decimalSeparator !== null)
LinearUnitSystem.addDecimalSeparator(builder, decimalSeparator);
LinearUnitSystem.addSuppressZeroFeet(builder, suppressZeroFeet);
LinearUnitSystem.addSuppressZeroInches(builder, suppressZeroInches);
return LinearUnitSystem.endLinearUnitSystem(builder);
}
}