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.
107 lines (106 loc) • 4.51 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';
export class ParagraphFormatting {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsParagraphFormatting(bb, obj) {
return (obj || new ParagraphFormatting()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsParagraphFormatting(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new ParagraphFormatting()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
firstLineIndent() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
hangingIndent() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
leftIndent() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
rightIndent() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
spaceBefore() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
spaceAfter() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
tabStops(index) {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
}
tabStopsLength() {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
tabStopsArray() {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
}
static startParagraphFormatting(builder) {
builder.startObject(7);
}
static addFirstLineIndent(builder, firstLineIndent) {
builder.addFieldFloat64(0, firstLineIndent, 0.0);
}
static addHangingIndent(builder, hangingIndent) {
builder.addFieldFloat64(1, hangingIndent, 0.0);
}
static addLeftIndent(builder, leftIndent) {
builder.addFieldFloat64(2, leftIndent, 0.0);
}
static addRightIndent(builder, rightIndent) {
builder.addFieldFloat64(3, rightIndent, 0.0);
}
static addSpaceBefore(builder, spaceBefore) {
builder.addFieldFloat64(4, spaceBefore, 0.0);
}
static addSpaceAfter(builder, spaceAfter) {
builder.addFieldFloat64(5, spaceAfter, 0.0);
}
static addTabStops(builder, tabStopsOffset) {
builder.addFieldOffset(6, tabStopsOffset, 0);
}
static createTabStopsVector(builder, data) {
builder.startVector(8, data.length, 8);
for (let i = data.length - 1; i >= 0; i--) {
builder.addFloat64(data[i]);
}
return builder.endVector();
}
static startTabStopsVector(builder, numElems) {
builder.startVector(8, numElems, 8);
}
static endParagraphFormatting(builder) {
const offset = builder.endObject();
return offset;
}
static createParagraphFormatting(builder, firstLineIndent, hangingIndent, leftIndent, rightIndent, spaceBefore, spaceAfter, tabStopsOffset) {
ParagraphFormatting.startParagraphFormatting(builder);
ParagraphFormatting.addFirstLineIndent(builder, firstLineIndent);
ParagraphFormatting.addHangingIndent(builder, hangingIndent);
ParagraphFormatting.addLeftIndent(builder, leftIndent);
ParagraphFormatting.addRightIndent(builder, rightIndent);
ParagraphFormatting.addSpaceBefore(builder, spaceBefore);
ParagraphFormatting.addSpaceAfter(builder, spaceAfter);
ParagraphFormatting.addTabStops(builder, tabStopsOffset);
return ParagraphFormatting.endParagraphFormatting(builder);
}
}