Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM Gamepad.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_GamepadBinding_h
4 : #define mozilla_dom_GamepadBinding_h
5 :
6 : #include "js/RootingAPI.h"
7 : #include "jspubtd.h"
8 : #include "mozilla/ErrorResult.h"
9 : #include "mozilla/dom/BindingDeclarations.h"
10 : #include "mozilla/dom/Nullable.h"
11 :
12 : namespace mozilla {
13 : namespace dom {
14 :
15 : class Gamepad;
16 : struct GamepadAtoms;
17 : class GamepadButton;
18 : struct GamepadButtonAtoms;
19 : struct NativePropertyHooks;
20 : class ProtoAndIfaceCache;
21 :
22 : } // namespace dom
23 : } // namespace mozilla
24 :
25 : namespace mozilla {
26 : namespace dom {
27 :
28 : enum class GamepadHand : uint8_t {
29 : _empty,
30 : Left,
31 : Right,
32 : EndGuard_
33 : };
34 :
35 : namespace GamepadHandValues {
36 : extern const EnumEntry strings[4];
37 : } // namespace GamepadHandValues
38 :
39 : bool
40 : ToJSValue(JSContext* aCx, GamepadHand aArgument, JS::MutableHandle<JS::Value> aValue);
41 :
42 :
43 : enum class GamepadMappingType : uint8_t {
44 : _empty,
45 : Standard,
46 : EndGuard_
47 : };
48 :
49 : namespace GamepadMappingTypeValues {
50 : extern const EnumEntry strings[3];
51 : } // namespace GamepadMappingTypeValues
52 :
53 : bool
54 : ToJSValue(JSContext* aCx, GamepadMappingType aArgument, JS::MutableHandle<JS::Value> aValue);
55 :
56 :
57 : namespace GamepadBinding {
58 :
59 : typedef mozilla::dom::Gamepad NativeType;
60 :
61 : bool
62 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
63 :
64 : JSObject*
65 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
66 :
67 : const JSClass*
68 : GetJSClass();
69 :
70 : bool
71 : Wrap(JSContext* aCx, mozilla::dom::Gamepad* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
72 :
73 : template <class T>
74 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
75 : {
76 0 : JS::Rooted<JSObject*> reflector(aCx);
77 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
78 : }
79 :
80 : // We declare this as an array so that retrieving a pointer to this
81 : // binding's property hooks only requires compile/link-time resolvable
82 : // address arithmetic. Declaring it as a pointer instead would require
83 : // doing a run-time load to fetch a pointer to this binding's property
84 : // hooks. And then structures which embedded a pointer to this structure
85 : // would require a run-time load for proper initialization, which would
86 : // then induce static constructors. Lots of static constructors.
87 : extern const NativePropertyHooks sNativePropertyHooks[];
88 :
89 : void
90 : ClearCachedButtonsValue(mozilla::dom::Gamepad* aObject);
91 :
92 : void
93 : ClearCachedAxesValue(mozilla::dom::Gamepad* aObject);
94 :
95 : void
96 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
97 :
98 : JS::Handle<JSObject*>
99 : GetProtoObjectHandle(JSContext* aCx);
100 :
101 : JS::Handle<JSObject*>
102 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
103 :
104 : JSObject*
105 : GetConstructorObject(JSContext* aCx);
106 :
107 : } // namespace GamepadBinding
108 :
109 :
110 :
111 : namespace GamepadButtonBinding {
112 :
113 : typedef mozilla::dom::GamepadButton NativeType;
114 :
115 : bool
116 : ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
117 :
118 : JSObject*
119 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
120 :
121 : const JSClass*
122 : GetJSClass();
123 :
124 : bool
125 : Wrap(JSContext* aCx, mozilla::dom::GamepadButton* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
126 :
127 : template <class T>
128 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
129 : {
130 0 : JS::Rooted<JSObject*> reflector(aCx);
131 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
132 : }
133 :
134 : // We declare this as an array so that retrieving a pointer to this
135 : // binding's property hooks only requires compile/link-time resolvable
136 : // address arithmetic. Declaring it as a pointer instead would require
137 : // doing a run-time load to fetch a pointer to this binding's property
138 : // hooks. And then structures which embedded a pointer to this structure
139 : // would require a run-time load for proper initialization, which would
140 : // then induce static constructors. Lots of static constructors.
141 : extern const NativePropertyHooks sNativePropertyHooks[];
142 :
143 : void
144 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
145 :
146 : JS::Handle<JSObject*>
147 : GetProtoObjectHandle(JSContext* aCx);
148 :
149 : JS::Handle<JSObject*>
150 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
151 :
152 : JSObject*
153 : GetConstructorObject(JSContext* aCx);
154 :
155 : } // namespace GamepadButtonBinding
156 :
157 :
158 :
159 : } // namespace dom
160 : } // namespace mozilla
161 :
162 : #endif // mozilla_dom_GamepadBinding_h
|