michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIBinaryInputStream.idl" michael@0: michael@0: /** michael@0: * @see nsIObjectOutputStream michael@0: * @see nsIBinaryInputStream michael@0: */ michael@0: michael@0: [scriptable, uuid(6c248606-4eae-46fa-9df0-ba58502368eb)] michael@0: interface nsIObjectInputStream : nsIBinaryInputStream michael@0: { michael@0: /** michael@0: * Read an object from this stream to satisfy a strong or weak reference michael@0: * to one of its interfaces. If the interface was not along the primary michael@0: * inheritance chain ending in the "root" or XPCOM-identity nsISupports, michael@0: * readObject will QueryInterface from the deserialized object root to the michael@0: * correct interface, which was specified when the object was serialized. michael@0: * michael@0: * @see nsIObjectOutputStream michael@0: */ michael@0: nsISupports readObject(in boolean aIsStrongRef); michael@0: michael@0: [notxpcom] nsresult readID(out nsID aID); michael@0: michael@0: /** michael@0: * Optimized deserialization support -- see nsIStreamBufferAccess.idl. michael@0: */ michael@0: [notxpcom] charPtr getBuffer(in uint32_t aLength, in uint32_t aAlignMask); michael@0: [notxpcom] void putBuffer(in charPtr aBuffer, in uint32_t aLength); michael@0: }; michael@0: michael@0: %{C++ michael@0: michael@0: inline nsresult michael@0: NS_ReadOptionalObject(nsIObjectInputStream* aStream, bool aIsStrongRef, michael@0: nsISupports* *aResult) michael@0: { michael@0: bool nonnull; michael@0: nsresult rv = aStream->ReadBoolean(&nonnull); michael@0: if (NS_SUCCEEDED(rv)) { michael@0: if (nonnull) michael@0: rv = aStream->ReadObject(aIsStrongRef, aResult); michael@0: else michael@0: *aResult = nullptr; michael@0: } michael@0: return rv; michael@0: } michael@0: michael@0: %}