2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsXBLProtoImplProperty_h__
|
|
|
|
#define nsXBLProtoImplProperty_h__
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsString.h"
|
2011-11-03 13:39:08 -07:00
|
|
|
#include "nsXBLSerialize.h"
|
2013-06-18 03:00:38 -07:00
|
|
|
#include "nsXBLMaybeCompiled.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsXBLProtoImplMember.h"
|
|
|
|
|
|
|
|
class nsXBLProtoImplProperty: public nsXBLProtoImplMember
|
|
|
|
{
|
|
|
|
public:
|
2014-01-04 07:02:17 -08:00
|
|
|
nsXBLProtoImplProperty(const char16_t* aName,
|
|
|
|
const char16_t* aGetter,
|
|
|
|
const char16_t* aSetter,
|
|
|
|
const char16_t* aReadOnly,
|
2012-12-17 12:22:38 -08:00
|
|
|
uint32_t aLineNumber);
|
2011-11-03 13:39:08 -07:00
|
|
|
|
2014-01-04 07:02:17 -08:00
|
|
|
nsXBLProtoImplProperty(const char16_t* aName, const bool aIsReadOnly);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual ~nsXBLProtoImplProperty();
|
|
|
|
|
|
|
|
void AppendGetterText(const nsAString& aGetter);
|
|
|
|
void AppendSetterText(const nsAString& aSetter);
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void SetGetterLineNumber(uint32_t aLineNumber);
|
|
|
|
void SetSetterLineNumber(uint32_t aLineNumber);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-02-08 06:24:21 -08:00
|
|
|
virtual nsresult InstallMember(JSContext* aCx,
|
2013-05-29 13:43:41 -07:00
|
|
|
JS::Handle<JSObject*> aTargetClassObject) MOZ_OVERRIDE;
|
2013-08-09 09:25:13 -07:00
|
|
|
virtual nsresult CompileMember(const nsCString& aClassStr,
|
2013-05-29 13:43:41 -07:00
|
|
|
JS::Handle<JSObject*> aClassObject) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual void Trace(const TraceCallbacks& aCallback, void *aClosure) MOZ_OVERRIDE;
|
2007-05-24 07:10:02 -07:00
|
|
|
|
2013-08-09 09:25:13 -07:00
|
|
|
nsresult Read(nsIObjectInputStream* aStream,
|
2011-11-03 13:39:08 -07:00
|
|
|
XBLBindingSerializeDetails aType);
|
2013-08-09 09:25:13 -07:00
|
|
|
virtual nsresult Write(nsIObjectOutputStream* aStream) MOZ_OVERRIDE;
|
2011-11-03 13:39:08 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2013-06-18 03:00:38 -07:00
|
|
|
typedef JS::Heap<nsXBLMaybeCompiled<nsXBLTextWithLineNumber> > PropertyOp;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-06-18 03:00:38 -07:00
|
|
|
void EnsureUncompiledText(PropertyOp& aPropertyOp);
|
|
|
|
|
|
|
|
// The raw text for the getter, or the JS object (after compilation).
|
|
|
|
PropertyOp mGetter;
|
|
|
|
|
|
|
|
// The raw text for the setter, or the JS object (after compilation).
|
|
|
|
PropertyOp mSetter;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-06-18 03:00:38 -07:00
|
|
|
unsigned mJSAttributes; // A flag for all our JS properties (getter/setter/readonly/shared/enum)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsCompiled;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsXBLProtoImplProperty_h__
|