UNPKG

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.

65 lines (64 loc) 2.52 kB
// 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 { StackFormatProperties } from '../duc/stack-format-properties'; export class StackFormat { constructor() { this.bb = null; this.bb_pos = 0; } __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsStackFormat(bb, obj) { return (obj || new StackFormat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsStackFormat(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new StackFormat()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } autoStack() { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } stackChars(index, optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; } stackCharsLength() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } properties(obj) { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? (obj || new StackFormatProperties()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } static startStackFormat(builder) { builder.startObject(3); } static addAutoStack(builder, autoStack) { builder.addFieldInt8(0, +autoStack, +false); } static addStackChars(builder, stackCharsOffset) { builder.addFieldOffset(1, stackCharsOffset, 0); } static createStackCharsVector(builder, data) { builder.startVector(4, data.length, 4); for (let i = data.length - 1; i >= 0; i--) { builder.addOffset(data[i]); } return builder.endVector(); } static startStackCharsVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addProperties(builder, propertiesOffset) { builder.addFieldOffset(2, propertiesOffset, 0); } static endStackFormat(builder) { const offset = builder.endObject(); return offset; } }