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.

86 lines (85 loc) 3.69 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 { StringValueEntry } from '../duc/string-value-entry'; export class LeaderBlockContent { constructor() { this.bb = null; this.bb_pos = 0; } __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsLeaderBlockContent(bb, obj) { return (obj || new LeaderBlockContent()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsLeaderBlockContent(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new LeaderBlockContent()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } blockId(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } attributeValues(index, obj) { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? (obj || new StringValueEntry()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } attributeValuesLength() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } elementOverrides(index, obj) { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? (obj || new StringValueEntry()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } elementOverridesLength() { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } static startLeaderBlockContent(builder) { builder.startObject(3); } static addBlockId(builder, blockIdOffset) { builder.addFieldOffset(0, blockIdOffset, 0); } static addAttributeValues(builder, attributeValuesOffset) { builder.addFieldOffset(1, attributeValuesOffset, 0); } static createAttributeValuesVector(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 startAttributeValuesVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addElementOverrides(builder, elementOverridesOffset) { builder.addFieldOffset(2, elementOverridesOffset, 0); } static createElementOverridesVector(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 startElementOverridesVector(builder, numElems) { builder.startVector(4, numElems, 4); } static endLeaderBlockContent(builder) { const offset = builder.endObject(); return offset; } static createLeaderBlockContent(builder, blockIdOffset, attributeValuesOffset, elementOverridesOffset) { LeaderBlockContent.startLeaderBlockContent(builder); LeaderBlockContent.addBlockId(builder, blockIdOffset); LeaderBlockContent.addAttributeValues(builder, attributeValuesOffset); LeaderBlockContent.addElementOverrides(builder, elementOverridesOffset); return LeaderBlockContent.endLeaderBlockContent(builder); } }