1999-01-12 08:45:23 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1999-01-12 08:45:23 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1999-01-12 08:45:23 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
1999-11-06 03:40:37 +00:00
|
|
|
* Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1999-01-12 08:45:23 +00:00
|
|
|
*/
|
|
|
|
#ifndef nsDOMAttribute_h___
|
|
|
|
#define nsDOMAttribute_h___
|
|
|
|
|
|
|
|
#include "nsIDOMAttr.h"
|
|
|
|
#include "nsIDOMText.h"
|
|
|
|
#include "nsIDOMNodeList.h"
|
|
|
|
#include "nsIScriptObjectOwner.h"
|
1999-01-19 16:58:45 +00:00
|
|
|
#include "nsGenericDOMNodeList.h"
|
1999-01-12 08:45:23 +00:00
|
|
|
#include "nsString.h"
|
2000-06-23 00:21:32 +00:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsINodeInfo.h"
|
1999-01-12 08:45:23 +00:00
|
|
|
|
|
|
|
class nsIContent;
|
|
|
|
class nsDOMAttribute;
|
|
|
|
|
|
|
|
#define NS_IDOMATTRIBUTEPRIVATE_IID \
|
|
|
|
{0xa6cf90dd, 0x15b3, 0x11d2, \
|
|
|
|
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
|
|
|
|
|
|
|
class nsIDOMAttributePrivate : public nsISupports {
|
|
|
|
public:
|
1999-09-08 23:18:27 +00:00
|
|
|
NS_IMETHOD DropReference() = 0;
|
|
|
|
NS_IMETHOD SetContent(nsIContent* aContent) = 0;
|
|
|
|
NS_IMETHOD GetContent(nsIContent** aContent) = 0;
|
1999-01-12 08:45:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// bogus child list for an attribute
|
1999-01-19 16:58:45 +00:00
|
|
|
class nsAttributeChildList : public nsGenericDOMNodeList
|
1999-01-12 08:45:23 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsAttributeChildList(nsDOMAttribute* aAttribute);
|
1999-02-12 17:45:58 +00:00
|
|
|
virtual ~nsAttributeChildList();
|
1999-01-12 08:45:23 +00:00
|
|
|
|
|
|
|
// interface nsIDOMNodeList
|
|
|
|
NS_IMETHOD GetLength(PRUint32* aLength);
|
|
|
|
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
|
|
|
|
|
|
|
|
void DropReference();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsDOMAttribute* mAttribute;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Attribute helper class used to wrap up an attribute with a dom
|
|
|
|
// object that implements nsIDOMAttr and nsIDOMNode and
|
|
|
|
// nsIScriptObjectOwner
|
|
|
|
class nsDOMAttribute : public nsIDOMAttr,
|
|
|
|
public nsIScriptObjectOwner,
|
|
|
|
public nsIDOMAttributePrivate
|
|
|
|
{
|
|
|
|
public:
|
2000-06-23 00:21:32 +00:00
|
|
|
nsDOMAttribute(nsIContent* aContent, nsINodeInfo *aNodeInfo,
|
2000-08-23 17:27:06 +00:00
|
|
|
const nsAReadableString& aValue);
|
1999-02-12 17:45:58 +00:00
|
|
|
virtual ~nsDOMAttribute();
|
1999-01-12 08:45:23 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
|
|
|
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
|
|
|
|
|
|
|
// nsIDOMAttr interface
|
2000-04-03 13:40:04 +00:00
|
|
|
NS_DECL_IDOMATTR
|
|
|
|
|
1999-01-12 08:45:23 +00:00
|
|
|
// nsIDOMNode interface
|
2000-04-01 13:31:23 +00:00
|
|
|
NS_DECL_IDOMNODE
|
1999-01-12 08:45:23 +00:00
|
|
|
|
|
|
|
// nsIDOMAttributePrivate interface
|
1999-09-08 23:18:27 +00:00
|
|
|
NS_IMETHOD DropReference();
|
|
|
|
NS_IMETHOD SetContent(nsIContent* aContent);
|
|
|
|
NS_IMETHOD GetContent(nsIContent** aContent);
|
1999-01-12 08:45:23 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsIContent* mContent;
|
2000-06-23 00:21:32 +00:00
|
|
|
nsCOMPtr<nsINodeInfo> mNodeInfo;
|
1999-01-12 08:45:23 +00:00
|
|
|
nsString mValue;
|
|
|
|
// XXX For now, there's only a single child - a text
|
|
|
|
// element representing the value
|
|
|
|
nsIDOMText* mChild;
|
|
|
|
nsAttributeChildList* mChildList;
|
|
|
|
void* mScriptObject;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* nsDOMAttribute_h___ */
|