1 module awebview.wrapper.cpp.jsvalue;
2
3
4 mixin template Awesomium()
5 {
6 interface JSValue
7 {
8 static struct Field { void* value_; }
9 }
10 }
11
12
13 mixin template Awesomium4D()
14 {
15 extern(C++, JSValueMember)
16 {
17 size_t sizeOfInstance();
18 void ctor(JSValue p);
19 void ctor(JSValue p, bool value);
20 void ctor(JSValue p, int value);
21 void ctor(JSValue p, double value);
22 void ctor(JSValue p, const(WebString) value);
23 void ctor(JSValue p, const(JSObject) value);
24 void ctor(JSValue p, const(JSArray) value);
25 void ctor(JSValue p, const(JSValue) original);
26 JSValue newCtor();
27 JSValue newCtor(bool value);
28 JSValue newCtor(int value);
29 JSValue newCtor(double value);
30 JSValue newCtor(const(WebString) value);
31 JSValue newCtor(const(JSObject) value);
32 JSValue newCtor(const(JSArray) value);
33 JSValue newCtor(const(JSValue) original);
34 void dtor(JSValue p);
35 void deleteDtor(JSValue p);
36 JSValue opAssign(JSValue p, const(JSValue) rhs);
37 const(JSValue) Undefined();
38 const(JSValue) Null();
39 bool IsBoolean(const JSValue p);
40 bool IsInteger(const(JSValue) p);
41 bool IsDouble(const(JSValue) p);
42 bool IsNumber(const(JSValue) p);
43 bool IsString(const(JSValue) p);
44 bool IsArray(const(JSValue) p);
45 bool IsObject(const(JSValue) p);
46 bool IsNull(const(JSValue) p);
47 bool IsUndefined(const(JSValue) p);
48 void ToString(const(JSValue) p, WebString dst);
49 int ToInteger(const JSValue p);
50 double ToDouble(const JSValue p);
51 bool ToBoolean(const JSValue p);
52 JSArray ToArray(JSValue p);
53 const(JSArray) ToArray(const(JSValue) p);
54 JSObject ToObject(JSValue p);
55 const(JSObject) ToObject(const(JSValue) p);
56 }
57
58 unittest {
59 assert(JSValueMember.sizeOfInstance()
60 == JSValue.Field.sizeof);
61
62 static struct JSValueD {;
63 JSValue cppObj() @nogc nothrow @trusted { return cast(JSValue)cast(void*)&_field; }
64 private JSValue.Field _field;
65 }
66 }
67 }