1// generated by diplomat-tool 2import wasm from "./diplomat-wasm.mjs"; 3import * as diplomatRuntime from "./diplomat-runtime.mjs"; 4 5 6/** Additional information: [1](https://docs.rs/icu/latest/icu/calendar/enum.ParseError.html), [2](https://docs.rs/icu/latest/icu/time/enum.ParseError.html) 7*/ 8 9 10export class CalendarParseError { 11 12 #value = undefined; 13 14 static #values = new Map([ 15 ["Unknown", 0], 16 ["InvalidSyntax", 1], 17 ["OutOfRange", 2], 18 ["MissingFields", 3], 19 ["UnknownCalendar", 4] 20 ]); 21 22 static getAllEntries() { 23 return CalendarParseError.#values.entries(); 24 } 25 26 #internalConstructor(value) { 27 if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) { 28 // We pass in two internalConstructor arguments to create *new* 29 // instances of this type, otherwise the enums are treated as singletons. 30 if (arguments[1] === diplomatRuntime.internalConstructor ) { 31 this.#value = arguments[2]; 32 return this; 33 } 34 return CalendarParseError.#objectValues[arguments[1]]; 35 } 36 37 if (value instanceof CalendarParseError) { 38 return value; 39 } 40 41 let intVal = CalendarParseError.#values.get(value); 42 43 // Nullish check, checks for null or undefined 44 if (intVal != null) { 45 return CalendarParseError.#objectValues[intVal]; 46 } 47 48 throw TypeError(value + " is not a CalendarParseError and does not correspond to any of its enumerator values."); 49 } 50 51 static fromValue(value) { 52 return new CalendarParseError(value); 53 } 54 55 get value() { 56 return [...CalendarParseError.#values.keys()][this.#value]; 57 } 58 59 get ffiValue() { 60 return this.#value; 61 } 62 static #objectValues = [ 63 new CalendarParseError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0), 64 new CalendarParseError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1), 65 new CalendarParseError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2), 66 new CalendarParseError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3), 67 new CalendarParseError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4), 68 ]; 69 70 static Unknown = CalendarParseError.#objectValues[0]; 71 static InvalidSyntax = CalendarParseError.#objectValues[1]; 72 static OutOfRange = CalendarParseError.#objectValues[2]; 73 static MissingFields = CalendarParseError.#objectValues[3]; 74 static UnknownCalendar = CalendarParseError.#objectValues[4]; 75 76 constructor(value) { 77 return this.#internalConstructor(...arguments) 78 } 79}