Debian Codegraph @

intl/icu_capi/bindings/js/ICU4XUnicodeSetData.mjs

raw
1 import wasm from "./diplomat-wasm.mjs"
2 import * as diplomatRuntime from "./diplomat-runtime.mjs"
3 import { ICU4XError_js_to_rust, ICU4XError_rust_to_js } from "./ICU4XError.mjs"
4
5 const ICU4XUnicodeSetData_box_destroy_registry = new FinalizationRegistry(underlying => {
6 wasm.ICU4XUnicodeSetData_destroy(underlying);
7 });
8
9 export class ICU4XUnicodeSetData {
10 #lifetimeEdges = [];
11 constructor(underlying, owned, edges) {
12 this.underlying = underlying;
13 this.#lifetimeEdges.push(...edges);
14 if (owned) {
15 ICU4XUnicodeSetData_box_destroy_registry.register(this, underlying);
16 }
17 }
18
19 contains(arg_s) {
20 const buf_arg_s = diplomatRuntime.DiplomatBuf.str8(wasm, arg_s);
21 const diplomat_out = wasm.ICU4XUnicodeSetData_contains(this.underlying, buf_arg_s.ptr, buf_arg_s.size);
22 buf_arg_s.free();
23 return diplomat_out;
24 }
25
26 contains_char(arg_cp) {
27 return wasm.ICU4XUnicodeSetData_contains_char(this.underlying, diplomatRuntime.extractCodePoint(arg_cp, 'arg_cp'));
28 }
29
30 contains32(arg_cp) {
31 return wasm.ICU4XUnicodeSetData_contains32(this.underlying, arg_cp);
32 }
33
34 static load_basic_emoji(arg_provider) {
35 return (() => {
36 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
37 wasm.ICU4XUnicodeSetData_load_basic_emoji(diplomat_receive_buffer, arg_provider.underlying);
38 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
39 if (is_ok) {
40 const ok_value = new ICU4XUnicodeSetData(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
41 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
42 return ok_value;
43 } else {
44 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
45 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
46 throw new diplomatRuntime.FFIError(throw_value);
47 }
48 })();
49 }
50
51 static load_exemplars_main(arg_provider, arg_locale) {
52 return (() => {
53 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
54 wasm.ICU4XUnicodeSetData_load_exemplars_main(diplomat_receive_buffer, arg_provider.underlying, arg_locale.underlying);
55 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
56 if (is_ok) {
57 const ok_value = new ICU4XUnicodeSetData(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
58 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
59 return ok_value;
60 } else {
61 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
62 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
63 throw new diplomatRuntime.FFIError(throw_value);
64 }
65 })();
66 }
67
68 static load_exemplars_auxiliary(arg_provider, arg_locale) {
69 return (() => {
70 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
71 wasm.ICU4XUnicodeSetData_load_exemplars_auxiliary(diplomat_receive_buffer, arg_provider.underlying, arg_locale.underlying);
72 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
73 if (is_ok) {
74 const ok_value = new ICU4XUnicodeSetData(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
75 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
76 return ok_value;
77 } else {
78 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
79 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
80 throw new diplomatRuntime.FFIError(throw_value);
81 }
82 })();
83 }
84
85 static load_exemplars_punctuation(arg_provider, arg_locale) {
86 return (() => {
87 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
88 wasm.ICU4XUnicodeSetData_load_exemplars_punctuation(diplomat_receive_buffer, arg_provider.underlying, arg_locale.underlying);
89 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
90 if (is_ok) {
91 const ok_value = new ICU4XUnicodeSetData(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
92 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
93 return ok_value;
94 } else {
95 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
96 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
97 throw new diplomatRuntime.FFIError(throw_value);
98 }
99 })();
100 }
101
102 static load_exemplars_numbers(arg_provider, arg_locale) {
103 return (() => {
104 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
105 wasm.ICU4XUnicodeSetData_load_exemplars_numbers(diplomat_receive_buffer, arg_provider.underlying, arg_locale.underlying);
106 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
107 if (is_ok) {
108 const ok_value = new ICU4XUnicodeSetData(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
109 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
110 return ok_value;
111 } else {
112 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
113 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
114 throw new diplomatRuntime.FFIError(throw_value);
115 }
116 })();
117 }
118
119 static load_exemplars_index(arg_provider, arg_locale) {
120 return (() => {
121 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
122 wasm.ICU4XUnicodeSetData_load_exemplars_index(diplomat_receive_buffer, arg_provider.underlying, arg_locale.underlying);
123 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
124 if (is_ok) {
125 const ok_value = new ICU4XUnicodeSetData(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
126 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
127 return ok_value;
128 } else {
129 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
130 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
131 throw new diplomatRuntime.FFIError(throw_value);
132 }
133 })();
134 }
135 }