1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xbl/nsXBLProtoImplProperty.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsXBLProtoImplProperty_h__ 1.10 +#define nsXBLProtoImplProperty_h__ 1.11 + 1.12 +#include "mozilla/Attributes.h" 1.13 +#include "nsIAtom.h" 1.14 +#include "nsString.h" 1.15 +#include "nsString.h" 1.16 +#include "nsXBLSerialize.h" 1.17 +#include "nsXBLMaybeCompiled.h" 1.18 +#include "nsXBLProtoImplMember.h" 1.19 + 1.20 +class nsXBLProtoImplProperty: public nsXBLProtoImplMember 1.21 +{ 1.22 +public: 1.23 + nsXBLProtoImplProperty(const char16_t* aName, 1.24 + const char16_t* aGetter, 1.25 + const char16_t* aSetter, 1.26 + const char16_t* aReadOnly, 1.27 + uint32_t aLineNumber); 1.28 + 1.29 + nsXBLProtoImplProperty(const char16_t* aName, const bool aIsReadOnly); 1.30 + 1.31 + virtual ~nsXBLProtoImplProperty(); 1.32 + 1.33 + void AppendGetterText(const nsAString& aGetter); 1.34 + void AppendSetterText(const nsAString& aSetter); 1.35 + 1.36 + void SetGetterLineNumber(uint32_t aLineNumber); 1.37 + void SetSetterLineNumber(uint32_t aLineNumber); 1.38 + 1.39 + virtual nsresult InstallMember(JSContext* aCx, 1.40 + JS::Handle<JSObject*> aTargetClassObject) MOZ_OVERRIDE; 1.41 + virtual nsresult CompileMember(const nsCString& aClassStr, 1.42 + JS::Handle<JSObject*> aClassObject) MOZ_OVERRIDE; 1.43 + 1.44 + virtual void Trace(const TraceCallbacks& aCallback, void *aClosure) MOZ_OVERRIDE; 1.45 + 1.46 + nsresult Read(nsIObjectInputStream* aStream, 1.47 + XBLBindingSerializeDetails aType); 1.48 + virtual nsresult Write(nsIObjectOutputStream* aStream) MOZ_OVERRIDE; 1.49 + 1.50 +protected: 1.51 + typedef JS::Heap<nsXBLMaybeCompiled<nsXBLTextWithLineNumber> > PropertyOp; 1.52 + 1.53 + void EnsureUncompiledText(PropertyOp& aPropertyOp); 1.54 + 1.55 + // The raw text for the getter, or the JS object (after compilation). 1.56 + PropertyOp mGetter; 1.57 + 1.58 + // The raw text for the setter, or the JS object (after compilation). 1.59 + PropertyOp mSetter; 1.60 + 1.61 + unsigned mJSAttributes; // A flag for all our JS properties (getter/setter/readonly/shared/enum) 1.62 + 1.63 +#ifdef DEBUG 1.64 + bool mIsCompiled; 1.65 +#endif 1.66 +}; 1.67 + 1.68 +#endif // nsXBLProtoImplProperty_h__