michael@0: /* -*- Mode: C++; tab-width: 2; 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: #ifndef nsXBLSerialize_h__ michael@0: #define nsXBLSerialize_h__ michael@0: michael@0: #include "nsIObjectInputStream.h" michael@0: #include "nsIObjectOutputStream.h" michael@0: #include "nsNameSpaceManager.h" michael@0: #include "js/TypeDecls.h" michael@0: michael@0: typedef uint8_t XBLBindingSerializeDetails; michael@0: michael@0: // A version number to ensure we don't load cached data in a different michael@0: // file format. michael@0: #define XBLBinding_Serialize_Version 0x00000003 michael@0: michael@0: // Set for the first binding in a document michael@0: #define XBLBinding_Serialize_IsFirstBinding 1 michael@0: michael@0: // Set to indicate that nsXBLPrototypeBinding::mInheritStyle should be true michael@0: #define XBLBinding_Serialize_InheritStyle 2 michael@0: michael@0: // Set to indicate that nsXBLPrototypeBinding::mChromeOnlyContent should be true michael@0: #define XBLBinding_Serialize_ChromeOnlyContent 4 michael@0: michael@0: // Appears at the end of the serialized data to indicate that no more bindings michael@0: // are present for this document. michael@0: #define XBLBinding_Serialize_NoMoreBindings 0x80 michael@0: michael@0: // Implementation member types. The serialized value for each member contains one michael@0: // of these values, combined with the read-only flag XBLBinding_Serialize_ReadOnly. michael@0: // Use XBLBinding_Serialize_Mask to filter out the read-only flag and check for michael@0: // just the member type. michael@0: #define XBLBinding_Serialize_NoMoreItems 0 // appears at the end of the members list michael@0: #define XBLBinding_Serialize_Field 1 michael@0: #define XBLBinding_Serialize_GetterProperty 2 michael@0: #define XBLBinding_Serialize_SetterProperty 3 michael@0: #define XBLBinding_Serialize_GetterSetterProperty 4 michael@0: #define XBLBinding_Serialize_Method 5 michael@0: #define XBLBinding_Serialize_Constructor 6 michael@0: #define XBLBinding_Serialize_Destructor 7 michael@0: #define XBLBinding_Serialize_Handler 8 michael@0: #define XBLBinding_Serialize_Image 9 michael@0: #define XBLBinding_Serialize_Stylesheet 10 michael@0: #define XBLBinding_Serialize_Attribute 0xA michael@0: #define XBLBinding_Serialize_Mask 0x0F michael@0: #define XBLBinding_Serialize_ReadOnly 0x80 michael@0: michael@0: // Appears at the end of the list of insertion points to indicate that there michael@0: // are no more. michael@0: #define XBLBinding_Serialize_NoMoreInsertionPoints 0xFFFFFFFF michael@0: michael@0: // When serializing content nodes, a single-byte namespace id is written out michael@0: // first. The special values below can appear in place of a namespace id. michael@0: michael@0: // Indicates that this is not one of the built-in namespaces defined in michael@0: // nsNameSpaceManager.h. The string form will be serialized immediately michael@0: // following. michael@0: #define XBLBinding_Serialize_CustomNamespace 0xFE michael@0: michael@0: // Flags to indicate a non-element node. Otherwise, it is an element. michael@0: #define XBLBinding_Serialize_TextNode 0xFB michael@0: #define XBLBinding_Serialize_CDATANode 0xFC michael@0: #define XBLBinding_Serialize_CommentNode 0xFD michael@0: michael@0: // Indicates that there is no content to serialize/deserialize michael@0: #define XBLBinding_Serialize_NoContent 0xFF michael@0: michael@0: // Appears at the end of the forwarded attributes list to indicate that there michael@0: // are no more attributes. michael@0: #define XBLBinding_Serialize_NoMoreAttributes 0xFF michael@0: michael@0: static_assert(XBLBinding_Serialize_CustomNamespace >= kNameSpaceID_LastBuiltin, michael@0: "The custom namespace should not be in use as a real namespace"); michael@0: michael@0: nsresult michael@0: XBL_SerializeFunction(nsIObjectOutputStream* aStream, michael@0: JS::Handle aFunctionObject); michael@0: michael@0: nsresult michael@0: XBL_DeserializeFunction(nsIObjectInputStream* aStream, michael@0: JS::MutableHandle aFunctionObject); michael@0: michael@0: #endif // nsXBLSerialize_h__