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 nsXBLProtoImplMember_h__
|
|
|
|
#define nsXBLProtoImplMember_h__
|
|
|
|
|
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "jsapi.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsIServiceManager.h"
|
2013-02-01 02:56:02 -08:00
|
|
|
#include "nsContentUtils.h" // For NS_CONTENT_DELETE_LIST_MEMBER.
|
2007-10-29 06:45:07 -07:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-07-01 16:45:59 -07:00
|
|
|
class nsIContent;
|
2013-03-17 00:55:15 -07:00
|
|
|
class nsIObjectOutputStream;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsIScriptContext;
|
|
|
|
|
|
|
|
struct nsXBLTextWithLineNumber
|
|
|
|
{
|
|
|
|
PRUnichar* mText;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mLineNumber;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsXBLTextWithLineNumber() :
|
2012-07-30 07:20:58 -07:00
|
|
|
mText(nullptr),
|
2007-03-22 10:30:00 -07:00
|
|
|
mLineNumber(0)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(nsXBLTextWithLineNumber);
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsXBLTextWithLineNumber() {
|
|
|
|
MOZ_COUNT_DTOR(nsXBLTextWithLineNumber);
|
|
|
|
if (mText) {
|
|
|
|
nsMemory::Free(mText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AppendText(const nsAString& aText) {
|
|
|
|
if (mText) {
|
|
|
|
PRUnichar* temp = mText;
|
|
|
|
mText = ToNewUnicode(nsDependentString(temp) + aText);
|
|
|
|
nsMemory::Free(temp);
|
|
|
|
} else {
|
|
|
|
mText = ToNewUnicode(aText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PRUnichar* GetText() {
|
|
|
|
return mText;
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void SetLineNumber(uint32_t aLineNumber) {
|
2007-03-22 10:30:00 -07:00
|
|
|
mLineNumber = aLineNumber;
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t GetLineNumber() {
|
2007-03-22 10:30:00 -07:00
|
|
|
return mLineNumber;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class nsXBLProtoImplMember
|
|
|
|
{
|
|
|
|
public:
|
2012-07-30 07:20:58 -07:00
|
|
|
nsXBLProtoImplMember(const PRUnichar* aName) :mNext(nullptr) { mName = ToNewUnicode(nsDependentString(aName)); }
|
2008-12-15 03:33:56 -08:00
|
|
|
virtual ~nsXBLProtoImplMember() {
|
|
|
|
nsMemory::Free(mName);
|
|
|
|
NS_CONTENT_DELETE_LIST_MEMBER(nsXBLProtoImplMember, this, mNext);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-04-23 07:21:53 -07:00
|
|
|
nsXBLProtoImplMember* GetNext() { return mNext; }
|
|
|
|
void SetNext(nsXBLProtoImplMember* aNext) { mNext = aNext; }
|
2013-02-08 06:24:21 -08:00
|
|
|
const PRUnichar* GetName() { return mName; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-02-08 06:24:21 -08:00
|
|
|
virtual nsresult InstallMember(JSContext* aCx,
|
|
|
|
JSObject* aTargetClassObject) = 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsresult CompileMember(nsIScriptContext* aContext,
|
|
|
|
const nsCString& aClassStr,
|
2011-11-26 02:06:40 -08:00
|
|
|
JSObject* aClassObject) = 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-10-29 06:45:07 -07:00
|
|
|
virtual void Trace(TraceCallback aCallback, void *aClosure) const = 0;
|
2007-05-24 07:10:02 -07:00
|
|
|
|
2011-11-03 13:39:08 -07:00
|
|
|
virtual nsresult Write(nsIScriptContext* aContext,
|
|
|
|
nsIObjectOutputStream* aStream)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
nsXBLProtoImplMember* mNext; // The members of an implementation are chained.
|
|
|
|
PRUnichar* mName; // The name of the field, method, or property.
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsXBLProtoImplMember_h__
|