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.

80 lines (79 loc) 3.15 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 { SnapMarkerStyleEntry } from '../duc/snap-marker-style-entry'; export class SnapMarkerSettings { constructor() { this.bb = null; this.bb_pos = 0; } __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsSnapMarkerSettings(bb, obj) { return (obj || new SnapMarkerSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsSnapMarkerSettings(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new SnapMarkerSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } enabled() { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } size() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } duration() { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } styles(index, obj) { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? (obj || new SnapMarkerStyleEntry()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } stylesLength() { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } static startSnapMarkerSettings(builder) { builder.startObject(4); } static addEnabled(builder, enabled) { builder.addFieldInt8(0, +enabled, +false); } static addSize(builder, size) { builder.addFieldInt32(1, size, 0); } static addDuration(builder, duration) { builder.addFieldInt32(2, duration, 0); } static addStyles(builder, stylesOffset) { builder.addFieldOffset(3, stylesOffset, 0); } static createStylesVector(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 startStylesVector(builder, numElems) { builder.startVector(4, numElems, 4); } static endSnapMarkerSettings(builder) { const offset = builder.endObject(); return offset; } static createSnapMarkerSettings(builder, enabled, size, duration, stylesOffset) { SnapMarkerSettings.startSnapMarkerSettings(builder); SnapMarkerSettings.addEnabled(builder, enabled); SnapMarkerSettings.addSize(builder, size); SnapMarkerSettings.addDuration(builder, duration); SnapMarkerSettings.addStyles(builder, stylesOffset); return SnapMarkerSettings.endSnapMarkerSettings(builder); } }