VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcMessagePrimitives.h@ 102340

Last change on this file since 102340 was 1, checked in by vboxsync, 54 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is Mozilla IPC.
15 *
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 2002
19 * the Initial Developer. All Rights Reserved.
20 *
21 * Contributor(s):
22 * Darin Fisher <darin@netscape.com>
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38#ifndef ipcMessagePrimitives_h__
39#define ipcMessagePrimitives_h__
40
41#include "ipcMessage.h"
42
43class ipcMessage_DWORD : public ipcMessage
44{
45public:
46 ipcMessage_DWORD(const nsID &target, PRUint32 first)
47 {
48 Init(target, (char *) &first, sizeof(first));
49 }
50
51 PRUint32 First() const
52 {
53 return ((PRUint32 *) Data())[0];
54 }
55};
56
57class ipcMessage_DWORD_DWORD : public ipcMessage
58{
59public:
60 ipcMessage_DWORD_DWORD(const nsID &target, PRUint32 first, PRUint32 second)
61 {
62 PRUint32 data[2] = { first, second };
63 Init(target, (char *) data, sizeof(data));
64 }
65
66 PRUint32 First() const
67 {
68 return ((PRUint32 *) Data())[0];
69 }
70
71 PRUint32 Second() const
72 {
73 return ((PRUint32 *) Data())[1];
74 }
75};
76
77class ipcMessage_DWORD_DWORD_DWORD : public ipcMessage
78{
79public:
80 ipcMessage_DWORD_DWORD_DWORD(const nsID &target, PRUint32 first, PRUint32 second, PRUint32 third)
81 {
82 PRUint32 data[3] = { first, second, third };
83 Init(target, (char *) data, sizeof(data));
84 }
85
86 PRUint32 First() const
87 {
88 return ((PRUint32 *) Data())[0];
89 }
90
91 PRUint32 Second() const
92 {
93 return ((PRUint32 *) Data())[1];
94 }
95
96 PRUint32 Third() const
97 {
98 return ((PRUint32 *) Data())[2];
99 }
100};
101
102class ipcMessage_DWORD_DWORD_DWORD_DWORD : public ipcMessage
103{
104public:
105 ipcMessage_DWORD_DWORD_DWORD_DWORD(const nsID &target, PRUint32 first, PRUint32 second, PRUint32 third, PRUint32 fourth)
106 {
107 PRUint32 data[4] = { first, second, third, fourth };
108 Init(target, (char *) data, sizeof(data));
109 }
110
111 PRUint32 First() const
112 {
113 return ((PRUint32 *) Data())[0];
114 }
115
116 PRUint32 Second() const
117 {
118 return ((PRUint32 *) Data())[1];
119 }
120
121 PRUint32 Third() const
122 {
123 return ((PRUint32 *) Data())[2];
124 }
125
126 PRUint32 Fourth() const
127 {
128 return ((PRUint32 *) Data())[3];
129 }
130};
131
132class ipcMessage_DWORD_STR : public ipcMessage
133{
134public:
135 ipcMessage_DWORD_STR(const nsID &target, PRUint32 first, const char *second) NS_HIDDEN;
136
137 PRUint32 First() const
138 {
139 return ((PRUint32 *) Data())[0];
140 }
141
142 const char *Second() const
143 {
144 return Data() + sizeof(PRUint32);
145 }
146};
147
148class ipcMessage_DWORD_DWORD_STR : public ipcMessage
149{
150public:
151 ipcMessage_DWORD_DWORD_STR(const nsID &target, PRUint32 first, PRUint32 second, const char *third) NS_HIDDEN;
152
153 PRUint32 First() const
154 {
155 return ((PRUint32 *) Data())[0];
156 }
157
158 PRUint32 Second() const
159 {
160 return ((PRUint32 *) Data())[1];
161 }
162
163 const char *Third() const
164 {
165 return Data() + 2 * sizeof(PRUint32);
166 }
167};
168
169class ipcMessage_DWORD_ID : public ipcMessage
170{
171public:
172 ipcMessage_DWORD_ID(const nsID &target, PRUint32 first, const nsID &second) NS_HIDDEN;
173
174 PRUint32 First() const
175 {
176 return ((PRUint32 *) Data())[0];
177 }
178
179 const nsID &Second() const
180 {
181 return * (const nsID *) (Data() + sizeof(PRUint32));
182 }
183};
184
185class ipcMessage_DWORD_DWORD_ID : public ipcMessage
186{
187public:
188 ipcMessage_DWORD_DWORD_ID(const nsID &target, PRUint32 first, PRUint32 second, const nsID &third) NS_HIDDEN;
189
190 PRUint32 First() const
191 {
192 return ((PRUint32 *) Data())[0];
193 }
194
195 PRUint32 Second() const
196 {
197 return ((PRUint32 *) Data())[1];
198 }
199
200 const nsID &Third() const
201 {
202 return * (const nsID *) (Data() + 2 * sizeof(PRUint32));
203 }
204};
205
206#endif // !ipcMessagePrimitives_h__
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use