1 module libwasm.bindings.L10nUtils; 2 3 import libwasm.types; 4 5 import memutils.ct : tuple; 6 7 @safe: 8 nothrow: 9 10 struct AttributeNameValue 11 { 12 nothrow: 13 JsHandle handle; 14 alias handle this; 15 this(Handle h) 16 { 17 this.handle = JsHandle(h); 18 } 19 20 static auto create() 21 { 22 return AttributeNameValue(libwasm_add__object()); 23 } 24 25 void name()(string name) 26 { 27 Object_Call_string__void(this.handle, "name", name); 28 } 29 30 string name()() 31 { 32 return Object_Getter__string(this.handle, "name"); 33 } 34 35 void value()(string value) 36 { 37 Object_Call_string__void(this.handle, "value", value); 38 } 39 40 string value()() 41 { 42 return Object_Getter__string(this.handle, "value"); 43 } 44 } 45 46 alias L10nCallback = JsPromise!(Sequence!(L10nValue)) delegate(Sequence!(L10nElement)); 47 struct L10nElement 48 { 49 nothrow: 50 JsHandle handle; 51 alias handle this; 52 this(Handle h) 53 { 54 this.handle = JsHandle(h); 55 } 56 57 static auto create() 58 { 59 return L10nElement(libwasm_add__object()); 60 } 61 62 void namespaceURI()(string namespaceURI) 63 { 64 Object_Call_string__void(this.handle, "namespaceURI", namespaceURI); 65 } 66 67 string namespaceURI()() 68 { 69 return Object_Getter__string(this.handle, "namespaceURI"); 70 } 71 72 void localName()(string localName) 73 { 74 Object_Call_string__void(this.handle, "localName", localName); 75 } 76 77 string localName()() 78 { 79 return Object_Getter__string(this.handle, "localName"); 80 } 81 82 void l10nId()(string l10nId) 83 { 84 Object_Call_string__void(this.handle, "l10nId", l10nId); 85 } 86 87 string l10nId()() 88 { 89 return Object_Getter__string(this.handle, "l10nId"); 90 } 91 92 void type(T0)(scope auto ref Optional!(T0) type) if (isTOrPointer!(T0, string)) 93 { 94 Serialize_Object_VarArgCall!void(this.handle, "type", "Optional!(string)", tuple(!type.empty, type 95 .front)); 96 } 97 98 Optional!(string) type()() 99 { 100 return Object_Getter__OptionalString(this.handle, "type"); 101 } 102 103 void l10nAttrs(T0)(scope auto ref Optional!(T0) l10nAttrs) 104 if (isTOrPointer!(T0, string)) 105 { 106 Serialize_Object_VarArgCall!void(this.handle, "l10nAttrs", "Optional!(string)", tuple(!l10nAttrs.empty, l10nAttrs 107 .front)); 108 } 109 110 Optional!(string) l10nAttrs()() 111 { 112 return Object_Getter__OptionalString(this.handle, "l10nAttrs"); 113 } 114 115 void l10nArgs(T0)(scope auto ref Optional!(T0) l10nArgs) 116 if (isTOrPointer!(T0, JsObject)) 117 { 118 Serialize_Object_VarArgCall!void(this.handle, "l10nArgs", "Optional!Handle", tuple(!l10nArgs.empty, cast( 119 Handle) l10nArgs.front.handle)); 120 } 121 122 auto l10nArgs()() 123 { 124 return recastOpt!(JsObject)(Object_Getter__OptionalHandle(this.handle, "l10nArgs")); 125 } 126 } 127 128 struct L10nValue 129 { 130 nothrow: 131 JsHandle handle; 132 alias handle this; 133 this(Handle h) 134 { 135 this.handle = JsHandle(h); 136 } 137 138 static auto create() 139 { 140 return L10nValue(libwasm_add__object()); 141 } 142 143 void value(T0)(scope auto ref Optional!(T0) value) if (isTOrPointer!(T0, string)) 144 { 145 Serialize_Object_VarArgCall!void(this.handle, "value", "Optional!(string)", tuple(!value.empty, value 146 .front)); 147 } 148 149 Optional!(string) value()() 150 { 151 return Object_Getter__OptionalString(this.handle, "value"); 152 } 153 154 void attributes(T0)(scope auto ref Optional!(T0) attributes) 155 if (isTOrPointer!(T0, Sequence!(AttributeNameValue))) 156 { 157 Serialize_Object_VarArgCall!void(this.handle, "attributes", "Optional!Handle", tuple( 158 !attributes.empty, cast(Handle) attributes.front.handle)); 159 } 160 161 auto attributes()() 162 { 163 return recastOpt!(Sequence!(AttributeNameValue))( 164 Object_Getter__OptionalHandle(this.handle, "attributes")); 165 } 166 }