blob: 96f45a9c6115c74628cdf4a6ca74c29df54319c8 [file] [log] [blame]
// generated by diplomat-tool
import { CodePointSetData } from "./CodePointSetData.mjs"
import wasm from "./diplomat-wasm.mjs";
import * as diplomatRuntime from "./diplomat-runtime.mjs";
/** See the [Rust documentation for `CodePointInversionListBuilder`](https://docs.rs/icu/latest/icu/collections/codepointinvlist/struct.CodePointInversionListBuilder.html) for more information.
*/
const CodePointSetBuilder_box_destroy_registry = new FinalizationRegistry((ptr) => {
wasm.icu4x_CodePointSetBuilder_destroy_mv1(ptr);
});
export class CodePointSetBuilder {
// Internal ptr reference:
#ptr = null;
// Lifetimes are only to keep dependencies alive.
// Since JS won't garbage collect until there are no incoming edges.
#selfEdge = [];
#internalConstructor(symbol, ptr, selfEdge) {
if (symbol !== diplomatRuntime.internalConstructor) {
console.error("CodePointSetBuilder is an Opaque type. You cannot call its constructor.");
return;
}
this.#ptr = ptr;
this.#selfEdge = selfEdge;
// Are we being borrowed? If not, we can register.
if (this.#selfEdge.length === 0) {
CodePointSetBuilder_box_destroy_registry.register(this, this.#ptr);
}
return this;
}
get ffiValue() {
return this.#ptr;
}
#defaultConstructor() {
const result = wasm.icu4x_CodePointSetBuilder_create_mv1();
try {
return new CodePointSetBuilder(diplomatRuntime.internalConstructor, result, []);
}
finally {}
}
build() {
const result = wasm.icu4x_CodePointSetBuilder_build_mv1(this.ffiValue);
try {
return new CodePointSetData(diplomatRuntime.internalConstructor, result, []);
}
finally {}
}
complement() {wasm.icu4x_CodePointSetBuilder_complement_mv1(this.ffiValue);
try {}
finally {}
}
get isEmpty() {
const result = wasm.icu4x_CodePointSetBuilder_is_empty_mv1(this.ffiValue);
try {
return result;
}
finally {}
}
addChar(ch) {wasm.icu4x_CodePointSetBuilder_add_char_mv1(this.ffiValue, ch);
try {}
finally {}
}
addInclusiveRange(start, end) {wasm.icu4x_CodePointSetBuilder_add_inclusive_range_mv1(this.ffiValue, start, end);
try {}
finally {}
}
addSet(data) {wasm.icu4x_CodePointSetBuilder_add_set_mv1(this.ffiValue, data.ffiValue);
try {}
finally {}
}
removeChar(ch) {wasm.icu4x_CodePointSetBuilder_remove_char_mv1(this.ffiValue, ch);
try {}
finally {}
}
removeInclusiveRange(start, end) {wasm.icu4x_CodePointSetBuilder_remove_inclusive_range_mv1(this.ffiValue, start, end);
try {}
finally {}
}
removeSet(data) {wasm.icu4x_CodePointSetBuilder_remove_set_mv1(this.ffiValue, data.ffiValue);
try {}
finally {}
}
retainChar(ch) {wasm.icu4x_CodePointSetBuilder_retain_char_mv1(this.ffiValue, ch);
try {}
finally {}
}
retainInclusiveRange(start, end) {wasm.icu4x_CodePointSetBuilder_retain_inclusive_range_mv1(this.ffiValue, start, end);
try {}
finally {}
}
retainSet(data) {wasm.icu4x_CodePointSetBuilder_retain_set_mv1(this.ffiValue, data.ffiValue);
try {}
finally {}
}
complementChar(ch) {wasm.icu4x_CodePointSetBuilder_complement_char_mv1(this.ffiValue, ch);
try {}
finally {}
}
complementInclusiveRange(start, end) {wasm.icu4x_CodePointSetBuilder_complement_inclusive_range_mv1(this.ffiValue, start, end);
try {}
finally {}
}
complementSet(data) {wasm.icu4x_CodePointSetBuilder_complement_set_mv1(this.ffiValue, data.ffiValue);
try {}
finally {}
}
constructor() {
if (arguments[0] === diplomatRuntime.exposeConstructor) {
return this.#internalConstructor(...Array.prototype.slice.call(arguments, 1));
} else if (arguments[0] === diplomatRuntime.internalConstructor) {
return this.#internalConstructor(...arguments);
} else {
return this.#defaultConstructor(...arguments);
}
}
}