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 nsXBLProtoImplProperty_h__ michael@0: #define nsXBLProtoImplProperty_h__ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsIAtom.h" michael@0: #include "nsString.h" michael@0: #include "nsString.h" michael@0: #include "nsXBLSerialize.h" michael@0: #include "nsXBLMaybeCompiled.h" michael@0: #include "nsXBLProtoImplMember.h" michael@0: michael@0: class nsXBLProtoImplProperty: public nsXBLProtoImplMember michael@0: { michael@0: public: michael@0: nsXBLProtoImplProperty(const char16_t* aName, michael@0: const char16_t* aGetter, michael@0: const char16_t* aSetter, michael@0: const char16_t* aReadOnly, michael@0: uint32_t aLineNumber); michael@0: michael@0: nsXBLProtoImplProperty(const char16_t* aName, const bool aIsReadOnly); michael@0: michael@0: virtual ~nsXBLProtoImplProperty(); michael@0: michael@0: void AppendGetterText(const nsAString& aGetter); michael@0: void AppendSetterText(const nsAString& aSetter); michael@0: michael@0: void SetGetterLineNumber(uint32_t aLineNumber); michael@0: void SetSetterLineNumber(uint32_t aLineNumber); michael@0: michael@0: virtual nsresult InstallMember(JSContext* aCx, michael@0: JS::Handle aTargetClassObject) MOZ_OVERRIDE; michael@0: virtual nsresult CompileMember(const nsCString& aClassStr, michael@0: JS::Handle aClassObject) MOZ_OVERRIDE; michael@0: michael@0: virtual void Trace(const TraceCallbacks& aCallback, void *aClosure) MOZ_OVERRIDE; michael@0: michael@0: nsresult Read(nsIObjectInputStream* aStream, michael@0: XBLBindingSerializeDetails aType); michael@0: virtual nsresult Write(nsIObjectOutputStream* aStream) MOZ_OVERRIDE; michael@0: michael@0: protected: michael@0: typedef JS::Heap > PropertyOp; michael@0: michael@0: void EnsureUncompiledText(PropertyOp& aPropertyOp); michael@0: michael@0: // The raw text for the getter, or the JS object (after compilation). michael@0: PropertyOp mGetter; michael@0: michael@0: // The raw text for the setter, or the JS object (after compilation). michael@0: PropertyOp mSetter; michael@0: michael@0: unsigned mJSAttributes; // A flag for all our JS properties (getter/setter/readonly/shared/enum) michael@0: michael@0: #ifdef DEBUG michael@0: bool mIsCompiled; michael@0: #endif michael@0: }; michael@0: michael@0: #endif // nsXBLProtoImplProperty_h__