Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM URLSearchParams.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_URLSearchParamsBinding_h
4 : #define mozilla_dom_URLSearchParamsBinding_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/FakeString.h"
11 : #include "mozilla/dom/IterableIterator.h"
12 : #include "mozilla/dom/Nullable.h"
13 : #include "mozilla/dom/Record.h"
14 : #include "mozilla/dom/UnionMember.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : struct NativePropertyHooks;
20 : class ProtoAndIfaceCache;
21 : class URLSearchParams;
22 : struct URLSearchParamsAtoms;
23 :
24 : } // namespace dom
25 : } // namespace mozilla
26 :
27 : namespace mozilla {
28 : namespace dom {
29 :
30 : class USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString
31 : {
32 : friend class USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVStringArgument;
33 : enum Type
34 : {
35 : eUninitialized,
36 : eUSVStringSequenceSequence,
37 : eUSVStringUSVStringRecord,
38 : eUSVString
39 : };
40 :
41 0 : union Value
42 : {
43 : UnionMember<binding_detail::AutoSequence<Sequence<nsString>> > mUSVStringSequenceSequence;
44 : UnionMember<Record<nsString, nsString> > mUSVStringUSVStringRecord;
45 : UnionMember<binding_detail::FakeString > mUSVString;
46 :
47 : };
48 :
49 : Type mType;
50 : Value mValue;
51 :
52 : USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString(const USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString&) = delete;
53 : USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString& operator=(const USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString&) = delete;
54 : public:
55 0 : explicit inline USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString()
56 0 : : mType(eUninitialized)
57 : {
58 0 : }
59 :
60 0 : inline ~USVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString()
61 0 : {
62 0 : Uninit();
63 0 : }
64 :
65 : inline binding_detail::AutoSequence<Sequence<nsString>>&
66 : RawSetAsUSVStringSequenceSequence()
67 : {
68 : if (mType == eUSVStringSequenceSequence) {
69 : return mValue.mUSVStringSequenceSequence.Value();
70 : }
71 : MOZ_ASSERT(mType == eUninitialized);
72 : mType = eUSVStringSequenceSequence;
73 : return mValue.mUSVStringSequenceSequence.SetValue();
74 : }
75 :
76 : inline binding_detail::AutoSequence<Sequence<nsString>>&
77 : SetAsUSVStringSequenceSequence()
78 : {
79 : if (mType == eUSVStringSequenceSequence) {
80 : return mValue.mUSVStringSequenceSequence.Value();
81 : }
82 : Uninit();
83 : mType = eUSVStringSequenceSequence;
84 : return mValue.mUSVStringSequenceSequence.SetValue();
85 : }
86 :
87 : inline bool
88 0 : IsUSVStringSequenceSequence() const
89 : {
90 0 : return mType == eUSVStringSequenceSequence;
91 : }
92 :
93 : inline binding_detail::AutoSequence<Sequence<nsString>>&
94 : GetAsUSVStringSequenceSequence()
95 : {
96 : MOZ_ASSERT(IsUSVStringSequenceSequence(), "Wrong type!");
97 : return mValue.mUSVStringSequenceSequence.Value();
98 : }
99 :
100 : inline const Sequence<Sequence<nsString>>&
101 0 : GetAsUSVStringSequenceSequence() const
102 : {
103 0 : MOZ_ASSERT(IsUSVStringSequenceSequence(), "Wrong type!");
104 0 : return mValue.mUSVStringSequenceSequence.Value();
105 : }
106 :
107 : inline Record<nsString, nsString>&
108 : RawSetAsUSVStringUSVStringRecord()
109 : {
110 : if (mType == eUSVStringUSVStringRecord) {
111 : return mValue.mUSVStringUSVStringRecord.Value();
112 : }
113 : MOZ_ASSERT(mType == eUninitialized);
114 : mType = eUSVStringUSVStringRecord;
115 : return mValue.mUSVStringUSVStringRecord.SetValue();
116 : }
117 :
118 : inline Record<nsString, nsString>&
119 : SetAsUSVStringUSVStringRecord()
120 : {
121 : if (mType == eUSVStringUSVStringRecord) {
122 : return mValue.mUSVStringUSVStringRecord.Value();
123 : }
124 : Uninit();
125 : mType = eUSVStringUSVStringRecord;
126 : return mValue.mUSVStringUSVStringRecord.SetValue();
127 : }
128 :
129 : inline bool
130 0 : IsUSVStringUSVStringRecord() const
131 : {
132 0 : return mType == eUSVStringUSVStringRecord;
133 : }
134 :
135 : inline Record<nsString, nsString>&
136 : GetAsUSVStringUSVStringRecord()
137 : {
138 : MOZ_ASSERT(IsUSVStringUSVStringRecord(), "Wrong type!");
139 : return mValue.mUSVStringUSVStringRecord.Value();
140 : }
141 :
142 : inline const Record<nsString, nsString>&
143 0 : GetAsUSVStringUSVStringRecord() const
144 : {
145 0 : MOZ_ASSERT(IsUSVStringUSVStringRecord(), "Wrong type!");
146 0 : return mValue.mUSVStringUSVStringRecord.Value();
147 : }
148 :
149 : inline binding_detail::FakeString&
150 : RawSetAsUSVString()
151 : {
152 : if (mType == eUSVString) {
153 : return mValue.mUSVString.Value();
154 : }
155 : MOZ_ASSERT(mType == eUninitialized);
156 : mType = eUSVString;
157 : return mValue.mUSVString.SetValue();
158 : }
159 :
160 : inline binding_detail::FakeString&
161 : SetAsUSVString()
162 : {
163 : if (mType == eUSVString) {
164 : return mValue.mUSVString.Value();
165 : }
166 : Uninit();
167 : mType = eUSVString;
168 : return mValue.mUSVString.SetValue();
169 : }
170 :
171 : inline bool
172 0 : IsUSVString() const
173 : {
174 0 : return mType == eUSVString;
175 : }
176 :
177 : inline binding_detail::FakeString&
178 : GetAsUSVString()
179 : {
180 : MOZ_ASSERT(IsUSVString(), "Wrong type!");
181 : return mValue.mUSVString.Value();
182 : }
183 :
184 : inline const nsAString&
185 0 : GetAsUSVString() const
186 : {
187 0 : MOZ_ASSERT(IsUSVString(), "Wrong type!");
188 0 : return mValue.mUSVString.Value();
189 : }
190 :
191 : inline void
192 0 : Uninit()
193 : {
194 0 : switch (mType) {
195 : case eUninitialized: {
196 0 : break;
197 : }
198 : case eUSVStringSequenceSequence: {
199 0 : DestroyUSVStringSequenceSequence();
200 0 : break;
201 : }
202 : case eUSVStringUSVStringRecord: {
203 0 : DestroyUSVStringUSVStringRecord();
204 0 : break;
205 : }
206 : case eUSVString: {
207 0 : DestroyUSVString();
208 0 : break;
209 : }
210 : }
211 0 : }
212 :
213 : bool
214 : ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
215 :
216 : private:
217 : inline void
218 0 : DestroyUSVStringSequenceSequence()
219 : {
220 0 : MOZ_ASSERT(IsUSVStringSequenceSequence(), "Wrong type!");
221 0 : mValue.mUSVStringSequenceSequence.Destroy();
222 0 : mType = eUninitialized;
223 0 : }
224 :
225 : inline void
226 0 : DestroyUSVStringUSVStringRecord()
227 : {
228 0 : MOZ_ASSERT(IsUSVStringUSVStringRecord(), "Wrong type!");
229 0 : mValue.mUSVStringUSVStringRecord.Destroy();
230 0 : mType = eUninitialized;
231 0 : }
232 :
233 : inline void
234 0 : DestroyUSVString()
235 : {
236 0 : MOZ_ASSERT(IsUSVString(), "Wrong type!");
237 0 : mValue.mUSVString.Destroy();
238 0 : mType = eUninitialized;
239 0 : }
240 : };
241 :
242 :
243 : class OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString : public AllOwningUnionBase
244 : {
245 : friend void ImplCycleCollectionUnlink(OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString& aUnion);
246 : enum Type
247 : {
248 : eUninitialized,
249 : eUSVStringSequenceSequence,
250 : eUSVStringUSVStringRecord,
251 : eUSVString
252 : };
253 :
254 : union Value
255 : {
256 : UnionMember<Sequence<Sequence<nsString>> > mUSVStringSequenceSequence;
257 : UnionMember<Record<nsString, nsString> > mUSVStringUSVStringRecord;
258 : UnionMember<nsString > mUSVString;
259 :
260 : };
261 :
262 : Type mType;
263 : Value mValue;
264 :
265 : OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString(const OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString&) = delete;
266 : OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString& operator=(const OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString&) = delete;
267 : public:
268 : explicit inline OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString()
269 : : mType(eUninitialized)
270 : {
271 : }
272 :
273 : inline ~OwningUSVStringSequenceSequenceOrUSVStringUSVStringRecordOrUSVString()
274 : {
275 : Uninit();
276 : }
277 :
278 : Sequence<Sequence<nsString>>&
279 : RawSetAsUSVStringSequenceSequence();
280 :
281 : Sequence<Sequence<nsString>>&
282 : SetAsUSVStringSequenceSequence();
283 :
284 : bool
285 : TrySetToUSVStringSequenceSequence(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
286 :
287 : inline bool
288 0 : IsUSVStringSequenceSequence() const
289 : {
290 0 : return mType == eUSVStringSequenceSequence;
291 : }
292 :
293 : inline Sequence<Sequence<nsString>>&
294 : GetAsUSVStringSequenceSequence()
295 : {
296 : MOZ_ASSERT(IsUSVStringSequenceSequence(), "Wrong type!");
297 : return mValue.mUSVStringSequenceSequence.Value();
298 : }
299 :
300 : inline Sequence<Sequence<nsString>> const &
301 : GetAsUSVStringSequenceSequence() const
302 : {
303 : MOZ_ASSERT(IsUSVStringSequenceSequence(), "Wrong type!");
304 : return mValue.mUSVStringSequenceSequence.Value();
305 : }
306 :
307 : Record<nsString, nsString>&
308 : RawSetAsUSVStringUSVStringRecord();
309 :
310 : Record<nsString, nsString>&
311 : SetAsUSVStringUSVStringRecord();
312 :
313 : bool
314 : TrySetToUSVStringUSVStringRecord(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
315 :
316 : inline bool
317 0 : IsUSVStringUSVStringRecord() const
318 : {
319 0 : return mType == eUSVStringUSVStringRecord;
320 : }
321 :
322 : inline Record<nsString, nsString>&
323 : GetAsUSVStringUSVStringRecord()
324 : {
325 : MOZ_ASSERT(IsUSVStringUSVStringRecord(), "Wrong type!");
326 : return mValue.mUSVStringUSVStringRecord.Value();
327 : }
328 :
329 : inline Record<nsString, nsString> const &
330 : GetAsUSVStringUSVStringRecord() const
331 : {
332 : MOZ_ASSERT(IsUSVStringUSVStringRecord(), "Wrong type!");
333 : return mValue.mUSVStringUSVStringRecord.Value();
334 : }
335 :
336 : nsString&
337 : RawSetAsUSVString();
338 :
339 : nsString&
340 : SetAsUSVString();
341 :
342 : bool
343 : TrySetToUSVString(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
344 :
345 : inline void
346 : SetStringData(const nsString::char_type* aData, nsString::size_type aLength)
347 : {
348 : RawSetAsUSVString().Assign(aData, aLength);
349 : }
350 :
351 : inline bool
352 0 : IsUSVString() const
353 : {
354 0 : return mType == eUSVString;
355 : }
356 :
357 : inline nsString&
358 : GetAsUSVString()
359 : {
360 : MOZ_ASSERT(IsUSVString(), "Wrong type!");
361 : return mValue.mUSVString.Value();
362 : }
363 :
364 : inline nsString const &
365 : GetAsUSVString() const
366 : {
367 : MOZ_ASSERT(IsUSVString(), "Wrong type!");
368 : return mValue.mUSVString.Value();
369 : }
370 :
371 : void
372 : Uninit();
373 :
374 : bool
375 : ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
376 :
377 : void
378 : TraceUnion(JSTracer* trc);
379 :
380 : private:
381 : void
382 : DestroyUSVStringSequenceSequence();
383 :
384 : void
385 : DestroyUSVStringUSVStringRecord();
386 :
387 : void
388 : DestroyUSVString();
389 : };
390 :
391 :
392 : namespace URLSearchParamsBinding {
393 :
394 : typedef mozilla::dom::URLSearchParams NativeType;
395 :
396 : JSObject*
397 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
398 :
399 : const JSClass*
400 : GetJSClass();
401 :
402 : bool
403 : Wrap(JSContext* aCx, mozilla::dom::URLSearchParams* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
404 :
405 : template <class T>
406 0 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
407 : {
408 0 : JS::Rooted<JSObject*> reflector(aCx);
409 0 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
410 : }
411 :
412 : // We declare this as an array so that retrieving a pointer to this
413 : // binding's property hooks only requires compile/link-time resolvable
414 : // address arithmetic. Declaring it as a pointer instead would require
415 : // doing a run-time load to fetch a pointer to this binding's property
416 : // hooks. And then structures which embedded a pointer to this structure
417 : // would require a run-time load for proper initialization, which would
418 : // then induce static constructors. Lots of static constructors.
419 : extern const NativePropertyHooks sNativePropertyHooks[];
420 :
421 : void
422 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
423 :
424 : JS::Handle<JSObject*>
425 : GetProtoObjectHandle(JSContext* aCx);
426 :
427 : JS::Handle<JSObject*>
428 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
429 :
430 : JSObject*
431 : GetConstructorObject(JSContext* aCx);
432 :
433 : } // namespace URLSearchParamsBinding
434 :
435 :
436 :
437 : namespace URLSearchParamsIteratorBinding {
438 :
439 : typedef mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams> NativeType;
440 :
441 : const JSClass*
442 : GetJSClass();
443 :
444 : bool
445 : Wrap(JSContext* aCx, mozilla::dom::IterableIterator<mozilla::dom::URLSearchParams>* aObject, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
446 :
447 : // We declare this as an array so that retrieving a pointer to this
448 : // binding's property hooks only requires compile/link-time resolvable
449 : // address arithmetic. Declaring it as a pointer instead would require
450 : // doing a run-time load to fetch a pointer to this binding's property
451 : // hooks. And then structures which embedded a pointer to this structure
452 : // would require a run-time load for proper initialization, which would
453 : // then induce static constructors. Lots of static constructors.
454 : extern const NativePropertyHooks sNativePropertyHooks[];
455 :
456 : void
457 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
458 :
459 : JS::Handle<JSObject*>
460 : GetProtoObjectHandle(JSContext* aCx);
461 :
462 : } // namespace URLSearchParamsIteratorBinding
463 :
464 :
465 :
466 : } // namespace dom
467 : } // namespace mozilla
468 :
469 : #endif // mozilla_dom_URLSearchParamsBinding_h
|