michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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 nsXBLProtoImplField_h__ michael@0: #define nsXBLProtoImplField_h__ michael@0: michael@0: #include "nsIAtom.h" michael@0: #include "nsString.h" michael@0: #include "jsapi.h" michael@0: #include "nsString.h" michael@0: #include "nsXBLProtoImplMember.h" michael@0: michael@0: class nsIObjectInputStream; michael@0: class nsIObjectOutputStream; michael@0: class nsIScriptContext; michael@0: class nsIURI; michael@0: michael@0: class nsXBLProtoImplField michael@0: { michael@0: public: michael@0: nsXBLProtoImplField(const char16_t* aName, const char16_t* aReadOnly); michael@0: nsXBLProtoImplField(const bool aIsReadOnly); michael@0: ~nsXBLProtoImplField(); michael@0: michael@0: void AppendFieldText(const nsAString& aText); michael@0: void SetLineNumber(uint32_t aLineNumber) { michael@0: mLineNumber = aLineNumber; michael@0: } michael@0: michael@0: nsXBLProtoImplField* GetNext() const { return mNext; } michael@0: void SetNext(nsXBLProtoImplField* aNext) { mNext = aNext; } michael@0: michael@0: nsresult InstallField(JS::Handle aBoundNode, michael@0: nsIURI* aBindingDocURI, michael@0: bool* aDidInstall) const; michael@0: michael@0: nsresult InstallAccessors(JSContext* aCx, michael@0: JS::Handle aTargetClassObject); michael@0: michael@0: nsresult Read(nsIObjectInputStream* aStream); michael@0: nsresult Write(nsIObjectOutputStream* aStream); michael@0: michael@0: const char16_t* GetName() const { return mName; } michael@0: michael@0: unsigned AccessorAttributes() const { michael@0: return JSPROP_SHARED | JSPROP_GETTER | JSPROP_SETTER | michael@0: (mJSAttributes & (JSPROP_ENUMERATE | JSPROP_PERMANENT)); michael@0: } michael@0: michael@0: bool IsEmpty() const { return mFieldTextLength == 0; } michael@0: michael@0: protected: michael@0: nsXBLProtoImplField* mNext; michael@0: char16_t* mName; michael@0: char16_t* mFieldText; michael@0: uint32_t mFieldTextLength; michael@0: uint32_t mLineNumber; michael@0: unsigned mJSAttributes; michael@0: }; michael@0: michael@0: #endif // nsXBLProtoImplField_h__