Fix typo in 9b54bd30006c008b4a951331b273613d5bac3abf
[pm.git] / ipc / glue / nsIIPCSerializableInputStream.h
blob88f296b7e378060c15cde1e87ff65fc3f153990a
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_ipc_nsIIPCSerializableInputStream_h
6 #define mozilla_ipc_nsIIPCSerializableInputStream_h
8 #include "nsISupports.h"
9 #include "mozilla/Attributes.h"
11 struct nsTArrayDefaultAllocator;
12 template <class> class nsTArray;
14 namespace mozilla {
15 namespace ipc {
17 class FileDescriptor;
18 class InputStreamParams;
20 } // namespace ipc
21 } // namespace mozilla
23 #define NS_IIPCSERIALIZABLEINPUTSTREAM_IID \
24 {0xb0211b14, 0xea6d, 0x40d4, {0x87, 0xb5, 0x7b, 0xe3, 0xdf, 0xac, 0x09, 0xd1}}
26 class NS_NO_VTABLE nsIIPCSerializableInputStream : public nsISupports
28 public:
29 typedef nsTArray<mozilla::ipc::FileDescriptor>
30 FileDescriptorArray;
32 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIPCSERIALIZABLEINPUTSTREAM_IID)
34 virtual void
35 Serialize(mozilla::ipc::InputStreamParams& aParams,
36 FileDescriptorArray& aFileDescriptors) = 0;
38 virtual bool
39 Deserialize(const mozilla::ipc::InputStreamParams& aParams,
40 const FileDescriptorArray& aFileDescriptors) = 0;
43 NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream,
44 NS_IIPCSERIALIZABLEINPUTSTREAM_IID)
46 #define NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM \
47 virtual void \
48 Serialize(mozilla::ipc::InputStreamParams&, \
49 FileDescriptorArray&) override; \
51 virtual bool \
52 Deserialize(const mozilla::ipc::InputStreamParams&, \
53 const FileDescriptorArray&) override;
55 #define NS_FORWARD_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \
56 virtual void \
57 Serialize(mozilla::ipc::InputStreamParams& aParams, \
58 FileDescriptorArray& aFileDescriptors) override \
59 { \
60 _to Serialize(aParams, aFileDescriptors); \
61 } \
63 virtual bool \
64 Deserialize(const mozilla::ipc::InputStreamParams& aParams, \
65 const FileDescriptorArray& aFileDescriptors) override \
66 { \
67 return _to Deserialize(aParams, aFileDescriptors); \
70 #define NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \
71 virtual void \
72 Serialize(mozilla::ipc::InputStreamParams& aParams, \
73 FileDescriptorArray& aFileDescriptors) override \
74 { \
75 if (_to) { \
76 _to->Serialize(aParams, aFileDescriptors); \
77 } \
78 } \
80 virtual bool \
81 Deserialize(const mozilla::ipc::InputStreamParams& aParams, \
82 const FileDescriptorArray& aFileDescriptors) override \
83 { \
84 return _to ? _to->Deserialize(aParams, aFileDescriptors) : false; \
87 #endif // mozilla_ipc_nsIIPCSerializableInputStream_h