Line data Source code
1 : //
2 : // Automatically generated by ipdlc.
3 : // Edit at your own risk
4 : //
5 :
6 :
7 : #include "mozilla/dom/BlobTypes.h"
8 :
9 :
10 : //-----------------------------------------------------------------------------
11 : // Method definitions for the IPDL type |union OptionalFileDescriptorSet|
12 : //
13 : namespace mozilla {
14 : namespace dom {
15 0 : auto OptionalFileDescriptorSet::MaybeDestroy(Type aNewType) -> bool
16 : {
17 0 : if ((mType) == (T__None)) {
18 0 : return true;
19 : }
20 0 : if ((mType) == (aNewType)) {
21 0 : return false;
22 : }
23 0 : switch (mType) {
24 : case TPFileDescriptorSetParent:
25 : {
26 0 : (ptr_PFileDescriptorSetParent())->~PFileDescriptorSetParent__tdef();
27 0 : break;
28 : }
29 : case TPFileDescriptorSetChild:
30 : {
31 0 : (ptr_PFileDescriptorSetChild())->~PFileDescriptorSetChild__tdef();
32 0 : break;
33 : }
34 : case TArrayOfFileDescriptor:
35 : {
36 0 : (ptr_ArrayOfFileDescriptor())->~ArrayOfFileDescriptor__tdef();
37 0 : break;
38 : }
39 : case Tvoid_t:
40 : {
41 0 : (ptr_void_t())->~void_t__tdef();
42 0 : break;
43 : }
44 : default:
45 : {
46 0 : mozilla::ipc::LogicError("not reached");
47 0 : break;
48 : }
49 : }
50 0 : return true;
51 : }
52 :
53 0 : MOZ_IMPLICIT OptionalFileDescriptorSet::OptionalFileDescriptorSet(PFileDescriptorSetParent* aOther)
54 : {
55 0 : new (mozilla::KnownNotNull, ptr_PFileDescriptorSetParent()) PFileDescriptorSetParent*(const_cast<PFileDescriptorSetParent*>(aOther));
56 0 : mType = TPFileDescriptorSetParent;
57 0 : }
58 :
59 0 : MOZ_IMPLICIT OptionalFileDescriptorSet::OptionalFileDescriptorSet(PFileDescriptorSetChild* aOther)
60 : {
61 0 : new (mozilla::KnownNotNull, ptr_PFileDescriptorSetChild()) PFileDescriptorSetChild*(const_cast<PFileDescriptorSetChild*>(aOther));
62 0 : mType = TPFileDescriptorSetChild;
63 0 : }
64 :
65 0 : MOZ_IMPLICIT OptionalFileDescriptorSet::OptionalFileDescriptorSet(const nsTArray<FileDescriptor>& aOther)
66 : {
67 0 : new (mozilla::KnownNotNull, ptr_ArrayOfFileDescriptor()) nsTArray<FileDescriptor>(aOther);
68 0 : mType = TArrayOfFileDescriptor;
69 0 : }
70 :
71 0 : MOZ_IMPLICIT OptionalFileDescriptorSet::OptionalFileDescriptorSet(const void_t& aOther)
72 : {
73 0 : new (mozilla::KnownNotNull, ptr_void_t()) void_t(aOther);
74 0 : mType = Tvoid_t;
75 0 : }
76 :
77 0 : MOZ_IMPLICIT OptionalFileDescriptorSet::OptionalFileDescriptorSet(const OptionalFileDescriptorSet& aOther)
78 : {
79 0 : (aOther).AssertSanity();
80 0 : switch ((aOther).type()) {
81 : case TPFileDescriptorSetParent:
82 : {
83 0 : new (mozilla::KnownNotNull, ptr_PFileDescriptorSetParent()) PFileDescriptorSetParent*(const_cast<PFileDescriptorSetParent*>((aOther).get_PFileDescriptorSetParent()));
84 0 : break;
85 : }
86 : case TPFileDescriptorSetChild:
87 : {
88 0 : new (mozilla::KnownNotNull, ptr_PFileDescriptorSetChild()) PFileDescriptorSetChild*(const_cast<PFileDescriptorSetChild*>((aOther).get_PFileDescriptorSetChild()));
89 0 : break;
90 : }
91 : case TArrayOfFileDescriptor:
92 : {
93 0 : new (mozilla::KnownNotNull, ptr_ArrayOfFileDescriptor()) nsTArray<FileDescriptor>((aOther).get_ArrayOfFileDescriptor());
94 0 : break;
95 : }
96 : case Tvoid_t:
97 : {
98 0 : new (mozilla::KnownNotNull, ptr_void_t()) void_t((aOther).get_void_t());
99 0 : break;
100 : }
101 : case T__None:
102 : {
103 0 : break;
104 : }
105 : default:
106 : {
107 0 : mozilla::ipc::LogicError("unreached");
108 0 : return;
109 : }
110 : }
111 0 : mType = (aOther).type();
112 : }
113 :
114 0 : OptionalFileDescriptorSet::~OptionalFileDescriptorSet()
115 : {
116 0 : static_cast<void>(MaybeDestroy(T__None));
117 0 : }
118 :
119 0 : auto OptionalFileDescriptorSet::operator=(PFileDescriptorSetParent* aRhs) -> OptionalFileDescriptorSet&
120 : {
121 0 : if (MaybeDestroy(TPFileDescriptorSetParent)) {
122 0 : new (mozilla::KnownNotNull, ptr_PFileDescriptorSetParent()) PFileDescriptorSetParent*;
123 : }
124 0 : (*(ptr_PFileDescriptorSetParent())) = const_cast<PFileDescriptorSetParent*>(aRhs);
125 0 : mType = TPFileDescriptorSetParent;
126 0 : return (*(this));
127 : }
128 :
129 0 : auto OptionalFileDescriptorSet::operator=(PFileDescriptorSetChild* aRhs) -> OptionalFileDescriptorSet&
130 : {
131 0 : if (MaybeDestroy(TPFileDescriptorSetChild)) {
132 0 : new (mozilla::KnownNotNull, ptr_PFileDescriptorSetChild()) PFileDescriptorSetChild*;
133 : }
134 0 : (*(ptr_PFileDescriptorSetChild())) = const_cast<PFileDescriptorSetChild*>(aRhs);
135 0 : mType = TPFileDescriptorSetChild;
136 0 : return (*(this));
137 : }
138 :
139 0 : auto OptionalFileDescriptorSet::operator=(const nsTArray<FileDescriptor>& aRhs) -> OptionalFileDescriptorSet&
140 : {
141 0 : if (MaybeDestroy(TArrayOfFileDescriptor)) {
142 0 : new (mozilla::KnownNotNull, ptr_ArrayOfFileDescriptor()) nsTArray<FileDescriptor>;
143 : }
144 0 : (*(ptr_ArrayOfFileDescriptor())) = aRhs;
145 0 : mType = TArrayOfFileDescriptor;
146 0 : return (*(this));
147 : }
148 :
149 0 : auto OptionalFileDescriptorSet::operator=(const void_t& aRhs) -> OptionalFileDescriptorSet&
150 : {
151 0 : if (MaybeDestroy(Tvoid_t)) {
152 0 : new (mozilla::KnownNotNull, ptr_void_t()) void_t;
153 : }
154 0 : (*(ptr_void_t())) = aRhs;
155 0 : mType = Tvoid_t;
156 0 : return (*(this));
157 : }
158 :
159 0 : auto OptionalFileDescriptorSet::operator=(const OptionalFileDescriptorSet& aRhs) -> OptionalFileDescriptorSet&
160 : {
161 0 : (aRhs).AssertSanity();
162 0 : Type t = (aRhs).type();
163 0 : switch (t) {
164 : case TPFileDescriptorSetParent:
165 : {
166 0 : if (MaybeDestroy(t)) {
167 0 : new (mozilla::KnownNotNull, ptr_PFileDescriptorSetParent()) PFileDescriptorSetParent*;
168 : }
169 0 : (*(ptr_PFileDescriptorSetParent())) = const_cast<PFileDescriptorSetParent*>((aRhs).get_PFileDescriptorSetParent());
170 0 : break;
171 : }
172 : case TPFileDescriptorSetChild:
173 : {
174 0 : if (MaybeDestroy(t)) {
175 0 : new (mozilla::KnownNotNull, ptr_PFileDescriptorSetChild()) PFileDescriptorSetChild*;
176 : }
177 0 : (*(ptr_PFileDescriptorSetChild())) = const_cast<PFileDescriptorSetChild*>((aRhs).get_PFileDescriptorSetChild());
178 0 : break;
179 : }
180 : case TArrayOfFileDescriptor:
181 : {
182 0 : if (MaybeDestroy(t)) {
183 0 : new (mozilla::KnownNotNull, ptr_ArrayOfFileDescriptor()) nsTArray<FileDescriptor>;
184 : }
185 0 : (*(ptr_ArrayOfFileDescriptor())) = (aRhs).get_ArrayOfFileDescriptor();
186 0 : break;
187 : }
188 : case Tvoid_t:
189 : {
190 0 : if (MaybeDestroy(t)) {
191 0 : new (mozilla::KnownNotNull, ptr_void_t()) void_t;
192 : }
193 0 : (*(ptr_void_t())) = (aRhs).get_void_t();
194 0 : break;
195 : }
196 : case T__None:
197 : {
198 0 : static_cast<void>(MaybeDestroy(t));
199 0 : break;
200 : }
201 : default:
202 : {
203 0 : mozilla::ipc::LogicError("unreached");
204 0 : break;
205 : }
206 : }
207 0 : mType = t;
208 0 : return (*(this));
209 : }
210 :
211 0 : auto OptionalFileDescriptorSet::operator==(PFileDescriptorSetParent* aRhs) const -> bool
212 : {
213 0 : return (get_PFileDescriptorSetParent()) == (aRhs);
214 : }
215 :
216 0 : auto OptionalFileDescriptorSet::operator==(PFileDescriptorSetChild* aRhs) const -> bool
217 : {
218 0 : return (get_PFileDescriptorSetChild()) == (aRhs);
219 : }
220 :
221 0 : auto OptionalFileDescriptorSet::operator==(const nsTArray<FileDescriptor>& aRhs) const -> bool
222 : {
223 0 : return (get_ArrayOfFileDescriptor()) == (aRhs);
224 : }
225 :
226 0 : auto OptionalFileDescriptorSet::operator==(const void_t& aRhs) const -> bool
227 : {
228 0 : return (get_void_t()) == (aRhs);
229 : }
230 :
231 0 : auto OptionalFileDescriptorSet::operator==(const OptionalFileDescriptorSet& aRhs) const -> bool
232 : {
233 0 : if ((type()) != ((aRhs).type())) {
234 0 : return false;
235 : }
236 :
237 0 : switch (type()) {
238 : case TPFileDescriptorSetParent:
239 : {
240 0 : return (get_PFileDescriptorSetParent()) == ((aRhs).get_PFileDescriptorSetParent());
241 : }
242 : case TPFileDescriptorSetChild:
243 : {
244 0 : return (get_PFileDescriptorSetChild()) == ((aRhs).get_PFileDescriptorSetChild());
245 : }
246 : case TArrayOfFileDescriptor:
247 : {
248 0 : return (get_ArrayOfFileDescriptor()) == ((aRhs).get_ArrayOfFileDescriptor());
249 : }
250 : case Tvoid_t:
251 : {
252 0 : return (get_void_t()) == ((aRhs).get_void_t());
253 : }
254 : default:
255 : {
256 0 : mozilla::ipc::LogicError("unreached");
257 0 : return false;
258 : }
259 : }
260 : }
261 :
262 0 : auto OptionalFileDescriptorSet::get(PFileDescriptorSetParent** aOutValue) const -> void
263 : {
264 0 : (*(aOutValue)) = get_PFileDescriptorSetParent();
265 0 : }
266 :
267 0 : auto OptionalFileDescriptorSet::get(PFileDescriptorSetChild** aOutValue) const -> void
268 : {
269 0 : (*(aOutValue)) = get_PFileDescriptorSetChild();
270 0 : }
271 :
272 0 : auto OptionalFileDescriptorSet::get(nsTArray<FileDescriptor>* aOutValue) const -> void
273 : {
274 0 : (*(aOutValue)) = get_ArrayOfFileDescriptor();
275 0 : }
276 :
277 0 : auto OptionalFileDescriptorSet::get(void_t* aOutValue) const -> void
278 : {
279 0 : (*(aOutValue)) = get_void_t();
280 0 : }
281 :
282 : } // namespace dom
283 : } // namespace mozilla
|