|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef nsXBLProtoImplProperty_h__ |
|
7 #define nsXBLProtoImplProperty_h__ |
|
8 |
|
9 #include "mozilla/Attributes.h" |
|
10 #include "nsIAtom.h" |
|
11 #include "nsString.h" |
|
12 #include "nsString.h" |
|
13 #include "nsXBLSerialize.h" |
|
14 #include "nsXBLMaybeCompiled.h" |
|
15 #include "nsXBLProtoImplMember.h" |
|
16 |
|
17 class nsXBLProtoImplProperty: public nsXBLProtoImplMember |
|
18 { |
|
19 public: |
|
20 nsXBLProtoImplProperty(const char16_t* aName, |
|
21 const char16_t* aGetter, |
|
22 const char16_t* aSetter, |
|
23 const char16_t* aReadOnly, |
|
24 uint32_t aLineNumber); |
|
25 |
|
26 nsXBLProtoImplProperty(const char16_t* aName, const bool aIsReadOnly); |
|
27 |
|
28 virtual ~nsXBLProtoImplProperty(); |
|
29 |
|
30 void AppendGetterText(const nsAString& aGetter); |
|
31 void AppendSetterText(const nsAString& aSetter); |
|
32 |
|
33 void SetGetterLineNumber(uint32_t aLineNumber); |
|
34 void SetSetterLineNumber(uint32_t aLineNumber); |
|
35 |
|
36 virtual nsresult InstallMember(JSContext* aCx, |
|
37 JS::Handle<JSObject*> aTargetClassObject) MOZ_OVERRIDE; |
|
38 virtual nsresult CompileMember(const nsCString& aClassStr, |
|
39 JS::Handle<JSObject*> aClassObject) MOZ_OVERRIDE; |
|
40 |
|
41 virtual void Trace(const TraceCallbacks& aCallback, void *aClosure) MOZ_OVERRIDE; |
|
42 |
|
43 nsresult Read(nsIObjectInputStream* aStream, |
|
44 XBLBindingSerializeDetails aType); |
|
45 virtual nsresult Write(nsIObjectOutputStream* aStream) MOZ_OVERRIDE; |
|
46 |
|
47 protected: |
|
48 typedef JS::Heap<nsXBLMaybeCompiled<nsXBLTextWithLineNumber> > PropertyOp; |
|
49 |
|
50 void EnsureUncompiledText(PropertyOp& aPropertyOp); |
|
51 |
|
52 // The raw text for the getter, or the JS object (after compilation). |
|
53 PropertyOp mGetter; |
|
54 |
|
55 // The raw text for the setter, or the JS object (after compilation). |
|
56 PropertyOp mSetter; |
|
57 |
|
58 unsigned mJSAttributes; // A flag for all our JS properties (getter/setter/readonly/shared/enum) |
|
59 |
|
60 #ifdef DEBUG |
|
61 bool mIsCompiled; |
|
62 #endif |
|
63 }; |
|
64 |
|
65 #endif // nsXBLProtoImplProperty_h__ |