Line data Source code
1 : //
2 : // Automatically generated by ipdlc.
3 : // Edit at your own risk
4 : //
5 :
6 :
7 : #include "mozilla/dom/PBrowserOrId.h"
8 :
9 :
10 : //-----------------------------------------------------------------------------
11 : // Method definitions for the IPDL type |union PBrowserOrId|
12 : //
13 : namespace mozilla {
14 : namespace dom {
15 9 : auto PBrowserOrId::MaybeDestroy(Type aNewType) -> bool
16 : {
17 9 : if ((mType) == (T__None)) {
18 3 : return true;
19 : }
20 6 : if ((mType) == (aNewType)) {
21 0 : return false;
22 : }
23 6 : switch (mType) {
24 : case TPBrowserParent:
25 : {
26 3 : (ptr_PBrowserParent())->~PBrowserParent__tdef();
27 3 : break;
28 : }
29 : case TPBrowserChild:
30 : {
31 3 : (ptr_PBrowserChild())->~PBrowserChild__tdef();
32 3 : break;
33 : }
34 : case TTabId:
35 : {
36 0 : (ptr_TabId())->~TabId__tdef();
37 0 : break;
38 : }
39 : default:
40 : {
41 0 : mozilla::ipc::LogicError("not reached");
42 0 : break;
43 : }
44 : }
45 6 : return true;
46 : }
47 :
48 0 : MOZ_IMPLICIT PBrowserOrId::PBrowserOrId(PBrowserParent* aOther)
49 : {
50 0 : new (mozilla::KnownNotNull, ptr_PBrowserParent()) PBrowserParent*(const_cast<PBrowserParent*>(aOther));
51 0 : mType = TPBrowserParent;
52 0 : }
53 :
54 3 : MOZ_IMPLICIT PBrowserOrId::PBrowserOrId(PBrowserChild* aOther)
55 : {
56 3 : new (mozilla::KnownNotNull, ptr_PBrowserChild()) PBrowserChild*(const_cast<PBrowserChild*>(aOther));
57 3 : mType = TPBrowserChild;
58 3 : }
59 :
60 0 : MOZ_IMPLICIT PBrowserOrId::PBrowserOrId(const TabId& aOther)
61 : {
62 0 : new (mozilla::KnownNotNull, ptr_TabId()) TabId(aOther);
63 0 : mType = TTabId;
64 0 : }
65 :
66 0 : MOZ_IMPLICIT PBrowserOrId::PBrowserOrId(const PBrowserOrId& aOther)
67 : {
68 0 : (aOther).AssertSanity();
69 0 : switch ((aOther).type()) {
70 : case TPBrowserParent:
71 : {
72 0 : new (mozilla::KnownNotNull, ptr_PBrowserParent()) PBrowserParent*(const_cast<PBrowserParent*>((aOther).get_PBrowserParent()));
73 0 : break;
74 : }
75 : case TPBrowserChild:
76 : {
77 0 : new (mozilla::KnownNotNull, ptr_PBrowserChild()) PBrowserChild*(const_cast<PBrowserChild*>((aOther).get_PBrowserChild()));
78 0 : break;
79 : }
80 : case TTabId:
81 : {
82 0 : new (mozilla::KnownNotNull, ptr_TabId()) TabId((aOther).get_TabId());
83 0 : break;
84 : }
85 : case T__None:
86 : {
87 0 : break;
88 : }
89 : default:
90 : {
91 0 : mozilla::ipc::LogicError("unreached");
92 0 : return;
93 : }
94 : }
95 0 : mType = (aOther).type();
96 : }
97 :
98 12 : PBrowserOrId::~PBrowserOrId()
99 : {
100 6 : static_cast<void>(MaybeDestroy(T__None));
101 6 : }
102 :
103 3 : auto PBrowserOrId::operator=(PBrowserParent* aRhs) -> PBrowserOrId&
104 : {
105 3 : if (MaybeDestroy(TPBrowserParent)) {
106 3 : new (mozilla::KnownNotNull, ptr_PBrowserParent()) PBrowserParent*;
107 : }
108 3 : (*(ptr_PBrowserParent())) = const_cast<PBrowserParent*>(aRhs);
109 3 : mType = TPBrowserParent;
110 3 : return (*(this));
111 : }
112 :
113 0 : auto PBrowserOrId::operator=(PBrowserChild* aRhs) -> PBrowserOrId&
114 : {
115 0 : if (MaybeDestroy(TPBrowserChild)) {
116 0 : new (mozilla::KnownNotNull, ptr_PBrowserChild()) PBrowserChild*;
117 : }
118 0 : (*(ptr_PBrowserChild())) = const_cast<PBrowserChild*>(aRhs);
119 0 : mType = TPBrowserChild;
120 0 : return (*(this));
121 : }
122 :
123 0 : auto PBrowserOrId::operator=(const TabId& aRhs) -> PBrowserOrId&
124 : {
125 0 : if (MaybeDestroy(TTabId)) {
126 0 : new (mozilla::KnownNotNull, ptr_TabId()) TabId;
127 : }
128 0 : (*(ptr_TabId())) = aRhs;
129 0 : mType = TTabId;
130 0 : return (*(this));
131 : }
132 :
133 0 : auto PBrowserOrId::operator=(const PBrowserOrId& aRhs) -> PBrowserOrId&
134 : {
135 0 : (aRhs).AssertSanity();
136 0 : Type t = (aRhs).type();
137 0 : switch (t) {
138 : case TPBrowserParent:
139 : {
140 0 : if (MaybeDestroy(t)) {
141 0 : new (mozilla::KnownNotNull, ptr_PBrowserParent()) PBrowserParent*;
142 : }
143 0 : (*(ptr_PBrowserParent())) = const_cast<PBrowserParent*>((aRhs).get_PBrowserParent());
144 0 : break;
145 : }
146 : case TPBrowserChild:
147 : {
148 0 : if (MaybeDestroy(t)) {
149 0 : new (mozilla::KnownNotNull, ptr_PBrowserChild()) PBrowserChild*;
150 : }
151 0 : (*(ptr_PBrowserChild())) = const_cast<PBrowserChild*>((aRhs).get_PBrowserChild());
152 0 : break;
153 : }
154 : case TTabId:
155 : {
156 0 : if (MaybeDestroy(t)) {
157 0 : new (mozilla::KnownNotNull, ptr_TabId()) TabId;
158 : }
159 0 : (*(ptr_TabId())) = (aRhs).get_TabId();
160 0 : break;
161 : }
162 : case T__None:
163 : {
164 0 : static_cast<void>(MaybeDestroy(t));
165 0 : break;
166 : }
167 : default:
168 : {
169 0 : mozilla::ipc::LogicError("unreached");
170 0 : break;
171 : }
172 : }
173 0 : mType = t;
174 0 : return (*(this));
175 : }
176 :
177 0 : auto PBrowserOrId::operator==(PBrowserParent* aRhs) const -> bool
178 : {
179 0 : return (get_PBrowserParent()) == (aRhs);
180 : }
181 :
182 0 : auto PBrowserOrId::operator==(PBrowserChild* aRhs) const -> bool
183 : {
184 0 : return (get_PBrowserChild()) == (aRhs);
185 : }
186 :
187 0 : auto PBrowserOrId::operator==(const TabId& aRhs) const -> bool
188 : {
189 0 : return (get_TabId()) == (aRhs);
190 : }
191 :
192 0 : auto PBrowserOrId::operator==(const PBrowserOrId& aRhs) const -> bool
193 : {
194 0 : if ((type()) != ((aRhs).type())) {
195 0 : return false;
196 : }
197 :
198 0 : switch (type()) {
199 : case TPBrowserParent:
200 : {
201 0 : return (get_PBrowserParent()) == ((aRhs).get_PBrowserParent());
202 : }
203 : case TPBrowserChild:
204 : {
205 0 : return (get_PBrowserChild()) == ((aRhs).get_PBrowserChild());
206 : }
207 : case TTabId:
208 : {
209 0 : return (get_TabId()) == ((aRhs).get_TabId());
210 : }
211 : default:
212 : {
213 0 : mozilla::ipc::LogicError("unreached");
214 0 : return false;
215 : }
216 : }
217 : }
218 :
219 0 : auto PBrowserOrId::get(PBrowserParent** aOutValue) const -> void
220 : {
221 0 : (*(aOutValue)) = get_PBrowserParent();
222 0 : }
223 :
224 0 : auto PBrowserOrId::get(PBrowserChild** aOutValue) const -> void
225 : {
226 0 : (*(aOutValue)) = get_PBrowserChild();
227 0 : }
228 :
229 0 : auto PBrowserOrId::get(TabId* aOutValue) const -> void
230 : {
231 0 : (*(aOutValue)) = get_TabId();
232 0 : }
233 :
234 : } // namespace dom
235 : } // namespace mozilla
|