Debian Codegraph @

intl/icu_capi/bindings/js/ICU4XCodePointMapData8.mjs

raw
1 import wasm from "./diplomat-wasm.mjs"
2 import * as diplomatRuntime from "./diplomat-runtime.mjs"
3 import { CodePointRangeIterator } from "./CodePointRangeIterator.mjs"
4 import { ICU4XCodePointSetData } from "./ICU4XCodePointSetData.mjs"
5 import { ICU4XError_js_to_rust, ICU4XError_rust_to_js } from "./ICU4XError.mjs"
6
7 const ICU4XCodePointMapData8_box_destroy_registry = new FinalizationRegistry(underlying => {
8 wasm.ICU4XCodePointMapData8_destroy(underlying);
9 });
10
11 export class ICU4XCodePointMapData8 {
12 #lifetimeEdges = [];
13 constructor(underlying, owned, edges) {
14 this.underlying = underlying;
15 this.#lifetimeEdges.push(...edges);
16 if (owned) {
17 ICU4XCodePointMapData8_box_destroy_registry.register(this, underlying);
18 }
19 }
20
21 get(arg_cp) {
22 return wasm.ICU4XCodePointMapData8_get(this.underlying, diplomatRuntime.extractCodePoint(arg_cp, 'arg_cp'));
23 }
24
25 get32(arg_cp) {
26 return wasm.ICU4XCodePointMapData8_get32(this.underlying, arg_cp);
27 }
28
29 static general_category_to_mask(arg_gc) {
30 return wasm.ICU4XCodePointMapData8_general_category_to_mask(arg_gc);
31 }
32
33 iter_ranges_for_value(arg_value) {
34 return new CodePointRangeIterator(wasm.ICU4XCodePointMapData8_iter_ranges_for_value(this.underlying, arg_value), true, [this]);
35 }
36
37 iter_ranges_for_value_complemented(arg_value) {
38 return new CodePointRangeIterator(wasm.ICU4XCodePointMapData8_iter_ranges_for_value_complemented(this.underlying, arg_value), true, [this]);
39 }
40
41 iter_ranges_for_mask(arg_mask) {
42 return new CodePointRangeIterator(wasm.ICU4XCodePointMapData8_iter_ranges_for_mask(this.underlying, arg_mask), true, [this]);
43 }
44
45 get_set_for_value(arg_value) {
46 return new ICU4XCodePointSetData(wasm.ICU4XCodePointMapData8_get_set_for_value(this.underlying, arg_value), true, []);
47 }
48
49 static load_general_category(arg_provider) {
50 return (() => {
51 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
52 wasm.ICU4XCodePointMapData8_load_general_category(diplomat_receive_buffer, arg_provider.underlying);
53 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
54 if (is_ok) {
55 const ok_value = new ICU4XCodePointMapData8(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
56 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
57 return ok_value;
58 } else {
59 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
60 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
61 throw new diplomatRuntime.FFIError(throw_value);
62 }
63 })();
64 }
65
66 static load_bidi_class(arg_provider) {
67 return (() => {
68 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
69 wasm.ICU4XCodePointMapData8_load_bidi_class(diplomat_receive_buffer, arg_provider.underlying);
70 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
71 if (is_ok) {
72 const ok_value = new ICU4XCodePointMapData8(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
73 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
74 return ok_value;
75 } else {
76 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
77 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
78 throw new diplomatRuntime.FFIError(throw_value);
79 }
80 })();
81 }
82
83 static load_east_asian_width(arg_provider) {
84 return (() => {
85 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
86 wasm.ICU4XCodePointMapData8_load_east_asian_width(diplomat_receive_buffer, arg_provider.underlying);
87 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
88 if (is_ok) {
89 const ok_value = new ICU4XCodePointMapData8(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
90 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
91 return ok_value;
92 } else {
93 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
94 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
95 throw new diplomatRuntime.FFIError(throw_value);
96 }
97 })();
98 }
99
100 static load_hangul_syllable_type(arg_provider) {
101 return (() => {
102 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
103 wasm.ICU4XCodePointMapData8_load_hangul_syllable_type(diplomat_receive_buffer, arg_provider.underlying);
104 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
105 if (is_ok) {
106 const ok_value = new ICU4XCodePointMapData8(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
107 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
108 return ok_value;
109 } else {
110 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
111 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
112 throw new diplomatRuntime.FFIError(throw_value);
113 }
114 })();
115 }
116
117 static load_indic_syllabic_category(arg_provider) {
118 return (() => {
119 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
120 wasm.ICU4XCodePointMapData8_load_indic_syllabic_category(diplomat_receive_buffer, arg_provider.underlying);
121 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
122 if (is_ok) {
123 const ok_value = new ICU4XCodePointMapData8(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
124 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
125 return ok_value;
126 } else {
127 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
128 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
129 throw new diplomatRuntime.FFIError(throw_value);
130 }
131 })();
132 }
133
134 static load_line_break(arg_provider) {
135 return (() => {
136 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
137 wasm.ICU4XCodePointMapData8_load_line_break(diplomat_receive_buffer, arg_provider.underlying);
138 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
139 if (is_ok) {
140 const ok_value = new ICU4XCodePointMapData8(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
141 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
142 return ok_value;
143 } else {
144 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
145 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
146 throw new diplomatRuntime.FFIError(throw_value);
147 }
148 })();
149 }
150
151 static try_grapheme_cluster_break(arg_provider) {
152 return (() => {
153 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
154 wasm.ICU4XCodePointMapData8_try_grapheme_cluster_break(diplomat_receive_buffer, arg_provider.underlying);
155 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
156 if (is_ok) {
157 const ok_value = new ICU4XCodePointMapData8(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
158 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
159 return ok_value;
160 } else {
161 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
162 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
163 throw new diplomatRuntime.FFIError(throw_value);
164 }
165 })();
166 }
167
168 static load_word_break(arg_provider) {
169 return (() => {
170 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
171 wasm.ICU4XCodePointMapData8_load_word_break(diplomat_receive_buffer, arg_provider.underlying);
172 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
173 if (is_ok) {
174 const ok_value = new ICU4XCodePointMapData8(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
175 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
176 return ok_value;
177 } else {
178 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
179 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
180 throw new diplomatRuntime.FFIError(throw_value);
181 }
182 })();
183 }
184
185 static load_sentence_break(arg_provider) {
186 return (() => {
187 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
188 wasm.ICU4XCodePointMapData8_load_sentence_break(diplomat_receive_buffer, arg_provider.underlying);
189 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
190 if (is_ok) {
191 const ok_value = new ICU4XCodePointMapData8(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
192 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
193 return ok_value;
194 } else {
195 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
196 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
197 throw new diplomatRuntime.FFIError(throw_value);
198 }
199 })();
200 }
201
202 static load_joining_type(arg_provider) {
203 return (() => {
204 const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4);
205 wasm.ICU4XCodePointMapData8_load_joining_type(diplomat_receive_buffer, arg_provider.underlying);
206 const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4);
207 if (is_ok) {
208 const ok_value = new ICU4XCodePointMapData8(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []);
209 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
210 return ok_value;
211 } else {
212 const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)];
213 wasm.diplomat_free(diplomat_receive_buffer, 5, 4);
214 throw new diplomatRuntime.FFIError(throw_value);
215 }
216 })();
217 }
218 }