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.

168 lines (167 loc) 6.81 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 { DucTableAutoSize } from '../duc/duc-table-auto-size'; import { DucTableCellEntry } from '../duc/duc-table-cell-entry'; import { DucTableColumnEntry } from '../duc/duc-table-column-entry'; import { DucTableRowEntry } from '../duc/duc-table-row-entry'; import { DucTableStyle } from '../duc/duc-table-style'; import { _DucElementBase } from '../duc/duc-element-base'; export class DucTableElement { constructor() { this.bb = null; this.bb_pos = 0; } __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsDucTableElement(bb, obj) { return (obj || new DucTableElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsDucTableElement(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new DucTableElement()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } base(obj) { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? (obj || new _DucElementBase()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } style(obj) { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? (obj || new DucTableStyle()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } columnOrder(index, optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; } columnOrderLength() { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } rowOrder(index, optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; } rowOrderLength() { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } columns(index, obj) { const offset = this.bb.__offset(this.bb_pos, 12); return offset ? (obj || new DucTableColumnEntry()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } columnsLength() { const offset = this.bb.__offset(this.bb_pos, 12); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } rows(index, obj) { const offset = this.bb.__offset(this.bb_pos, 14); return offset ? (obj || new DucTableRowEntry()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } rowsLength() { const offset = this.bb.__offset(this.bb_pos, 14); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } cells(index, obj) { const offset = this.bb.__offset(this.bb_pos, 16); return offset ? (obj || new DucTableCellEntry()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } cellsLength() { const offset = this.bb.__offset(this.bb_pos, 16); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } headerRowCount() { const offset = this.bb.__offset(this.bb_pos, 18); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } autoSize(obj) { const offset = this.bb.__offset(this.bb_pos, 20); return offset ? (obj || new DucTableAutoSize()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } static startDucTableElement(builder) { builder.startObject(9); } static addBase(builder, baseOffset) { builder.addFieldOffset(0, baseOffset, 0); } static addStyle(builder, styleOffset) { builder.addFieldOffset(1, styleOffset, 0); } static addColumnOrder(builder, columnOrderOffset) { builder.addFieldOffset(2, columnOrderOffset, 0); } static createColumnOrderVector(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 startColumnOrderVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addRowOrder(builder, rowOrderOffset) { builder.addFieldOffset(3, rowOrderOffset, 0); } static createRowOrderVector(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 startRowOrderVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addColumns(builder, columnsOffset) { builder.addFieldOffset(4, columnsOffset, 0); } static createColumnsVector(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 startColumnsVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addRows(builder, rowsOffset) { builder.addFieldOffset(5, rowsOffset, 0); } static createRowsVector(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 startRowsVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addCells(builder, cellsOffset) { builder.addFieldOffset(6, cellsOffset, 0); } static createCellsVector(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 startCellsVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addHeaderRowCount(builder, headerRowCount) { builder.addFieldInt32(7, headerRowCount, 0); } static addAutoSize(builder, autoSizeOffset) { builder.addFieldOffset(8, autoSizeOffset, 0); } static endDucTableElement(builder) { const offset = builder.endObject(); return offset; } }