summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 218f6e8)
raw | patch | inline | side by side (parent: 218f6e8)
author | ishmal <ishmal@users.sourceforge.net> | |
Tue, 5 Sep 2006 16:00:09 +0000 (16:00 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Tue, 5 Sep 2006 16:00:09 +0000 (16:00 +0000) |
32 files changed:
diff --git a/src/dom/Makefile.mingw b/src/dom/Makefile.mingw
index 2c2dd1c987eb84375ccf29baa5ca2851ca0645f5..33b6aed9eb794c8ee5c51a754d8c103ecf34e93a 100644 (file)
--- a/src/dom/Makefile.mingw
+++ b/src/dom/Makefile.mingw
charclass.o \
cssparser.o \
domimpl.o \
+domptr.o \
domstring.o \
jsengine.o \
-jsbind.o \
+jsdombind.o \
lsimpl.o \
smilimpl.o \
uri.o \
diff --git a/src/dom/dom.h b/src/dom/dom.h
index de353207422b6691decf08c797feaf338a8626ec..138e735e36d5886c47b03891931e6cc195a7b7fe 100644 (file)
--- a/src/dom/dom.h
+++ b/src/dom/dom.h
*/
typedef void DOMUserData;
+/*#########################################################################
+## NodePtr
+#########################################################################*/
+
+/**
+ * A simple Smart Pointer class that handles Nodes and all of its
+ * descendants
+ */
+template<class T> class Ptr
+{
+public:
+
+ /**
+ * Simple constructor
+ */
+ Ptr()
+ { _ref = 0; }
+
+ /**
+ * Constructor upon a reference
+ */
+ template<class Y> Ptr(const Ptr<Y> &other)
+ {
+ _ref = other._ref;
+ incrementRefCount(_ref);
+ }
+
+ /**
+ * Constructor upon a reference
+ */
+ Ptr(T * refArg, bool addRef = true)
+ {
+ _ref = refArg;
+ if(addRef)
+ incrementRefCount(_ref);
+ }
+
+
+ /**
+ * Copy constructor
+ */
+ Ptr(const Ptr &other)
+ {
+ _ref = other._ref;
+ incrementRefCount(_ref);
+ }
+
+ /**
+ * Destructor
+ */
+ ~Ptr()
+ {
+ decrementRefCount(_ref);
+ }
+
+
+ /**
+ * Assignment operator
+ */
+ template<class Y> Ptr &operator=(const Ptr<Y> &other)
+ {
+ decrementRefCount(_ref);
+ _ref = other._ref;
+ incrementRefCount(_ref);
+ return *this;
+ }
+
+ /**
+ * Assignment operator
+ */
+ Ptr &operator=(const Ptr &other)
+ {
+ decrementRefCount(_ref);
+ _ref = other._ref;
+ incrementRefCount(_ref);
+ return *this;
+ }
+
+ /**
+ * Assignment operator
+ */
+ template<class Y> Ptr &operator=(Y * ref)
+ {
+ decrementRefCount(_ref);
+ _ref = ref;
+ incrementRefCount(_ref);
+ return *this;
+ }
+
+ /**
+ * Assignment operator
+ */
+ template<class Y> Ptr &operator=(const Y * ref)
+ {
+ decrementRefCount(_ref);
+ _ref = (Y *) ref;
+ incrementRefCount(_ref);
+ return *this;
+ }
+
+ /**
+ * Return the reference
+ */
+ T * get() const
+ {
+ return _ref;
+ }
+
+ /**
+ * Dereference operator
+ */
+ T &operator*() const
+ {
+ return *_ref;
+ }
+
+ /**
+ * Point-to operator
+ */
+ T *operator->() const
+ {
+ return _ref;
+ }
+
+ /**
+ * NOT bool operator. How to check if we are null without a comparison
+ */
+ bool operator! () const
+ {
+ return (_ref == 0);
+ }
+
+ /**
+ * Swap what I reference with the other guy
+ */
+ void swap(Ptr &other)
+ {
+ T *tmp = _ref;
+ _ref = other._ref;
+ other._ref = tmp;
+ }
+
+ //The referenced item
+ T *_ref;
+};
+
+
+/**
+ * Global definitions. Many of these are used to mimic behaviour of
+ * a real pointer
+ */
+
+/**
+ * Equality
+ */
+template<class T, class U> inline bool
+ operator==(const Ptr<T> &a, const Ptr<U> &b)
+{
+ return a.get() == b.get();
+}
+
+/**
+ * Inequality
+ */
+template<class T, class U> inline bool
+ operator!=(const Ptr<T> &a, const Ptr<U> &b)
+{
+ return a.get() != b.get();
+}
+
+/**
+ * Equality
+ */
+template<class T> inline bool
+ operator==(const Ptr<T> &a, T * b)
+{
+ return a.get() == b;
+}
+
+/**
+ * Inequality
+ */
+template<class T> inline bool
+ operator!=(const Ptr<T> &a, T * b)
+{
+ return a.get() != b;
+}
+
+/**
+ * Equality
+ */
+template<class T> inline bool
+ operator==(T * a, const Ptr<T> &b)
+{
+ return a == b.get();
+}
+
+/**
+ * Inequality
+ */
+template<class T> inline bool
+ operator!=(T * a, const Ptr<T> &b)
+{
+ return a != b.get();
+}
+
+
+/**
+ * Less than
+ */
+template<class T> inline bool
+ operator<(const Ptr<T> &a, const Ptr<T> &b)
+{
+ return std::less<T *>()(a.get(), b.get());
+}
+
+/**
+ * Swap
+ */
+template<class T> void
+ swap(Ptr<T> &a, Ptr<T> &b)
+{
+ a.swap(b);
+}
+
+
+/**
+ * Get the pointer globally, for <algo>
+ */
+template<class T> T *
+ get_pointer(const Ptr<T> &p)
+{
+ return p.get();
+}
+
+/**
+ * Static cast
+ */
+template<class T, class U> Ptr<T>
+ static_pointer_cast(const Ptr<U> &p)
+{
+ return static_cast<T *>(p.get());
+}
+
+/**
+ * Const cast
+ */
+template<class T, class U> Ptr<T>
+ const_pointer_cast(const Ptr<U> &p)
+{
+ return const_cast<T *>(p.get());
+}
+
+/**
+ * Dynamic cast
+ */
+template<class T, class U> Ptr<T>
+ dynamic_pointer_cast(const Ptr<U> &p)
+{
+ return dynamic_cast<T *>(p.get());
+}
+
+
/**
*
*/
typedef void DOMObject;
+class NodeList;
+class NamedNodeMap;
class DOMException;
class DOMStringList;
class NameList;
class DOMImplementationList;
class DOMImplementationSource;
class DOMImplementation;
-class Node;
-class NodeList;
-class NamedNodeMap;
-class CharacterData;
-class Attr;
-class Element;
-class Text;
-class Comment;
class TypeInfo;
class UserDataHandler;
class DOMError;
class DOMErrorHandler;
class DOMLocator;
class DOMConfiguration;
-class CDATASection;
+
+class Node;
+typedef Ptr<Node> NodePtr;
+class CharacterData;
+typedef Ptr<CharacterData> CharacterDataPtr;
+class Attr;
+typedef Ptr<Attr> AttrPtr;
+class Element;
+typedef Ptr<Element> ElementPtr;
+class Text;
+typedef Ptr<Text> TextPtr;
+class Comment;
+typedef Ptr<Comment> CommentPtr;
class DocumentType;
+typedef Ptr<DocumentType> DocumentTypePtr;
+class CDATASection;
+typedef Ptr<CDATASection> CDATASectionPtr;
class Notation;
+typedef Ptr<Notation> NotationPtr;
class Entity;
+typedef Ptr<Entity> EntityPtr;
class EntityReference;
+typedef Ptr<EntityReference> EntityReferencePtr;
class ProcessingInstruction;
+typedef Ptr<ProcessingInstruction> ProcessingInstructionPtr;
class DocumentFragment;
+typedef Ptr<DocumentFragment> DocumentFragmentPtr;
class Document;
+typedef Ptr<Document> DocumentPtr;
+
+
/**
/**
*
*/
- virtual DocumentType *createDocumentType(const DOMString& qualifiedName,
- const DOMString& publicId,
- const DOMString& systemId)
- throw(DOMException) = 0;
+ virtual DocumentTypePtr createDocumentType(
+ const DOMString& qualifiedName,
+ const DOMString& publicId,
+ const DOMString& systemId)
+ throw(DOMException) = 0;
/**
*
*/
- virtual Document *createDocument(const DOMString& namespaceURI,
+ virtual DocumentPtr createDocument(const DOMString& namespaceURI,
const DOMString& qualifiedName,
- DocumentType *doctype)
+ DocumentTypePtr doctype)
throw(DOMException) = 0;
/**
*
+
/*#########################################################################
## Node
#########################################################################*/
/**
- *
+ * The basic Node class, which is the root of most other
+ * classes in DOM.
*/
class Node
{
/**
*
*/
- virtual Node *getParentNode() = 0;
+ virtual NodePtr getParentNode() = 0;
/**
*
/**
*
*/
- virtual Node *getFirstChild() = 0;
+ virtual NodePtr getFirstChild() = 0;
/**
*
*/
- virtual Node *getLastChild() = 0;
+ virtual NodePtr getLastChild() = 0;
/**
*
*/
- virtual Node *getPreviousSibling() = 0;
+ virtual NodePtr getPreviousSibling() = 0;
/**
*
*/
- virtual Node *getNextSibling() = 0;
+ virtual NodePtr getNextSibling() = 0;
/**
*
/**
*
*/
- virtual Document *getOwnerDocument() = 0;
+ virtual DocumentPtr getOwnerDocument() = 0;
/**
*
*/
- virtual Node *insertBefore(const Node *newChild,
- const Node *refChild)
+ virtual NodePtr insertBefore(const NodePtr newChild,
+ const NodePtr refChild)
throw(DOMException) = 0;
/**
*
*/
- virtual Node *replaceChild(const Node *newChild,
- const Node *oldChild)
+ virtual NodePtr replaceChild(const NodePtr newChild,
+ const NodePtr oldChild)
throw(DOMException) = 0;
/**
*
*/
- virtual Node *removeChild(const Node *oldChild)
+ virtual NodePtr removeChild(const NodePtr oldChild)
throw(DOMException) = 0;
/**
*
*/
- virtual Node *appendChild(const Node *newChild)
+ virtual NodePtr appendChild(const NodePtr newChild)
throw(DOMException) = 0;
/**
/**
*
*/
- virtual Node *cloneNode(bool deep) = 0;
+ virtual NodePtr cloneNode(bool deep) = 0;
/**
*
/**
*
*/
- virtual unsigned short compareDocumentPosition(const Node *other) = 0;
+ virtual unsigned short compareDocumentPosition(
+ const NodePtr other) = 0;
/**
*
/**
*
*/
- virtual bool isEqualNode(const Node *node) =0;
+ virtual bool isEqualNode(const NodePtr node) =0;
//# Non-API methods
//##################
+ /**
+ *
+ */
+ Node() : _refCnt(0)
+ {}
/**
*
*/
virtual ~Node() {}
+protected:
-
+ friend void incrementRefCount(Node *p);
+ friend void decrementRefCount(Node *p);
+
+ /**
+ * For the Ptr smart pointer
+ */
+ int _refCnt;
};
+
/*#########################################################################
## NodeList
#########################################################################*/
/**
*
*/
- virtual Node *item(unsigned long index)
+ virtual NodePtr item(unsigned long index)
{
if (index>=nodes.size())
return NULL;
/*
*
*/
- virtual void add(const Node *node)
+ virtual void add(const NodePtr node)
{
- nodes.push_back((Node *)node);
+ nodes.push_back(node);
}
protected:
- std::vector<Node *> nodes;
+ std::vector<NodePtr> nodes;
};
public:
NamedNodeMapEntry(const DOMString &theNamespaceURI,
const DOMString &theName,
- const Node *theNode)
+ const NodePtr theNode)
{
namespaceURI = theNamespaceURI;
name = theName;
- node = (Node *)theNode;
+ node = theNode;
}
NamedNodeMapEntry(const NamedNodeMapEntry &other)
{
}
DOMString namespaceURI;
DOMString name;
- Node *node;
+ NodePtr node;
};
/**
/**
*
*/
- virtual Node *getNamedItem(const DOMString& name)
+ virtual NodePtr getNamedItem(const DOMString& name)
{
std::vector<NamedNodeMapEntry>::iterator iter;
for (iter = entries.begin() ; iter!=entries.end() ; iter++)
{
if (iter->name == name)
{
- Node *node = iter->node;
+ NodePtr node = iter->node;
return node;
}
}
/**
*
*/
- virtual Node *setNamedItem(Node *arg) throw(DOMException)
+ virtual NodePtr setNamedItem(NodePtr arg) throw(DOMException)
{
if (!arg)
return NULL;
{
if (iter->name == name)
{
- Node *node = iter->node;
+ NodePtr node = iter->node;
iter->node = arg;
return node;
}
/**
*
*/
- virtual Node *removeNamedItem(const DOMString& name) throw(DOMException)
+ virtual NodePtr removeNamedItem(const DOMString& name) throw(DOMException)
{
std::vector<NamedNodeMapEntry>::iterator iter;
for (iter = entries.begin() ; iter!=entries.end() ; iter++)
{
if (iter->name == name)
{
- Node *node = iter->node;
+ NodePtr node = iter->node;
entries.erase(iter);
return node;
}
/**
*
*/
- virtual Node *item(unsigned long index)
+ virtual NodePtr item(unsigned long index)
{
if (index>=entries.size())
return NULL;
/**
*
*/
- virtual Node *getNamedItemNS(const DOMString& namespaceURI,
+ virtual NodePtr getNamedItemNS(const DOMString& namespaceURI,
const DOMString& localName)
{
std::vector<NamedNodeMapEntry>::iterator iter;
{
if (iter->namespaceURI == namespaceURI && iter->name == localName)
{
- Node *node = iter->node;
+ NodePtr node = iter->node;
return node;
}
}
/**
*
*/
- virtual Node *setNamedItemNS(Node *arg) throw(DOMException)
+ virtual NodePtr setNamedItemNS(NodePtr arg) throw(DOMException)
{
if (!arg)
return NULL;
{
if (iter->namespaceURI == namespaceURI && iter->name == name)
{
- Node *node = iter->node;
+ NodePtr node = iter->node;
iter->node = arg;
return node;
}
/**
*
*/
- virtual Node *removeNamedItemNS(const DOMString& namespaceURI,
+ virtual NodePtr removeNamedItemNS(const DOMString& namespaceURI,
const DOMString& localName)
throw(DOMException)
{
{
if (iter->namespaceURI == namespaceURI && iter->name == localName)
{
- Node *node = iter->node;
+ NodePtr node = iter->node;
entries.erase(iter);
return node;
}
};
+typedef Ptr<CharacterData> CharacterDataPtr;
+
/**
*
*/
- virtual Element *getOwnerElement() = 0;
+ virtual ElementPtr getOwnerElement() = 0;
/**
*
*/
- virtual TypeInfo *getSchemaTypeInfo() = 0;
+ virtual TypeInfo &getSchemaTypeInfo() = 0;
/**
/**
*
*/
- virtual Attr *getAttributeNode(const DOMString& name) = 0;
+ virtual AttrPtr getAttributeNode(const DOMString& name) = 0;
/**
*
*/
- virtual Attr *setAttributeNode(Attr *newAttr)
+ virtual AttrPtr setAttributeNode(AttrPtr newAttr)
throw(DOMException) = 0;
/**
*
*/
- virtual Attr *removeAttributeNode(Attr *oldAttr)
+ virtual AttrPtr removeAttributeNode(AttrPtr oldAttr)
throw(DOMException) = 0;
/**
/**
*
*/
- virtual Attr *getAttributeNodeNS(const DOMString& namespaceURI,
+ virtual AttrPtr getAttributeNodeNS(const DOMString& namespaceURI,
const DOMString& localName) = 0;
/**
*
*/
- virtual Attr *setAttributeNodeNS(Attr *newAttr)
+ virtual AttrPtr setAttributeNodeNS(AttrPtr newAttr)
throw(DOMException) = 0;
/**
/**
*
*/
- virtual TypeInfo *getSchemaTypeInto() = 0;
+ virtual TypeInfo &getSchemaTypeInfo() = 0;
/**
/**
*
*/
- virtual void setIdAttributeNode(const Attr *idAttr,
+ virtual void setIdAttributeNode(const AttrPtr idAttr,
bool isId) throw (DOMException) = 0;
//##################
/**
*
*/
- virtual Text *splitText(unsigned long offset)
+ virtual TextPtr splitText(unsigned long offset)
throw(DOMException) = 0;
/**
/**
*
*/
- virtual Text *replaceWholeText(const DOMString &content)
+ virtual TextPtr replaceWholeText(const DOMString &content)
throw(DOMException) = 0;
//##################
/**
*
*/
- virtual DOMString getTypeName() =0;
+ virtual DOMString getTypeName()
+ { return typeName; }
/**
*
*/
- virtual DOMString getTypeNamespace() =0;
+ virtual DOMString getTypeNamespace()
+ { return typeNameSpace; }
typedef enum
{
*/
virtual bool isDerivedFrom(const DOMString &typeNamespaceArg,
const DOMString &typeNameArg,
- DerivationMethod derivationMethod) =0;
+ DerivationMethod derivationMethod)
+ { return false; }
//##################
//# Non-API methods
//##################
+ /**
+ *
+ */
+ TypeInfo()
+ {}
+
+ /**
+ *
+ */
+ TypeInfo(const TypeInfo &other)
+ { assign(other); }
+
+ /**
+ *
+ */
+ TypeInfo &operator=(const TypeInfo &other)
+ { assign(other); return *this; }
+
/**
*
*/
virtual ~TypeInfo() {}
+
+private:
+
+ void assign(const TypeInfo &other)
+ {
+ typeName = other.typeName;
+ typeNameSpace = other.typeNameSpace;
+ }
+ DOMString typeName;
+ DOMString typeNameSpace;
};
virtual void handle(unsigned short operation,
const DOMString &key,
const DOMUserData *data,
- const Node *src,
- const Node *dst) =0;
+ const NodePtr src,
+ const NodePtr dst) =0;
//##################
//# Non-API methods
/**
*
*/
- virtual Node *getRelatedNode() =0;
+ virtual NodePtr getRelatedNode() =0;
/**
*
*/
virtual void setParameter(const DOMString &name,
- const DOMUserData *value) throw (DOMException) =0;
+ const DOMUserData *value)
+ throw (DOMException) =0;
/**
*
/**
*
*/
- virtual DocumentType *getDoctype() = 0;
+ virtual DocumentTypePtr getDoctype() = 0;
/**
*
/**
*
*/
- virtual Element *getDocumentElement() = 0;
+ virtual ElementPtr getDocumentElement() = 0;
/**
*
*/
- virtual Element *createElement(const DOMString& tagName)
+ virtual ElementPtr createElement(const DOMString& tagName)
throw(DOMException) = 0;
/**
*
*/
- virtual DocumentFragment *createDocumentFragment() = 0;
+ virtual DocumentFragmentPtr createDocumentFragment() = 0;
/**
*
*/
- virtual Text *createTextNode(const DOMString& data) = 0;
+ virtual TextPtr createTextNode(const DOMString& data) = 0;
/**
*
*/
- virtual Comment *createComment(const DOMString& data) = 0;
+ virtual CommentPtr createComment(const DOMString& data) = 0;
/**
*
*/
- virtual CDATASection *createCDATASection(const DOMString& data)
+ virtual CDATASectionPtr createCDATASection(const DOMString& data)
throw(DOMException) = 0;
/**
*
*/
- virtual ProcessingInstruction *createProcessingInstruction(const DOMString& target,
- const DOMString& data)
- throw(DOMException) = 0;
+ virtual ProcessingInstructionPtr
+ createProcessingInstruction(const DOMString& target,
+ const DOMString& data)
+ throw(DOMException) = 0;
/**
*
*/
- virtual Attr *createAttribute(const DOMString& name)
+ virtual AttrPtr createAttribute(const DOMString& name)
throw(DOMException) = 0;
/**
*
*/
- virtual EntityReference *createEntityReference(const DOMString& name)
+ virtual EntityReferencePtr createEntityReference(const DOMString& name)
throw(DOMException) = 0;
/**
/**
*
*/
- virtual Node *importNode(const Node *importedNode,
+ virtual NodePtr importNode(const NodePtr importedNode,
bool deep)
throw(DOMException) = 0;
/**
*
*/
- virtual Element *createElementNS(const DOMString& namespaceURI,
+ virtual ElementPtr createElementNS(const DOMString& namespaceURI,
const DOMString& qualifiedName)
throw(DOMException) = 0;
/**
*
*/
- virtual Attr *createAttributeNS(const DOMString& namespaceURI,
+ virtual AttrPtr createAttributeNS(const DOMString& namespaceURI,
const DOMString& qualifiedName)
throw(DOMException) = 0;
/**
*
*/
- virtual Element *getElementById(const DOMString& elementId) = 0;
+ virtual ElementPtr getElementById(const DOMString& elementId) = 0;
/**
/**
*
*/
- virtual void setXmlVersion(const DOMString &version) throw (DOMException) = 0;
+ virtual void setXmlVersion(const DOMString &version)
+ throw (DOMException) = 0;
/**
*
/**
*
*/
- virtual Node *adoptNode(const Node *source) throw (DOMException) = 0;
+ virtual NodePtr adoptNode(const NodePtr source) throw (DOMException) = 0;
/**
*
/**
*
*/
- virtual Node *renameNode(const Node *n,
- const DOMString &namespaceURI,
- const DOMString &qualifiedName)
- throw (DOMException) = 0;
+ virtual NodePtr renameNode(const NodePtr n,
+ const DOMString &namespaceURI,
+ const DOMString &qualifiedName)
+ throw (DOMException) = 0;
//##################
-
-
-
} //namespace dom
} //namespace w3c
} //namespace org
diff --git a/src/dom/domimpl.cpp b/src/dom/domimpl.cpp
index 5107518953330d312b70e927189703dcbf7717f3..663a8febc55935d2fc32e0f41a9c78af2d0177a1 100644 (file)
--- a/src/dom/domimpl.cpp
+++ b/src/dom/domimpl.cpp
/**
*
*/
-DocumentType *DOMImplementationImpl::createDocumentType(const DOMString& qualifiedName,
+DocumentTypePtr DOMImplementationImpl::createDocumentType(const DOMString& qualifiedName,
const DOMString& publicId,
const DOMString& systemId)
throw(DOMException)
{
- DocumentTypeImpl *typeImpl = new DocumentTypeImpl(qualifiedName,
+ DocumentTypePtr typeImpl = new DocumentTypeImpl(qualifiedName,
publicId, systemId);
return typeImpl;
}
@@ -147,16 +147,16 @@ DocumentType *DOMImplementationImpl::createDocumentType(const DOMString& qualifi
/**
*
*/
-Document *DOMImplementationImpl::createDocument(
+DocumentPtr DOMImplementationImpl::createDocument(
const DOMString& namespaceURI,
const DOMString& qualifiedName,
- DocumentType *doctype)
+ DocumentTypePtr doctype)
throw(DOMException)
{
- DocumentImpl *doc = new DocumentImpl(this,
- namespaceURI,
- qualifiedName,
- doctype);
+ DocumentPtr doc = new DocumentImpl(this,
+ namespaceURI,
+ qualifiedName,
+ doctype);
return doc;
}
* Utility for finding the first Element above
* a given node. Used by several methods below
*/
-static Node *getAncestorElement(Node *node)
+static NodePtr getAncestorElement(NodePtr node)
{
- if (!node)
+ if (!node.get())
return NULL;
node = node->getParentNode();
//Either quit because I am an element, or because I am null
- while (node)
+ while (node.get())
{
if (node->getNodeType() == Node::ELEMENT_NODE)
return node;
/**
*
*/
-Node *NodeImpl::getParentNode()
+NodePtr NodeImpl::getParentNode()
{
return parent;
}
NodeList NodeImpl::getChildNodes()
{
NodeList list;
- for (NodeImpl *node = firstChild ; node ; node=node->next)
+ for (NodeImplPtr node = firstChild ; node.get() ; node=node->next)
list.add(node);
return list;
}
/**
*
*/
-Node *NodeImpl::getFirstChild()
+NodePtr NodeImpl::getFirstChild()
{
return firstChild;
}
/**
*
*/
-Node *NodeImpl::getLastChild()
+NodePtr NodeImpl::getLastChild()
{
return lastChild;
}
/**
*
*/
-Node *NodeImpl::getPreviousSibling()
+NodePtr NodeImpl::getPreviousSibling()
{
return prev;
}
/**
*
*/
-Node *NodeImpl::getNextSibling()
+NodePtr NodeImpl::getNextSibling()
{
return next;
}
/**
*
*/
-Document *NodeImpl::getOwnerDocument()
+DocumentPtr NodeImpl::getOwnerDocument()
{
return ownerDocument;
}
/**
*
*/
-Node *NodeImpl::insertBefore(const Node *newChild,
- const Node *refChild)
- throw(DOMException)
+NodePtr NodeImpl::insertBefore(const NodePtr newChild,
+ const NodePtr refChild)
+ throw(DOMException)
{
if (!newChild)
return NULL;
if (!refChild)
return appendChild(newChild);
- NodeImpl *newChildImpl = dynamic_cast<NodeImpl *>((Node *)newChild);
- for (NodeImpl *n = firstChild ; n ; n=n->next)
+ NodeImplPtr newChildImpl = dynamic_cast<NodeImpl *>(newChild.get());
+ for (NodeImplPtr n = firstChild ; n.get() ; n=n->next)
{
if (n == refChild)
{
//link to new
- if (n->prev)
+ if (n->prev.get())
n->prev->next = newChildImpl;
else
firstChild = newChildImpl;
/**
*
*/
-Node *NodeImpl::replaceChild(const Node *newChild,
- const Node *oldChild)
- throw(DOMException)
+NodePtr NodeImpl::replaceChild(const NodePtr newChild,
+ const NodePtr oldChild)
+ throw(DOMException)
{
if (!oldChild)
return NULL;
- NodeImpl *newChildImpl = dynamic_cast<NodeImpl *>((Node *)newChild);
- for (NodeImpl *n = firstChild ; n ; n=n->next)
+ NodeImplPtr newChildImpl = dynamic_cast<NodeImpl *>(newChild.get());
+ for (NodeImplPtr n = firstChild ; n.get() ; n=n->next)
{
if (n == oldChild)
{
//link to new
- if (n->prev)
+ if (n->prev.get())
n->prev->next = newChildImpl;
else
firstChild = newChildImpl;
- if (n->next)
+ if (n->next.get())
n->next->prev = newChildImpl;
else
lastChild = newChildImpl;
/**
*
*/
-Node *NodeImpl::removeChild(const Node *oldChild)
- throw(DOMException)
+NodePtr NodeImpl::removeChild(const NodePtr oldChild)
+ throw(DOMException)
{
if (!oldChild)
return NULL;
- for (NodeImpl *n = firstChild ; n ; n=n->next)
+ for (NodeImplPtr n = firstChild ; n.get() ; n=n->next)
{
if (n == oldChild)
{
- if (n->prev)
+ if (n->prev.get())
n->prev->next = n->next;
- if (n->next)
+ if (n->next.get())
n->next->prev = n->prev;
return n;
}
/**
*
*/
-Node *NodeImpl::appendChild(const Node *newChild)
- throw(DOMException)
+NodePtr NodeImpl::appendChild(const NodePtr newChild)
+ throw(DOMException)
{
if (!newChild)
return NULL;
- NodeImpl *newChildImpl =
- dynamic_cast<NodeImpl *> ((Node *)newChild);
+ NodeImplPtr newChildImpl =
+ dynamic_cast<NodeImpl *> (newChild.get());
newChildImpl->parent = this;
newChildImpl->ownerDocument = ownerDocument;
lastChild = newChildImpl;
}
- return (Node *)newChild;
+ return newChild;
}
/**
*/
bool NodeImpl::hasChildNodes()
{
- return (firstChild != NULL);
+ return (firstChild != (NodeImpl *)0);
}
/**
*
*/
-Node *NodeImpl::cloneNode(bool deep)
+NodePtr NodeImpl::cloneNode(bool deep)
{
- NodeImpl *node = new NodeImpl(ownerDocument, nodeName);
+ NodeImplPtr node = new NodeImpl(ownerDocument, nodeName);
node->parent = parent;
node->prev = prev;
node->next = next;
if (deep)
{
node->firstChild = node->lastChild = NULL;
- for (NodeImpl *child = firstChild ; child ; child=child->next)
+ for (NodeImplPtr child = firstChild ; child.get() ; child=child->next)
{
node->appendChild(child->cloneNode(deep));
}
void NodeImpl::normalize()
{
//First, concatenate adjoining text nodes
- NodeImpl *next = NULL;
- for (NodeImpl *child = firstChild ; child ; child=next)
+ NodeImplPtr next = (NodeImpl *)0;
+ for (NodeImplPtr child = firstChild ; child.get() ; child=next)
{
if (child->getNodeType() != Node::TEXT_NODE)
continue;
next = NULL;
DOMString sval = child->getNodeValue();
- for (NodeImpl *sibling = child->next ; sibling ; sibling=next)
+ for (NodeImplPtr sibling = child->next ; sibling.get() ; sibling=next)
{
next = sibling->next;
if (sibling->getNodeType() != Node::TEXT_NODE)
sval.append(sibling->getNodeValue());
//unlink and delete
child->next = sibling->next;
- if (sibling->next)
+ if (sibling->next.get())
sibling->next->prev = child;
- delete sibling;
+ //delete sibling;
}
child->setNodeValue(sval);
}
//Next, we remove zero-length text subnodes
next = NULL;
- for (NodeImpl *child = firstChild ; child ; child=next)
+ for (NodeImplPtr child = firstChild ; child.get() ; child=next)
{
next = child->next;
if (child->getNodeType() != Node::TEXT_NODE)
if (child->getNodeValue().size() == 0)
{
//unlink and delete
- if (child->prev)
+ if (child->prev.get())
child->prev->next = child->next;
- if (child->next)
+ if (child->next.get())
child->next->prev = child->prev;
- delete child;
+ //delete child;
}
}
*
*/
bool NodeImpl::isSupported(const DOMString& feature,
- const DOMString& version)
+ const DOMString& version)
{
//again, no idea
return false;
/**
*
*/
-unsigned short NodeImpl::compareDocumentPosition(const Node *otherArg)
+unsigned short NodeImpl::compareDocumentPosition(const NodePtr otherArg)
{
- if (!otherArg || this == otherArg)
+ if (!otherArg || otherArg == (NodePtr )this)
return 0;//no flags
- Node *node;
- Node *other = (Node *)otherArg;
+ NodePtr node;
+ NodePtr other = otherArg;
//Look above me
- for (node=getParentNode() ; node ; node=node->getParentNode())
+ for (node=getParentNode() ; node.get() ; node=node->getParentNode())
if (node == other)
return DOCUMENT_POSITION_CONTAINED_BY;
//Look above the other guy. See me?
- for (node=other->getParentNode() ; node ; node=node->getParentNode())
- if (node == this)
+ for (node=other->getParentNode() ; node.get() ; node=node->getParentNode())
+ if (node == (NodePtr )this)
return DOCUMENT_POSITION_CONTAINS;
nodeType == ENTITY_REFERENCE_NODE ||
nodeType == DOCUMENT_FRAGMENT_NODE)
{
- for (Node *n = getFirstChild() ; n ;
+ for (NodePtr n = getFirstChild() ; n.get() ;
n=n->getNextSibling() )
{
if (n->getNodeType() != COMMENT_NODE &&
void NodeImpl::setTextContent(const DOMString &val) throw(DOMException)
{
//Delete children
- for (Node *n = getFirstChild() ; n ;
- n=n->getNextSibling() )
+ /** Not necessary. Just let smart pointers to their work
+ for (NodePtr n = getFirstChild() ; n.get() ;
+ n=n->getNextSibling() )
delete n;
+ */
firstChild = lastChild = NULL;
//Replace with a single text node
- NodeImpl *tnode = new NodeImpl(ownerDocument);
+ NodeImplPtr tnode = new NodeImpl(ownerDocument);
tnode->nodeType = Node::TEXT_NODE;
tnode->setNodeValue(val);
appendChild(tnode);
{
case Node::ELEMENT_NODE:
{
- ElementImpl *elem = (ElementImpl *)this;
+ ElementPtr elem = (Element *)this;
return lookupNamespacePrefix(theNamespaceURI, elem);
}
case Node::DOCUMENT_NODE:
{
- Document *doc = (Document *)this;
- Element *elem = doc->getDocumentElement();
+ DocumentPtr doc = (Document *)this;
+ ElementPtr elem = doc->getDocumentElement();
return elem->lookupPrefix(theNamespaceURI);
}
case Node::ENTITY_NODE :
return DOMString(""); // type is unknown
case Node::ATTRIBUTE_NODE:
{
- Attr *attr = (Attr *)this;
- Element *elem = (Element *)attr->getOwnerElement();
- if ( elem )
+ AttrPtr attr = (Attr *)this;
+ ElementPtr elem = attr->getOwnerElement();
+ if ( elem.get() )
{
return elem->lookupPrefix(theNamespaceURI);
}
default:
{
//Get ancestor element, if any
- if ( Node *ancestor = getAncestorElement(this) )
+ NodePtr ancestor = getAncestorElement(this);
+ if ( ancestor.get() )
{
return ancestor->lookupPrefix(theNamespaceURI);
}
switch (nodeType)
{
case ELEMENT_NODE:
+ {
if ( namespaceURI.size()>0 && prefix.size()==0 )
{
return (namespaceURI == theNamespaceURI);
}
- if ( Node *attr = attributes.getNamedItem("xmlns"))
+ NodePtr attr = attributes.getNamedItem("xmlns");
+ if ( attr.get() )
{
- return (attr->getNodeValue() == theNamespaceURI);
+ return (attr->getNodeValue() == theNamespaceURI);
}
-
- if ( Node *ancestor = getAncestorElement(this) )
+ NodePtr ancestor = getAncestorElement(this);
+ if ( ancestor.get() )
{
return ancestor->isDefaultNamespace(theNamespaceURI);
}
{
return false;
}
+ }
case DOCUMENT_NODE:
{ //just use braces for local declaration
- Document *doc = (Document *)this;
- Element *elem = doc->getDocumentElement();
+ DocumentPtr doc = (Document *)this;
+ ElementPtr elem = doc->getDocumentElement();
return elem->isDefaultNamespace(theNamespaceURI);
}
case ENTITY_NODE:
case DOCUMENT_FRAGMENT_NODE:
return false;
case ATTRIBUTE_NODE:
- {//braces only for scope
- Attr *attr = (Attr *)this;
- Element *ownerElement = attr->getOwnerElement();
- if ( ownerElement )
+ {//braces only for scope
+ AttrPtr attr = (Attr *)this;
+ ElementPtr ownerElement = attr->getOwnerElement();
+ if ( ownerElement.get() )
{
return ownerElement->isDefaultNamespace(theNamespaceURI);
}
- else
+ else
{
return false;
}
- }
+ }
default:
- if ( Node *ancestor = getAncestorElement(this) )
+ {
+ NodePtr ancestor = getAncestorElement(this);
+ if ( ancestor.get() )
{
return ancestor->isDefaultNamespace(theNamespaceURI);
}
{
return false;
}
+ }
}//switch
return false;
int nrAttrs = attributes.getLength();
for (int i=0 ; i<nrAttrs ; i++)
{
- Node *attr = attributes.item(i);
+ NodePtr attr = attributes.item(i);
if (attr->getPrefix() == "xmlns" && attr->getLocalName() == thePrefix )
{ // non default namespace
if (attr->getNodeValue().size()>0)
}
}
- if ( Node *ancestor = getAncestorElement(this) )
+ NodePtr ancestor = getAncestorElement(this);
+ if ( ancestor.get() )
{
return ancestor->lookupNamespaceURI(thePrefix);
}
}
case DOCUMENT_NODE:
{
- Document *doc = (Document *)this;
- Element *elem = doc->getDocumentElement();
+ DocumentPtr doc = (Document *)this;
+ ElementPtr elem = doc->getDocumentElement();
return elem->lookupNamespaceURI(thePrefix);
}
case ENTITY_NODE:
case ATTRIBUTE_NODE:
{
- if (Element *ownerElement = ((Attr *)this)->getOwnerElement())
+ ElementPtr ownerElement = ((Attr *)this)->getOwnerElement();
+ if ( ownerElement.get() )
{
return ownerElement->lookupNamespaceURI(thePrefix);
}
}
}
default:
- if ( Node *ancestor = getAncestorElement(this) )
+ {
+ NodePtr ancestor = getAncestorElement(this);
+ if ( ancestor.get() )
{
return ancestor->lookupNamespaceURI(thePrefix);
}
{
return DOMString("");
}
+ }
}//switch
}
/**
*
*/
-bool NodeImpl::isEqualNode(const Node *nodeArg)
+bool NodeImpl::isEqualNode(const NodePtr nodeArg)
{
if (!nodeArg)
return false;
- if (this == nodeArg)
+ if (nodeArg == (NodePtr )this)
return true;
- Node *node = (Node *)nodeArg;
+ NodePtr node = nodeArg;
if (getNodeType() != node->getNodeType() ||
getNodeName() != node->getNodeName() ||
* From DOM3 Namespace algorithms
*/
DOMString NodeImpl::lookupNamespacePrefix(const DOMString &theNamespaceURI,
- Node *originalElement)
+ NodePtr originalElement)
{
if (!originalElement)
return DOMString("");
int nrAttrs = attributes.getLength();
for (int i=0 ; i<nrAttrs ; i++)
{
- Node *attr = attributes.item(i);
+ NodePtr attr = attributes.item(i);
DOMString attrLocalName = attr->getLocalName();
if (attr->getPrefix() == "xmlns" &&
attr->getNodeValue() == theNamespaceURI &&
}
//Get ancestor element, if any
- NodeImpl *ancestor = parent;
- while (ancestor && ancestor->getNodeType()!= Node::ELEMENT_NODE)
+ NodeImplPtr ancestor = parent;
+ while (ancestor.get() && ancestor->getNodeType()!= Node::ELEMENT_NODE)
ancestor = ancestor->parent;
- if ( ancestor )
+ if ( ancestor.get() )
{
return ancestor->lookupNamespacePrefix(theNamespaceURI, originalElement);
}
/**
*
*/
-NodeImpl::NodeImpl(DocumentImpl *owner)
+NodeImpl::NodeImpl(DocumentImplPtr owner) : Node()
{
init();
ownerDocument = owner;
/**
*
*/
-NodeImpl::NodeImpl(DocumentImpl *owner, const DOMString &nodeName)
+NodeImpl::NodeImpl(DocumentImplPtr owner, const DOMString &nodeName)
+ : Node()
{
init();
ownerDocument = owner;
/**
*
*/
-NodeImpl::NodeImpl(DocumentImpl *owner, const DOMString &theNamespaceURI,
- const DOMString &qualifiedName)
+NodeImpl::NodeImpl(DocumentImplPtr owner, const DOMString &theNamespaceURI,
+ const DOMString &qualifiedName) : Node()
{
init();
ownerDocument = owner;
if (userDataEntries)
delete userDataEntries;
//Delete children
- for (Node *n = getFirstChild() ; n ;
+ /** Use smart pointers. do not delete explicitly
+ for (NodePtr n = getFirstChild() ; n.get() ;
n=n->getNextSibling() )
delete n;
+ */
+ firstChild = lastChild = (NodeImpl *)0;
}
/**
*
*/
-CharacterDataImpl::CharacterDataImpl(DocumentImpl *owner,
+CharacterDataImpl::CharacterDataImpl(DocumentImplPtr owner,
const DOMString &theValue) : NodeImpl()
{
ownerDocument = owner;
/**
*
*/
-Element *AttrImpl::getOwnerElement()
+ElementPtr AttrImpl::getOwnerElement()
{
return ownerElement;
}
/**
*
*/
-TypeInfo *AttrImpl::getSchemaTypeInfo()
+TypeInfo &AttrImpl::getSchemaTypeInfo()
{
- return NULL;
+ return typeInfo;
}
//##################
-void AttrImpl::setOwnerElement(const Element *elem)
+void AttrImpl::setOwnerElement(const ElementPtr elem)
{
- ownerElement = (Element *)elem;
+ ownerElement = elem;
}
/**
*
*/
-AttrImpl::AttrImpl(DocumentImpl *owner, const DOMString &theName)
+AttrImpl::AttrImpl(DocumentImplPtr owner, const DOMString &theName)
: NodeImpl()
{
nodeType = ATTRIBUTE_NODE;
/**
*
*/
-AttrImpl::AttrImpl(DocumentImpl *owner,
+AttrImpl::AttrImpl(DocumentImplPtr owner,
const DOMString &theNamespaceURI,
const DOMString &theQualifiedName)
: NodeImpl()
*/
DOMString ElementImpl::getAttribute(const DOMString& name)
{
- Node *node = attributes.getNamedItem(name);
+ NodePtr node = attributes.getNamedItem(name);
if (!node || node->getNodeType() != ATTRIBUTE_NODE)
return DOMString("");
- Attr *attr = dynamic_cast<Attr *>(node);
+ AttrPtr attr = dynamic_cast<Attr *>(node.get());
return attr->getValue();
}
const DOMString& value)
throw(DOMException)
{
- AttrImpl *attr = new AttrImpl(ownerDocument, name);
+ AttrImplPtr attr = new AttrImpl(ownerDocument, name);
attr->setValue(value);
attr->setOwnerElement(this);
attributes.setNamedItem(attr);
/**
*
*/
-Attr *ElementImpl::getAttributeNode(const DOMString& name)
+AttrPtr ElementImpl::getAttributeNode(const DOMString& name)
{
- Node *node = attributes.getNamedItem(name);
+ NodePtr node = attributes.getNamedItem(name);
if (!node || node->getNodeType() != ATTRIBUTE_NODE)
return NULL;
- Attr *attr = dynamic_cast<Attr *>(node);
+ AttrPtr attr = dynamic_cast<Attr *>(node.get());
return attr;
}
/**
*
*/
-Attr *ElementImpl::setAttributeNode(Attr *attr)
+AttrPtr ElementImpl::setAttributeNode(AttrPtr attr)
throw(DOMException)
{
attributes.setNamedItem(attr);
/**
*
*/
-Attr *ElementImpl::removeAttributeNode(Attr *attr)
+AttrPtr ElementImpl::removeAttributeNode(AttrPtr attr)
throw(DOMException)
{
- if (!attr)
- return NULL;
attributes.removeNamedItem(attr->getName());
return attr;
}
*
*/
void ElementImpl::getElementsByTagNameRecursive(NodeList &list,
- const DOMString& name, Element *elem)
+ const DOMString& name, ElementPtr elem)
{
if (!elem)
return;
if (name == elem->getTagName())
list.add(elem);
- for (Node *node = elem->getFirstChild() ; node ; node=node->getNextSibling())
+ for (NodePtr node = elem->getFirstChild() ; node.get() ;
+ node=node->getNextSibling())
{
if (node->getNodeType() != Node::ELEMENT_NODE)
continue;
- Element *childElem = dynamic_cast<Element *>(node);
+ ElementPtr childElem = dynamic_cast<Element *>(node.get());
getElementsByTagNameRecursive(list, name, childElem);
}
}
DOMString ElementImpl::getAttributeNS(const DOMString& namespaceURI,
const DOMString& localName)
{
- Node *node = attributes.getNamedItemNS(namespaceURI, localName);
+ NodePtr node = attributes.getNamedItemNS(namespaceURI, localName);
if (!node || node->getNodeType()!=ATTRIBUTE_NODE)
return DOMString("");
- Attr *attr = dynamic_cast<Attr *>(node);
+ AttrPtr attr = dynamic_cast<Attr *>(node.get());
return attr->getValue();
}
const DOMString& value)
throw(DOMException)
{
- AttrImpl *attr = new AttrImpl(ownerDocument, namespaceURI, qualifiedName);
+ AttrImplPtr attr = new AttrImpl(ownerDocument, namespaceURI, qualifiedName);
attr->setValue(value);
attr->setOwnerElement(this);
attributes.setNamedItemNS(attr);
/**
*
*/
- Attr *ElementImpl::getAttributeNodeNS(const DOMString& namespaceURI,
+ AttrPtr ElementImpl::getAttributeNodeNS(const DOMString& namespaceURI,
const DOMString& localName)
{
- Node *node = attributes.getNamedItemNS(namespaceURI, localName);
+ NodePtr node = attributes.getNamedItemNS(namespaceURI, localName);
if (!node || node->getNodeType() != ATTRIBUTE_NODE)
- return NULL;
- Attr *attr = dynamic_cast<Attr *>(node);
+ return (Attr *)0;
+ AttrPtr attr = dynamic_cast<Attr *>(node.get());
return attr;
}
/**
*
*/
-Attr *ElementImpl::setAttributeNodeNS(Attr *attr)
+AttrPtr ElementImpl::setAttributeNodeNS(AttrPtr attr)
throw(DOMException)
{
attributes.setNamedItemNS(attr);
*
*/
void ElementImpl::getElementsByTagNameNSRecursive(NodeList &list,
- const DOMString& namespaceURI, const DOMString& tagName, Element *elem)
+ const DOMString& namespaceURI,
+ const DOMString& tagName, ElementPtr elem)
{
if (!elem)
return;
if (namespaceURI == elem->getNamespaceURI() && tagName == elem->getTagName())
list.add(elem);
- for (Node *node = elem->getFirstChild() ; node ; node=node->getNextSibling())
+ for (NodePtr node = elem->getFirstChild() ; node.get() ; node=node->getNextSibling())
{
if (node->getNodeType() != Node::ELEMENT_NODE)
continue;
- Element *childElem = dynamic_cast<Element *>(node);
+ ElementPtr childElem = dynamic_cast<Element *>(node.get());
getElementsByTagNameNSRecursive(list, namespaceURI, tagName, childElem);
}
}
*/
bool ElementImpl::hasAttribute(const DOMString& attrName)
{
- Node *node = attributes.getNamedItem(attrName);
+ NodePtr node = attributes.getNamedItem(attrName);
if (!node || node->getNodeType() != ATTRIBUTE_NODE)
return false;
return true;
bool ElementImpl::hasAttributeNS(const DOMString& namespaceURI,
const DOMString& localName)
{
- Node *node = attributes.getNamedItemNS(namespaceURI, localName);
+ NodePtr node = attributes.getNamedItemNS(namespaceURI, localName);
if (!node || node->getNodeType() != ATTRIBUTE_NODE)
return false;
return true;
/**
*
*/
-TypeInfo *ElementImpl::getSchemaTypeInto()
+TypeInfo &ElementImpl::getSchemaTypeInfo()
{
- //fixme
- return NULL;
+ return typeInfo;
}
/**
*
*/
-void ElementImpl::setIdAttributeNode(const Attr *idAttr,
+void ElementImpl::setIdAttributeNode(const AttrPtr idAttr,
bool isId) throw (DOMException)
{
//fixme
/**
*
*/
-ElementImpl::ElementImpl(DocumentImpl *owner, const DOMString &tagName)
+ElementImpl::ElementImpl(DocumentImplPtr owner, const DOMString &tagName)
: NodeImpl()
{
nodeType = ELEMENT_NODE;
/**
*
*/
-ElementImpl::ElementImpl(DocumentImpl *owner,
+ElementImpl::ElementImpl(DocumentImplPtr owner,
const DOMString &theNamespaceURI,
const DOMString &qualifiedName) :
NodeImpl()
int nrAttrs = attrs.getLength();
for (int i=0; i<nrAttrs ; i++)
{
- Node *attrNode = attrs.item(i);
+ NodePtr attrNode = attrs.item(i);
if (attrNode->getNodeType() != Node::ATTRIBUTE_NODE)
continue;
- AttrImpl *attr = dynamic_cast<AttrImpl *>(attrNode);
+ AttrImplPtr attr = dynamic_cast<AttrImpl *>(attrNode.get());
DOMString attrNS = attr->getNamespaceURI();
DOMString attrName = attr->getLocalName();
DOMString attrPrefix = attr->getPrefix();
nrAttrs = attrs.getLength();
for (int i=0; i<nrAttrs ; i++)// all non-namespace Attrs of Element
{
- Node *attrNode = attrs.item(i);
+ NodePtr attrNode = attrs.item(i);
if (attrNode->getNodeType() != Node::ATTRIBUTE_NODE)
continue;
- Attr *attr = dynamic_cast<Attr *>(attrNode);
+ AttrPtr attr = dynamic_cast<Attr *>(attrNode.get());
DOMString attrNS = attr->getNamespaceURI();
DOMString attrPrefix = attr->getPrefix();
DOMString attrValue = attr->getNodeValue();
//#######################################
//# Recursively normalize children
//#######################################
- for (Node *child=getFirstChild() ; child ; child=child->getNextSibling())
+ for (NodePtr child=getFirstChild() ; child.get() ; child=child->getNextSibling())
{
if (child->getNodeType() != Node::ELEMENT_NODE)
continue;
- ElementImpl *childElement = dynamic_cast<ElementImpl *>(child);
+ ElementImplPtr childElement = dynamic_cast<ElementImpl *>(child.get());
childElement->normalizeNamespaces();
}
/**
*
*/
-TextImpl::TextImpl(DocumentImpl *owner, const DOMString &value)
+TextImpl::TextImpl(DocumentImplPtr owner, const DOMString &value)
: CharacterDataImpl()
{
nodeType = TEXT_NODE;
/**
*
*/
-Text *TextImpl::splitText(unsigned long offset)
+TextPtr TextImpl::splitText(unsigned long offset)
throw(DOMException)
{
return NULL;
/**
*
*/
-Text *TextImpl::replaceWholeText(const DOMString &content)
+TextPtr TextImpl::replaceWholeText(const DOMString &content)
throw(DOMException)
{
return NULL;
/**
*
*/
-CommentImpl::CommentImpl(DocumentImpl *owner, const DOMString &value)
+CommentImpl::CommentImpl(DocumentImplPtr owner, const DOMString &value)
: CharacterDataImpl()
{
nodeType = COMMENT_NODE;
-/*#########################################################################
-## TypeInfoImpl
-#########################################################################*/
-
-
-/**
- *
- */
-TypeInfoImpl::TypeInfoImpl(const DOMString &typeNamespaceArg,
- const DOMString &typeNameArg,
- const DerivationMethod derivationMethodArg)
-{
- typeNamespace = typeNamespaceArg;
- typeName = typeNameArg;
- derivationMethod = derivationMethodArg;
-}
-
-
-/**
- *
- */
-TypeInfoImpl::~TypeInfoImpl()
-{
-}
-
-
-/**
- *
- */
-DOMString TypeInfoImpl::getTypeName()
-{
- return typeName;
-}
-
-/**
- *
- */
-DOMString TypeInfoImpl::getTypeNamespace()
-{
- return typeNamespace;
-}
-
-/**
- *
- */
-bool TypeInfoImpl::isDerivedFrom(const DOMString &typeNamespaceArg,
- const DOMString &typeNameArg,
- const DerivationMethod derivationMethodArg)
-{
- if (typeNamespaceArg == typeNamespace &&
- typeName == typeNameArg &&
- derivationMethod == derivationMethodArg)
- return true;
- return false;
-}
void UserDataHandlerImpl::handle(unsigned short operation,
const DOMString &key,
const DOMUserData *data,
- const Node *src,
- const Node *dst)
+ const NodePtr src,
+ const NodePtr dst)
{
//do nothing. do we need anything here?
}
/**
*
*/
-Node *DOMLocatorImpl::getRelatedNode()
+NodePtr DOMLocatorImpl::getRelatedNode()
{
return relatedNode;
}
/**
*
*/
-CDATASectionImpl::CDATASectionImpl(DocumentImpl *owner, const DOMString &theValue)
+CDATASectionImpl::CDATASectionImpl(DocumentImplPtr owner, const DOMString &theValue)
: TextImpl()
{
nodeType = CDATA_SECTION_NODE;
/**
*
*/
-NotationImpl::NotationImpl(DocumentImpl *owner) : NodeImpl()
+NotationImpl::NotationImpl(DocumentImplPtr owner) : NodeImpl()
{
nodeType = NOTATION_NODE;
ownerDocument = owner;
/**
*
*/
-EntityImpl::EntityImpl(DocumentImpl *owner) : NodeImpl()
+EntityImpl::EntityImpl(DocumentImplPtr owner) : NodeImpl()
{
nodeType = ENTITY_NODE;
ownerDocument = owner;
/**
*
*/
-EntityReferenceImpl::EntityReferenceImpl(DocumentImpl *owner,
+EntityReferenceImpl::EntityReferenceImpl(DocumentImplPtr owner,
const DOMString &theName)
: NodeImpl()
{
/**
*
*/
-ProcessingInstructionImpl::ProcessingInstructionImpl(DocumentImpl *owner,
+ProcessingInstructionImpl::ProcessingInstructionImpl(DocumentImplPtr owner,
const DOMString &target,
const DOMString &data)
: NodeImpl()
/**
*
*/
-DocumentFragmentImpl::DocumentFragmentImpl(DocumentImpl *owner) : NodeImpl()
+DocumentFragmentImpl::DocumentFragmentImpl(DocumentImplPtr owner) : NodeImpl()
{
nodeType = DOCUMENT_FRAGMENT_NODE;
nodeName = "#document-fragment";
/**
*
*/
-DocumentType *DocumentImpl::getDoctype()
+DocumentTypePtr DocumentImpl::getDoctype()
{
return doctype;
}
/**
*
*/
-Element *DocumentImpl::getDocumentElement()
+ElementPtr DocumentImpl::getDocumentElement()
{
return documentElement;
}
/**
*
*/
-Element *DocumentImpl::createElement(const DOMString& tagName)
+ElementPtr DocumentImpl::createElement(const DOMString& tagName)
throw(DOMException)
{
- ElementImpl *impl = new ElementImpl(this, tagName);
- return impl;
+ ElementPtr elem = new ElementImpl(this, tagName);
+ return elem;
}
/**
*
*/
-DocumentFragment *DocumentImpl::createDocumentFragment()
+DocumentFragmentPtr DocumentImpl::createDocumentFragment()
{
- DocumentFragmentImpl *frag = new DocumentFragmentImpl(this);
+ DocumentFragmentPtr frag = new DocumentFragmentImpl(this);
return frag;
}
/**
*
*/
-Text *DocumentImpl::createTextNode(const DOMString& data)
+TextPtr DocumentImpl::createTextNode(const DOMString& data)
{
- TextImpl *text = new TextImpl(this, data);
+ TextPtr text = new TextImpl(this, data);
return text;
}
/**
*
*/
-Comment *DocumentImpl::createComment(const DOMString& data)
+CommentPtr DocumentImpl::createComment(const DOMString& data)
{
- CommentImpl *comment = new CommentImpl(this, data);
+ CommentPtr comment = new CommentImpl(this, data);
return comment;
}
/**
*
*/
-CDATASection *DocumentImpl::createCDATASection(const DOMString& data)
+CDATASectionPtr DocumentImpl::createCDATASection(const DOMString& data)
throw(DOMException)
{
- CDATASectionImpl *cdata = new CDATASectionImpl(this, data);
+ CDATASectionPtr cdata = new CDATASectionImpl(this, data);
return cdata;
}
/**
*
*/
-ProcessingInstruction *DocumentImpl::createProcessingInstruction(const DOMString& target,
- const DOMString& data)
- throw(DOMException)
+ProcessingInstructionPtr
+DocumentImpl::createProcessingInstruction(const DOMString& target,
+ const DOMString& data)
+ throw(DOMException)
{
- ProcessingInstructionImpl *cdata =
+ ProcessingInstructionPtr pi =
new ProcessingInstructionImpl(this, target, data);
- return cdata;
+ return pi;
}
/**
*
*/
-Attr *DocumentImpl::createAttribute(const DOMString& attrName)
+AttrPtr DocumentImpl::createAttribute(const DOMString& attrName)
throw(DOMException)
{
- AttrImpl *attr = new AttrImpl(this, attrName);
+ AttrPtr attr = new AttrImpl(this, attrName);
return attr;
}
/**
*
*/
-EntityReference *DocumentImpl::createEntityReference(const DOMString& erName)
+EntityReferencePtr DocumentImpl::createEntityReference(const DOMString& erName)
throw(DOMException)
{
- EntityReferenceImpl *ref = new EntityReferenceImpl(this, erName);
+ EntityReferencePtr ref = new EntityReferenceImpl(this, erName);
return ref;
}
/**
*
*/
-Node *DocumentImpl::importNode(const Node *importedNode,
+NodePtr DocumentImpl::importNode(const NodePtr importedNode,
bool deep)
throw(DOMException)
{
/**
*
*/
-Element *DocumentImpl::createElementNS(const DOMString& namespaceURI,
+ElementPtr DocumentImpl::createElementNS(const DOMString& namespaceURI,
const DOMString& qualifiedName)
throw(DOMException)
{
- ElementImpl *elem = new ElementImpl(this, namespaceURI, qualifiedName);
+ ElementPtr elem = new ElementImpl(this, namespaceURI, qualifiedName);
return elem;
}
/**
*
*/
-Attr *DocumentImpl::createAttributeNS(const DOMString& namespaceURI,
+AttrPtr DocumentImpl::createAttributeNS(const DOMString& namespaceURI,
const DOMString& qualifiedName)
throw(DOMException)
{
- AttrImpl *attr = new AttrImpl(this, namespaceURI, qualifiedName);
+ AttrPtr attr = new AttrImpl(this, namespaceURI, qualifiedName);
return attr;
}
/**
*
*/
-Element *DocumentImpl::getElementById(const DOMString& elementId)
+ElementPtr DocumentImpl::getElementById(const DOMString& elementId)
{
for (NamedElementItem *entry = elementsById.next; entry ; entry=entry->next)
if (entry->name == elementId)
*/
DOMString DocumentImpl::getDocumentURI()
{
- if (!documentURI)
- return DOMString("");
- DOMString docURI = *documentURI;
- return docURI;
+ return documentURI;
}
/**
/**
*
*/
-Node *DocumentImpl::adoptNode(const Node *source) throw (DOMException)
+NodePtr DocumentImpl::adoptNode(const NodePtr source) throw (DOMException)
{
- return (Node *)source;
+ return (NodePtr )source;
}
/**
void DocumentImpl::normalizeDocument()
{
//i assume that this means adjusting namespaces & prefixes
- if (documentElement)
+ if (documentElement.get())
documentElement->normalizeNamespaces();
}
/**
*
*/
-Node *DocumentImpl::renameNode(const Node *n,
+NodePtr DocumentImpl::renameNode(const NodePtr node,
const DOMString &namespaceURI,
const DOMString &qualifiedName)
throw (DOMException)
{
- Node *node = (Node *) n;
- NodeImpl *nodeImpl = dynamic_cast<NodeImpl *> (node);
- //nodeImpl->namespaceURI = stringCache(namespaceURI);
+ NodeImplPtr nodeImpl = dynamic_cast<NodeImpl *> (node.get());
nodeImpl->setNodeName(qualifiedName);
return node;
}
DocumentImpl::DocumentImpl(const DOMImplementation *domImpl,
const DOMString &theNamespaceURI,
const DOMString &theQualifiedName,
- const DocumentType *theDoctype) : NodeImpl()
+ const DocumentTypePtr theDoctype) : NodeImpl()
{
nodeType = DOCUMENT_NODE;
nodeName = "#document";
parent = (DOMImplementation *)domImpl;
//documentURI = stringCache(theNamespaceURI);
qualifiedName = theQualifiedName;
- if (theDoctype) //only assign if not null.
- doctype = (DocumentType *)theDoctype;
+ if (theDoctype.get()) //only assign if not null.
+ doctype = theDoctype;
else
doctype = new DocumentTypeImpl("", "", "");
documentElement = new ElementImpl(this, "root");
*/
DocumentImpl::~DocumentImpl()
{
- delete documentElement;
+ documentElement = NULL;
}
diff --git a/src/dom/domimpl.h b/src/dom/domimpl.h
index 669b3d878152b630c1f96a9571cb5991e153d7b5..cf7ab6564873c9a2647993338b83bafef8bb9d32 100644 (file)
--- a/src/dom/domimpl.h
+++ b/src/dom/domimpl.h
class DOMImplementationSourceImpl;
class DOMImplementationImpl;
class NodeImpl;
+typedef Ptr<NodeImpl> NodeImplPtr;
class CharacterDataImpl;
class AttrImpl;
+typedef Ptr<AttrImpl> AttrImplPtr;
class ElementImpl;
+typedef Ptr<ElementImpl> ElementImplPtr;
class TextImpl;
class CommentImpl;
class TypeInfoImpl;
class DOMConfigurationImpl;
class CDATASectionImpl;
class DocumentTypeImpl;
+typedef Ptr<DocumentTypeImpl> DocumentTypeImplPtr;
class NotationImpl;
class EntityImpl;
class EntityReferenceImpl;
class ProcessingInstructionImpl;
class DocumentFragmentImpl;
class DocumentImpl;
+typedef Ptr<DocumentImpl> DocumentImplPtr;
/**
*
*/
- virtual DocumentType *createDocumentType(const DOMString& qualifiedName,
+ virtual DocumentTypePtr createDocumentType(const DOMString& qualifiedName,
const DOMString& publicId,
const DOMString& systemId)
throw(DOMException);
/**
*
*/
- virtual Document *createDocument(const DOMString& namespaceURI,
+ virtual DocumentPtr createDocument(const DOMString& namespaceURI,
const DOMString& qualifiedName,
- DocumentType *doctype)
+ DocumentTypePtr doctype)
throw(DOMException);
/**
*
/**
*
*/
- virtual Node *getParentNode();
+ virtual NodePtr getParentNode();
/**
*
/**
*
*/
- virtual Node *getFirstChild();
+ virtual NodePtr getFirstChild();
/**
*
*/
- virtual Node *getLastChild();
+ virtual NodePtr getLastChild();
/**
*
*/
- virtual Node *getPreviousSibling();
+ virtual NodePtr getPreviousSibling();
/**
*
*/
- virtual Node *getNextSibling();
+ virtual NodePtr getNextSibling();
/**
*
/**
*
*/
- virtual Document *getOwnerDocument();
+ virtual DocumentPtr getOwnerDocument();
/**
*
*/
- virtual Node *insertBefore(const Node *newChild,
- const Node *refChild)
+ virtual NodePtr insertBefore(const NodePtr newChild,
+ const NodePtr refChild)
throw(DOMException);
/**
*
*/
- virtual Node *replaceChild(const Node *newChild,
- const Node *oldChild)
+ virtual NodePtr replaceChild(const NodePtr newChild,
+ const NodePtr oldChild)
throw(DOMException);
/**
*
*/
- virtual Node *removeChild(const Node *oldChild)
+ virtual NodePtr removeChild(const NodePtr oldChild)
throw(DOMException);
/**
*
*/
- virtual Node *appendChild(const Node *newChild)
+ virtual NodePtr appendChild(const NodePtr newChild)
throw(DOMException);
/**
/**
*
*/
- virtual Node *cloneNode(bool deep);
+ virtual NodePtr cloneNode(bool deep);
/**
*
/**
*
*/
- virtual unsigned short compareDocumentPosition(const Node *other);
+ virtual unsigned short compareDocumentPosition(const NodePtr other);
/**
*
/**
*
*/
- virtual bool isEqualNode(const Node *node);
+ virtual bool isEqualNode(const NodePtr node);
DOMString ret = iter->second;
return ret;
}
- if (parent)
+ if (parent.get())
{
DOMString ret = parent->bindingsFind(prefix);
if (ret.size() > 0)
*
*/
DOMString lookupNamespacePrefix(const DOMString &namespaceURI,
- Node *originalElement);
+ NodePtr originalElement);
/**
*
*/
/**
*
*/
- NodeImpl(DocumentImpl *owner);
+ NodeImpl(DocumentImplPtr owner);
/**
*
*/
- NodeImpl(DocumentImpl *owner, const DOMString &nodeName);
+ NodeImpl(DocumentImplPtr owner, const DOMString &nodeName);
/**
*
*/
- NodeImpl(DocumentImpl *owner, const DOMString &namespaceURI, const DOMString &nodeName);
+ NodeImpl(DocumentImplPtr owner, const DOMString &namespaceURI,
+ const DOMString &nodeName);
/**
*
unsigned short nodeType;
- NodeImpl *parent;
+ NodeImplPtr parent;
- NodeImpl *prev;
+ NodeImplPtr prev;
- NodeImpl *next;
+ NodeImplPtr next;
DOMUserData *userData;
DOMString nodeValue;
- NodeImpl *firstChild;
- NodeImpl *lastChild;
+ NodeImplPtr firstChild;
+ NodeImplPtr lastChild;
- DocumentImpl *ownerDocument;
+ DocumentImplPtr ownerDocument;
NamedNodeMap attributes;
};
UserDataEntry *userDataEntries;
+
+ TypeInfo typeInfo;
//### Our prefix->namespaceURI bindings
/**
*
*/
- CharacterDataImpl(DocumentImpl *owner, const DOMString &value);
+ CharacterDataImpl(DocumentImplPtr owner, const DOMString &value);
/**
*
/**
*
*/
- virtual Element *getOwnerElement();
+ virtual ElementPtr getOwnerElement();
/**
*
*/
- virtual TypeInfo *getSchemaTypeInfo();
+ virtual TypeInfo &getSchemaTypeInfo();
/**
/**
*
*/
- virtual void setOwnerElement(const Element *elem);
+ virtual void setOwnerElement(const ElementPtr elem);
/**
*
*/
- AttrImpl(DocumentImpl *owner, const DOMString &name);
+ AttrImpl(DocumentImplPtr owner, const DOMString &name);
/**
*
*/
- AttrImpl(DocumentImpl *owner, const DOMString &namespaceURI, const DOMString &name);
+ AttrImpl(DocumentImplPtr owner, const DOMString &namespaceURI,
+ const DOMString &name);
/**
*
protected:
- Element *ownerElement;
+ ElementPtr ownerElement;
};
/**
*
*/
- virtual Attr *getAttributeNode(const DOMString& name);
+ virtual AttrPtr getAttributeNode(const DOMString& name);
/**
*
*/
- virtual Attr *setAttributeNode(Attr *newAttr)
+ virtual AttrPtr setAttributeNode(AttrPtr newAttr)
throw(DOMException);
/**
*
*/
- virtual Attr *removeAttributeNode(Attr *oldAttr)
+ virtual AttrPtr removeAttributeNode(AttrPtr oldAttr)
throw(DOMException);
/**
/**
*
*/
- virtual Attr *getAttributeNodeNS(const DOMString& namespaceURI,
+ virtual AttrPtr getAttributeNodeNS(const DOMString& namespaceURI,
const DOMString& localName);
/**
*
*/
- virtual Attr *setAttributeNodeNS(Attr *newAttr)
+ virtual AttrPtr setAttributeNodeNS(AttrPtr newAttr)
throw(DOMException);
/**
/**
*
*/
- virtual TypeInfo *getSchemaTypeInto();
+ virtual TypeInfo &getSchemaTypeInfo();
/**
/**
*
*/
- virtual void setIdAttributeNode(const Attr *idAttr,
+ virtual void setIdAttributeNode(const AttrPtr idAttr,
bool isId) throw (DOMException);
/**
*
*/
- ElementImpl(DocumentImpl *owner, const DOMString &tagName);
+ ElementImpl(DocumentImplPtr owner, const DOMString &tagName);
/**
*
*/
- ElementImpl(DocumentImpl *owner, const DOMString &namespaceURI, const DOMString &tagName);
+ ElementImpl(DocumentImplPtr owner, const DOMString &namespaceURI,
+ const DOMString &tagName);
/**
*
friend class DocumentImpl;
static void getElementsByTagNameRecursive(NodeList &list,
- const DOMString& name, Element *elem);
+ const DOMString& name, ElementPtr elem);
static void getElementsByTagNameNSRecursive(NodeList &list,
- const DOMString& namespaceURI, const DOMString& tagName, Element *elem);
+ const DOMString& namespaceURI, const DOMString& tagName,
+ ElementPtr elem);
};
/**
*
*/
- virtual Text *splitText(unsigned long offset)
+ virtual TextPtr splitText(unsigned long offset)
throw(DOMException);
/**
/**
*
*/
- virtual Text *replaceWholeText(const DOMString &content)
+ virtual TextPtr replaceWholeText(const DOMString &content)
throw(DOMException);
//##################
/**
*
*/
- TextImpl(DocumentImpl *owner, const DOMString &val);
+ TextImpl(DocumentImplPtr owner, const DOMString &val);
/**
*
/**
*
*/
- CommentImpl(DocumentImpl *owner, const DOMString &theValue);
+ CommentImpl(DocumentImplPtr owner, const DOMString &theValue);
/**
*
virtual void handle(unsigned short operation,
const DOMString &key,
const DOMUserData *data,
- const Node *src,
- const Node *dst);
+ const NodePtr src,
+ const NodePtr dst);
//##################
//# Non-API methods
/**
*
*/
- virtual Node *getRelatedNode();
+ virtual NodePtr getRelatedNode();
/**
long utf16Offset;
- Node *relatedNode;
+ NodePtr relatedNode;
DOMString uri;
};
/**
*
*/
- CDATASectionImpl(DocumentImpl *owner, const DOMString &value);
+ CDATASectionImpl(DocumentImplPtr owner, const DOMString &value);
/**
*
/**
*
*/
- NotationImpl(DocumentImpl *owner);
+ NotationImpl(DocumentImplPtr owner);
/**
*
/**
*
*/
- EntityImpl(DocumentImpl *owner);
+ EntityImpl(DocumentImplPtr owner);
/**
*
/**
*
*/
- EntityReferenceImpl(DocumentImpl *owner, const DOMString &theName);
+ EntityReferenceImpl(DocumentImplPtr owner, const DOMString &theName);
/**
*
/**
*
*/
-class ProcessingInstructionImpl : public ProcessingInstruction, public NodeImpl
+class ProcessingInstructionImpl :
+ public ProcessingInstruction,
+ public NodeImpl
{
public:
/**
*
*/
- ProcessingInstructionImpl(DocumentImpl *owner,
+ ProcessingInstructionImpl(DocumentImplPtr owner,
const DOMString &target,
const DOMString &data);
/**
*
*/
- DocumentFragmentImpl(DocumentImpl *owner);
+ DocumentFragmentImpl(DocumentImplPtr owner);
/**
*
/**
*
*/
- virtual DocumentType *getDoctype();
+ virtual DocumentTypePtr getDoctype();
/**
*
/**
*
*/
- virtual Element *getDocumentElement();
+ virtual ElementPtr getDocumentElement();
/**
*
*/
- virtual Element *createElement(const DOMString& tagName)
+ virtual ElementPtr createElement(const DOMString& tagName)
throw(DOMException);
/**
*
*/
- virtual DocumentFragment *createDocumentFragment();
+ virtual DocumentFragmentPtr createDocumentFragment();
/**
*
*/
- virtual Text *createTextNode(const DOMString& data);
+ virtual TextPtr createTextNode(const DOMString& data);
/**
*
*/
- virtual Comment *createComment(const DOMString& data);
+ virtual CommentPtr createComment(const DOMString& data);
/**
*
*/
- virtual CDATASection *createCDATASection(const DOMString& data)
+ virtual CDATASectionPtr createCDATASection(const DOMString& data)
throw(DOMException);
/**
*
*/
- virtual ProcessingInstruction *createProcessingInstruction(const DOMString& target,
- const DOMString& data)
- throw(DOMException);
+ virtual ProcessingInstructionPtr createProcessingInstruction(
+ const DOMString& target,
+ const DOMString& data)
+ throw(DOMException);
/**
*
*/
- virtual Attr *createAttribute(const DOMString& name)
+ virtual AttrPtr createAttribute(const DOMString& name)
throw(DOMException);
/**
*
*/
- virtual EntityReference *createEntityReference(const DOMString& name)
+ virtual EntityReferencePtr createEntityReference(const DOMString& name)
throw(DOMException);
/**
/**
*
*/
- virtual Node *importNode(const Node *importedNode,
+ virtual NodePtr importNode(const NodePtr importedNode,
bool deep)
throw(DOMException);
/**
*
*/
- virtual Element *createElementNS(const DOMString& namespaceURI,
+ virtual ElementPtr createElementNS(const DOMString& namespaceURI,
const DOMString& qualifiedName)
throw(DOMException);
/**
*
*/
- virtual Attr *createAttributeNS(const DOMString& namespaceURI,
+ virtual AttrPtr createAttributeNS(const DOMString& namespaceURI,
const DOMString& qualifiedName)
throw(DOMException);
/**
*
*/
- virtual Element *getElementById(const DOMString& elementId);
+ virtual ElementPtr getElementById(const DOMString& elementId);
/**
/**
*
*/
- virtual Node *adoptNode(const Node *source) throw (DOMException);
+ virtual NodePtr adoptNode(const NodePtr source) throw (DOMException);
/**
*
/**
*
*/
- virtual Node *renameNode(const Node *n,
+ virtual NodePtr renameNode(const NodePtr n,
const DOMString &name,
const DOMString &qualifiedName)
throw (DOMException);
//##################
DocumentImpl(const DOMImplementation *domImpl,
- const DOMString &namespaceURI,
- const DOMString &qualifiedName,
- const DocumentType *doctype);
+ const DOMString &namespaceURI,
+ const DOMString &qualifiedName,
+ const DocumentTypePtr doctype);
virtual ~DocumentImpl();
DOMImplementation *parent;
- DOMString *documentURI;
+ DOMString documentURI;
DOMString qualifiedName;
- DocumentType *doctype;
+ DocumentTypePtr doctype;
- ElementImpl *documentElement;
+ ElementImplPtr documentElement;
class NamedElementItem
{
{
next = NULL;
}
- NamedElementItem(const DOMString &nameArg, Element *elemArg)
+ NamedElementItem(const DOMString &nameArg, ElementPtr elemArg)
{
next = NULL;
name = nameArg;
}
NamedElementItem *next;
DOMString name;
- Element *elem;
+ ElementPtr elem;
};
NamedElementItem elementsById;
diff --git a/src/dom/domptr.cpp b/src/dom/domptr.cpp
--- /dev/null
+++ b/src/dom/domptr.cpp
@@ -0,0 +1,86 @@
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "dom.h"
+
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+
+
+
+
+/*#########################################################################
+## NodePtr
+#########################################################################*/
+
+
+
+/**
+ * Increment the ref counter of the wrapped class instance
+ */
+void incrementRefCount(Node *p)
+{
+ if (p)
+ p->_refCnt++;
+}
+
+/**
+ * Decrement the ref counter of the wrapped class instance. Delete
+ * the object if the reference count goes to zero
+ */
+void decrementRefCount(Node *p)
+{
+ if (p)
+ {
+ if (--(p->_refCnt) < 1)
+ delete p;
+ }
+}
+
+
+
+
+} //namespace dom
+} //namespace w3c
+} //namespace org
+
+
+
+/*#########################################################################
+## E N D O F F I L E
+#########################################################################*/
+
+
+
+
diff --git a/src/dom/events.h b/src/dom/events.h
index 5a8fe6ccdf177a48ee9718accc3c84315152bb56..7c9a6f57120b10814da31c16b5d187c7af1e005c 100644 (file)
--- a/src/dom/events.h
+++ b/src/dom/events.h
//Local definitions
typedef dom::DOMString DOMString;
typedef dom::DOMTimeStamp DOMTimeStamp;
-typedef dom::Node Node;
+typedef dom::NodePtr NodePtr ;
/**
*
*/
- virtual Node *getRelatedNode()
- { return relatedNode; }
+ virtual NodePtr getRelatedNodePtr ()
+ { return relatedNodePtr ; }
/**
*
virtual void initMutationEvent(const DOMString &typeArg,
bool canBubbleArg,
bool cancelableArg,
- const Node *relatedNodeArg,
+ const NodePtr relatedNodeArg,
const DOMString &prevValueArg,
const DOMString &newValueArg,
const DOMString &attrNameArg,
const DOMString &typeArg,
bool canBubbleArg,
bool cancelableArg,
- const Node *relatedNodeArg,
+ const NodePtr relatedNodeArg,
const DOMString &prevValueArg,
const DOMString &newValueArg,
const DOMString &attrNameArg,
*/
MutationEvent()
{
- relatedNode = NULL;
+ relatedNodePtr = NULL;
}
/**
*/
MutationEvent(const MutationEvent &other) : Event(other)
{
- relatedNode = other.relatedNode;
+ relatedNodePtr = other.relatedNodePtr ;
prevValue = other.prevValue;
newValue = other.newValue;
attrName = other.attrName;
protected:
- Node *relatedNode;
+ NodePtr relatedNodePtr ;
DOMString prevValue;
DOMString newValue;
DOMString attrName;
virtual void initMutationNameEvent(const DOMString &typeArg,
bool canBubbleArg,
bool cancelableArg,
- const Node *relatedNodeArg,
+ const NodePtr relatedNodeArg,
const DOMString &prevNamespaceURIArg,
const DOMString &prevNodeNameArg)
{
const DOMString &typeArg,
bool canBubbleArg,
bool cancelableArg,
- const Node *relatedNodeArg,
+ const NodePtr relatedNodeArg,
const DOMString &prevNamespaceURIArg,
const DOMString &prevNodeNameArg)
{
MutationNameEvent(const MutationNameEvent &other)
: Event(other), MutationEvent(other)
{
- prevNamespaceURI = other.prevNamespaceURI;
- prevNodeName = other.prevNodeName;
+ prevNamespaceURI = other.prevNamespaceURI;
+ prevNodeName = other.prevNodeName;
}
diff --git a/src/dom/jsbind.cpp b/src/dom/jsbind.cpp
--- a/src/dom/jsbind.cpp
+++ /dev/null
@@ -1,6116 +0,0 @@
- /**
- * Phoebe DOM Implementation.
- *
- * This is a C++ approximation of the W3C DOM model, which follows
- * fairly closely the specifications in the various .idl files, copies of
- * which are provided for reference. Most important is this one:
- *
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
- *
- * Authors:
- * Bob Jamison
- *
- * Copyright (C) 2006 Bob Jamison
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-/**
- * This code provides the ECMAScript (Javascript) binding to the classes
- * of the DOM Level 3 Core. This should provide DOM manipulation for
- * most general-purpose XML and Document-like applications. More specialized
- * applications like SVG should inherit from the core C++ classes, and also
- * use the prototypes in this file as the basis for their bindings.
- *
- * To ensure that we at least attempt to bind ECMAScript to DOM
- * as closely as possible to the standards, we will include the entire
- * Appendix H of the XML Level 3 Core spec as annotations in this file.
- * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding.html
- */
-
-
-
- #include "domimpl.h"
- #include "jsengine.h"
-
- namespace org
- {
- namespace w3c
- {
- namespace dom
- {
-
-
-
-
-//########################################################################
-//# U T I L I T Y
-//########################################################################
-
-//Use this for getting the JavascriptEngine from an object method
-#define ENGINE ((JavascriptEngine *) JS_GetContextPrivate(cx))
-
-
-/**
- * The name of the property is an enumeration, so just return the value.
- */
-static JSBool JSGetEnumProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
-{
- *vp = id;
- return JS_TRUE;
-}
-
-
-static JSString *domToJString(JSContext *cx, const DOMString &s)
-{
- JSString *str = JS_NewStringCopyN(cx, s.c_str(), s.size());
- return str;
-}
-
-static DOMString jvToDomString(JSContext *cx, jsval s)
-{
- JSString *jstr = JS_ValueToString(cx, s);
- DOMString str = JS_GetStringBytes(jstr);
- return str;
-}
-
-static DOMString jToDomString(JSString *s)
-{
- DOMString str = JS_GetStringBytes(s);
- return str;
-}
-
-
-//########################################################################
-//# C L A S S E S
-//########################################################################
-
-
-/**
- * Appendix H: ECMAScript Language Binding
- *
- * This appendix contains the complete ECMAScript [ECMAScript] binding for the
- * Level 3 Document Object Model Core definitions. H.1 ECMAScript Binding
- * Extension
- *
- */
-
-
-//########################################################################
-//# DOMImplementationRegistry
-//########################################################################
-
-/**
- * This section defines the DOMImplementationRegistry object, discussed in
- * Bootstrapping, for ECMAScript.
- *
- *
- * Objects that implements the DOMImplementationRegistry interface
- *
- * DOMImplementationRegistry is a global variable which has the following
- * functions:
- *
- * getDOMImplementation(features)
- * This method returns the first registered object that implements
- * the DOMImplementation interface and has the desired features,
- * or null if none is found. The features parameter is a String.
- * See also DOMImplementationSource.getDOMImplementation().
- *
- * getDOMImplementationList(features)
- * This method returns a DOMImplementationList list of registered
- * object that implements the DOMImplementation interface and
- * has the desired features. The features parameter is a String.
- * See also DOMImplementationSource.getDOMImplementationList().
- *
- *
- */
-
-class ECMA_DOMImplementationRegistry
-{
-public:
-
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- //DOMException *p = new DOMException(JSVAL_TO_INT( argv[0] ));
- //if ( ! JS_SetPrivate(cx, obj, p) )
- // return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- //DOMException *p = (DOMException *) JS_GetPrivate(cx, obj);
- //delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getDOMImplementation(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getDOMImplementationList(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_DOMImplementationRegistry::classDef =
-{
- "DOMImplementationRegistry",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_DOMImplementationRegistry::properties[] =
-{
- { 0 }
-};
-
-JSFunctionSpec ECMA_DOMImplementationRegistry::methods[] =
-{
- { "getDOMImplementation", getDOMImplementation, 1, 0, 0 },
- { "getDOMImplementationList", getDOMImplementationList, 1, 0, 0 },
- { 0 }
-};
-
-
-
-
-
-
-/**
- * H.2 Other Core interfaces
- */
-
-
-
-
-//########################################################################
-//# DOMException
-//########################################################################
-
-/**
- * Properties of the DOMException Constructor function:
- *
- * DOMException.INDEX_SIZE_ERR
- * The value of the constant DOMException.INDEX_SIZE_ERR is 1.
- * DOMException.DOMSTRING_SIZE_ERR
- * The value of the constant DOMException.DOMSTRING_SIZE_ERR is 2.
- * DOMException.HIERARCHY_REQUEST_ERR
- * The value of the constant DOMException.HIERARCHY_REQUEST_ERR is 3.
- * DOMException.WRONG_DOCUMENT_ERR
- * The value of the constant DOMException.WRONG_DOCUMENT_ERR is 4.
- * DOMException.INVALID_CHARACTER_ERR
- * The value of the constant DOMException.INVALID_CHARACTER_ERR is 5.
- * DOMException.NO_DATA_ALLOWED_ERR
- * The value of the constant DOMException.NO_DATA_ALLOWED_ERR is 6.
- * DOMException.NO_MODIFICATION_ALLOWED_ERR
- * The value of the constant DOMException.NO_MODIFICATION_ALLOWED_ERR is 7.
- * DOMException.NOT_FOUND_ERR
- * The value of the constant DOMException.NOT_FOUND_ERR is 8.
- * DOMException.NOT_SUPPORTED_ERR
- * The value of the constant DOMException.NOT_SUPPORTED_ERR is 9.
- * DOMException.INUSE_ATTRIBUTE_ERR
- * The value of the constant DOMException.INUSE_ATTRIBUTE_ERR is 10.
- * DOMException.INVALID_STATE_ERR
- * The value of the constant DOMException.INVALID_STATE_ERR is 11.
- * DOMException.SYNTAX_ERR
- * The value of the constant DOMException.SYNTAX_ERR is 12.
- * DOMException.INVALID_MODIFICATION_ERR
- * The value of the constant DOMException.INVALID_MODIFICATION_ERR is 13.
- * DOMException.NAMESPACE_ERR
- * The value of the constant DOMException.NAMESPACE_ERR is 14.
- * DOMException.INVALID_ACCESS_ERR
- * The value of the constant DOMException.INVALID_ACCESS_ERR is 15.
- * DOMException.VALIDATION_ERR
- * The value of the constant DOMException.VALIDATION_ERR is 16.
- * DOMException.TYPE_MISMATCH_ERR
- * The value of the constant DOMException.TYPE_MISMATCH_ERR is 17.
- *
- * Objects that implement the DOMException interface:
- *
- * Properties of objects that implement the DOMException interface:
- *
- * code
- * This property is a Number.
- *
- */
-
-class ECMA_DOMException
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- DOMException *p = new DOMException(JSVAL_TO_INT( argv[0] ));
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- staticProperties, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- DOMException *p = (DOMException *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- if (!JSVAL_IS_INT(id))
- return JS_FALSE;
- int index = JSVAL_TO_INT(id);
- DOMException *p = (DOMException *) JS_GetPrivate(cx, obj);
- switch( index )
- {
- case prop_code:
- {
- *vp = INT_TO_JSVAL(p->code);
- return JS_TRUE;
- }
- }
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- if (!JSVAL_IS_INT(id))
- return JS_FALSE;
- int index = JSVAL_TO_INT( id );
- DOMException *p = (DOMException *) JS_GetPrivate(cx, obj);
- switch( index )
- {
- case prop_code:
- {
- p->code = JSVAL_TO_INT( *vp );
- return JS_TRUE;
- }
- }
- return JS_FALSE;
- }
-
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- enum
- {
- prop_code
- };
- static JSPropertySpec properties[];
- static JSPropertySpec staticProperties[];
- static JSFunctionSpec methods[];
- static JSFunctionSpec staticMethods[];
-
-};
-
-JSClass ECMA_DOMException::classDef =
-{
- "Node",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_DOMException::properties[] =
-{
- { "code", prop_code, JSPROP_ENUMERATE },
- { 0 }
-};
-
-JSPropertySpec ECMA_DOMException::staticProperties[] =
-{
- { "INDEX_SIZE_ERR", DOMException::INDEX_SIZE_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DOMSTRING_SIZE_ERR", DOMException::DOMSTRING_SIZE_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "HIERARCHY_REQUEST_ERR", DOMException::HIERARCHY_REQUEST_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "WRONG_DOCUMENT_ERR", DOMException::WRONG_DOCUMENT_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "INVALID_CHARACTER_ERR", DOMException::INVALID_CHARACTER_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "NO_DATA_ALLOWED_ERR", DOMException::NO_DATA_ALLOWED_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "NO_MODIFICATION_ALLOWED_ERR", DOMException::NO_MODIFICATION_ALLOWED_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "NOT_FOUND_ERR", DOMException::NOT_FOUND_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "NOT_SUPPORTED_ERR", DOMException::NOT_SUPPORTED_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "INUSE_ATTRIBUTE_ERR", DOMException::INUSE_ATTRIBUTE_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "INVALID_STATE_ERR", DOMException::INVALID_STATE_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "SYNTAX_ERR", DOMException::SYNTAX_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "INVALID_MODIFICATION_ERR", DOMException::INVALID_MODIFICATION_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "NAMESPACE_ERR", DOMException::NAMESPACE_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "INVALID_ACCESS_ERR", DOMException::INVALID_ACCESS_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "VALIDATION_ERR", DOMException::VALIDATION_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "TYPE_MISMATCH_ERR", DOMException::TYPE_MISMATCH_ERR,
- JSPROP_READONLY, JSGetEnumProperty },
- { 0 }
-};
-
-JSFunctionSpec ECMA_DOMException::methods[] =
-{
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# DOMStringList
-//########################################################################
-
-/**
- * Objects that implement the DOMStringList interface:
- *
- * Properties of objects that implement the DOMStringList interface:
- *
- * length
- * This read-only property is a Number.
- *
- * Functions of objects that implement the DOMStringList interface:
- *
- * item(index)
- * This function returns a String.
- * The index parameter is a Number.
- * Note: This object can also be dereferenced using square bracket
- * notation (e.g. obj[1]). Dereferencing with an integer index
- * is equivalent to invoking the item function with that index.
- *
- * contains(str)
- * This function returns a Boolean.
- * The str parameter is a String.
- *
- */
-
-class ECMA_DOMStringList
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- DOMStringList *p = new DOMStringList();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- DOMStringList *p = (DOMStringList *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Use this one for list[index] lookup
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- if (!JSVAL_IS_INT(id))
- return JS_TRUE;
- int index = JSVAL_TO_INT(id);
- DOMStringList *p = (DOMStringList *) JS_GetPrivate(cx, obj);
- JSString *jstr = domToJString(cx, p->item(index));
- *vp = STRING_TO_JSVAL(jstr);
- return JS_FALSE;
- }
-
- /**
- * JSGetProperty - Use this one for enumerated property names
- */
- static JSBool JSGetNamedProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- if (JSVAL_IS_INT(id))
- {
- DOMStringList *p = (DOMStringList *) JS_GetPrivate(cx, obj);
- if (JSVAL_TO_INT(id) == prop_length)
- {
- *vp = JSVAL_TO_INT(p->getLength());
- return JS_TRUE;
- }
- }
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool item(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- uint32 index;
- if (!JS_ConvertArguments(cx, argc, argv, "u", &index))
- return JS_FALSE;
- DOMStringList *p = (DOMStringList *) JS_GetPrivate(cx, obj);
- *rval = STRING_TO_JSVAL(domToJString(cx, p->item(index)));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool contains(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *str;
- if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
- return JS_FALSE;
- DOMStringList *p = (DOMStringList *) JS_GetPrivate(cx, obj);
- *rval = BOOLEAN_TO_JSVAL(p->contains( jToDomString(str)));
- return JS_TRUE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- enum
- {
- prop_length
- };
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_DOMStringList::classDef =
-{
- "DOMStringList",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_DOMStringList::properties[] =
-{
- { "length", prop_length, JSPROP_READONLY, JSGetNamedProperty },
- { 0 }
-};
-
-JSFunctionSpec ECMA_DOMStringList::methods[] =
-{
- { "item", item, 1, 0, 0 },
- { "contains", contains, 1, 0, 0 },
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# NameList
-//########################################################################
-
-/**
- * Objects that implement the NameList interface:
- *
- * Properties of objects that implement the NameList interface:
- *
- * length
- * This read-only property is a Number.
- *
- * Functions of objects that implement the NameList interface:
- *
- * getName(index)
- * This function returns a String.
- * The index parameter is a Number.
- * getNamespaceURI(index)
- * This function returns a String.
- * The index parameter is a Number.
- * contains(str)
- * This function returns a Boolean.
- * The str parameter is a String.
- * containsNS(namespaceURI, name)
- * This function returns a Boolean.
- * The namespaceURI parameter is a String.
- * The name parameter is a String.
- */
-
-class ECMA_NameList
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- NameList *p = new NameList();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- NameList *p = (NameList *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- if (!JSVAL_IS_INT(id))
- return JS_TRUE;
- int index = JSVAL_TO_INT(id);
- NameList *p = (NameList *) JS_GetPrivate(cx, obj);
- switch (index)
- {
- case prop_length:
- *vp = INT_TO_JSVAL(p->getLength());
- return JS_TRUE;
- }
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getName(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- uint32 index;
- if (!JS_ConvertArguments(cx, argc, argv, "u", &index))
- return JS_FALSE;
- NameList *p = (NameList *) JS_GetPrivate(cx, obj);
- *rval = STRING_TO_JSVAL(domToJString(cx, p->getName(index)));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool getNamespaceURI(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- uint32 index;
- if (!JS_ConvertArguments(cx, argc, argv, "u", &index))
- return JS_FALSE;
- NameList *p = (NameList *) JS_GetPrivate(cx, obj);
- *rval = STRING_TO_JSVAL(domToJString(cx, p->getNamespaceURI(index)));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool contains(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *str;
- if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
- return JS_FALSE;
- NameList *p = (NameList *) JS_GetPrivate(cx, obj);
- *rval = BOOLEAN_TO_JSVAL(p->contains( jToDomString(str)));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool containsNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *ns; JSString *name;
- if (!JS_ConvertArguments(cx, argc, argv, "SS", &ns, &name))
- return JS_FALSE;
- NameList *p = (NameList *) JS_GetPrivate(cx, obj);
- *rval = BOOLEAN_TO_JSVAL(
- p->containsNS(jToDomString(ns), jToDomString(name)));
- return JS_TRUE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- enum
- {
- prop_length
- };
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_NameList::classDef =
-{
- "NameList",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_NameList::properties[] =
-{
- { "length", prop_length, JSPROP_READONLY },
- { 0 }
-};
-
-JSFunctionSpec ECMA_NameList::methods[] =
-{
- { "getName", getName, 1, 0, 0 },
- { "getNamespaceURI", getNamespaceURI, 1, 0, 0 },
- { "contains", contains, 1, 0, 0 },
- { "containsNS", containsNS, 2, 0, 0 },
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# DOMImplementationList
-//########################################################################
-
-/**
- * Objects that implement the DOMImplementationList interface:
- *
- * Properties of objects that implement the DOMImplementationList interface:
- *
- * length
- * This read-only property is a Number.
- *
- * Functions of objects that implement the DOMImplementationList interface:
- *
- * item(index)
- * This function returns an object that implements the
- * DOMImplementation interface.
- * The index parameter is a Number.
- * Note: This object can also be dereferenced using square bracket
- * notation (e.g. obj[1]). Dereferencing with an integer index
- * is equivalent to invoking the item function with that index.
- *
- *
- */
-
-class ECMA_DOMImplementationList
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- DOMImplementationList *p = new DOMImplementationList();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- DOMImplementationList *p =
- (DOMImplementationList *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Use this one for list[index] lookup
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- if (!JSVAL_IS_INT(id))
- return JS_TRUE;
- int index = JSVAL_TO_INT(id);
- DOMImplementationList *p =
- (DOMImplementationList *) JS_GetPrivate(cx, obj);
- DOMImplementation *di = p->item(index);
- *vp = OBJECT_TO_JSVAL(ENGINE->new_DOMImplementation(di));
- return JS_FALSE;
- }
-
- /**
- * JSGetProperty - Use this one for enumerated property names
- */
- static JSBool JSGetNamedProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- if (!JSVAL_IS_INT(id))
- return JS_TRUE;
- int index = JSVAL_TO_INT(id);
- DOMImplementationList *p =
- (DOMImplementationList *) JS_GetPrivate(cx, obj);
- switch (index)
- {
- case prop_length:
- *vp = INT_TO_JSVAL(p->getLength());
- return JS_TRUE;
- }
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool item(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- uint32 index;
- if (!JS_ConvertArguments(cx, argc, argv, "u", &index))
- return JS_FALSE;
- DOMImplementationList *p =
- (DOMImplementationList *) JS_GetPrivate(cx, obj);
- DOMImplementation *di = p->item(index);
- *rval = OBJECT_TO_JSVAL(ENGINE->new_DOMImplementation(di));
- return JS_TRUE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- enum
- {
- prop_length
- };
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_DOMImplementationList::classDef =
-{
- "DOMImplementationRegistry",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_DOMImplementationList::properties[] =
-{
- { "length", prop_length, JSPROP_READONLY, JSGetNamedProperty },
- { 0 }
-};
-
-JSFunctionSpec ECMA_DOMImplementationList::methods[] =
-{
- { "item", item, 1, 0, 0 },
- { 0 }
-};
-
-
-
-
-
-
-//########################################################################
-//# DOMImplementationSource
-//########################################################################
-
-/**
- * Objects that implement the DOMImplementationSource interface:
- *
- * Functions of objects that implement the DOMImplementationSource interface:
- *
- * getDOMImplementation(features)
- * This function returns an object that implements the
- * DOMImplementation interface.
- * The features parameter is a String.
- * getDOMImplementationList(features)
- * This function returns an object that implements the
- * DOMImplementationList interface.
- * The features parameter is a String.
- */
-
-class ECMA_DOMImplementationSource
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- DOMImplementationSource *p = new DOMImplementationSourceImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- DOMImplementationSource *p =
- (DOMImplementationSource *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- //#######################
- //# M E T H O D S
- //#######################
-
- /**
- *
- */
- static JSBool getDOMImplementation(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *feature;
- if (!JS_ConvertArguments(cx, argc, argv, "S", &feature))
- return JS_FALSE;
- DOMImplementationSource *p =
- (DOMImplementationSource *) JS_GetPrivate(cx, obj);
- DOMImplementation *di =
- p->getDOMImplementation(jToDomString(feature));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_DOMImplementation(di));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool getDOMImplementationList(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *feature;
- if (!JS_ConvertArguments(cx, argc, argv, "S", &feature))
- return JS_FALSE;
- DOMImplementationSource *p =
- (DOMImplementationSource *) JS_GetPrivate(cx, obj);
- DOMImplementationList di =
- p->getDOMImplementationList(jToDomString(feature));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_DOMImplementationList(&di));
- return JS_TRUE;
- }
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_DOMImplementationSource::classDef =
-{
- "DOMImplementationSource",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_DOMImplementationSource::properties[] =
-{
- { 0 }
-};
-
-JSFunctionSpec ECMA_DOMImplementationSource::methods[] =
-{
- { "getDOMImplementation", getDOMImplementation, 1, 0, 0 },
- { "getDOMImplementationList", getDOMImplementationList, 1, 0, 0 },
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# DOMImplementation
-//########################################################################
-
-/**
- * Objects that implement the DOMImplementation interface:
- *
- * Functions of objects that implement the DOMImplementation interface:
- *
- * hasFeature(feature, version)
- * This function returns a Boolean.
- * The feature parameter is a String.
- * The version parameter is a String.
- * createDocumentType(qualifiedName, publicId, systemId)
- * This function returns an object that implements the
- * DocumentType interface.
- * The qualifiedName parameter is a String.
- * The publicId parameter is a String.
- * The systemId parameter is a String.
- * This function can raise an object that implements the
- * DOMException interface.
- * createDocument(namespaceURI, qualifiedName, doctype)
- * This function returns an object that implements the
- * Document interface.
- * The namespaceURI parameter is a String.
- * The qualifiedName parameter is a String.
- * The doctype parameter is an object that implements the
- * DocumentType interface.
- * This function can raise an object that implements the
- * DOMException interface.
- * getFeature(feature, version)
- * This function returns an object that implements
- * the Object interface.
- * The feature parameter is a String.
- * The version parameter is a String.
- */
-
-class ECMA_DOMImplementation
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- DOMImplementation *p = new DOMImplementationImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- DOMImplementation *p = (DOMImplementation *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- //#######################
- //# M E T H O D S
- //#######################
-
- /**
- *
- */
- static JSBool hasFeature(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool createDocumentType(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool createDocument(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getFeature(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_DOMImplementation::classDef =
-{
- "DOMImplementation",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_DOMImplementation::properties[] =
-{
- { 0 }
-};
-
-JSFunctionSpec ECMA_DOMImplementation::methods[] =
-{
- { "hasFeature", hasFeature, 2, 0, 0 },
- { "createDocumentType", createDocumentType, 3, 0, 0 },
- { "createDocument", createDocument, 3, 0, 0 },
- { "getFeature", getFeature, 2, 0, 0 },
- { 0 }
-};
-
-
-
-
-//########################################################################
-//# DocumentFragment
-//########################################################################
-
-/**
- * Objects that implement the DocumentFragment interface:
- *
- * Objects that implement the DocumentFragment interface have all
- * properties and functions of the Node interface.
- */
-
-class ECMA_DocumentFragment
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- DocumentFragment *p = new DocumentFragmentImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- DocumentFragment *p = (DocumentFragment *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_DocumentFragment::classDef =
-{
- "DocumentFragment",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_DocumentFragment::properties[] =
-{
- { 0 }
-};
-
-JSFunctionSpec ECMA_DocumentFragment::methods[] =
-{
- { 0 }
-};
-
-
-
-
-
-
-
-//########################################################################
-//# Document
-//########################################################################
-
-/**
- * Objects that implement the Document interface:
- *
- * Objects that implement the Document interface have all properties
- * and functions of the Node interface as well as the properties
- * and functions defined below.
- * Properties of objects that implement the Document interface:
- *
- *
- * doctype
- * This read-only property is an object that implements
- * the DocumentType interface.
- * implementation
- * This read-only property is an object that implements
- * the DOMImplementation interface.
- * documentElement
- * This read-only property is an object that implements
- * the Element interface.
- * inputEncoding
- * This read-only property is a String.
- * xmlEncoding
- * This read-only property is a String.
- * xmlStandalone
- * This property is a Boolean and can raise an object
- * that implements the DOMException interface on setting.
- * xmlVersion
- * This property is a String and can raise an object
- * that implements the DOMException interface on setting.
- * strictErrorChecking
- * This property is a Boolean.
- * documentURI
- * This property is a String.
- * domConfig
- * This read-only property is an object that implements
- * the DOMConfiguration interface.
- *
- *
- * Functions of objects that implement the Document interface:
- *
- * createElement(tagName)
- * This function returns an object that implements
- * the Element interface.
- * The tagName parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * createDocumentFragment()
- * This function returns an object that implements
- * the DocumentFragment interface.
- * createTextNode(data)
- * This function returns an object that implements
- * the Text interface.
- * The data parameter is a String.
- * createComment(data)
- * This function returns an object that implements
- * the Comment interface.
- * The data parameter is a String.
- * createCDATASection(data)
- * This function returns an object that implements
- * the CDATASection interface.
- * The data parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * createProcessingInstruction(target, data)
- * This function returns an object that implements
- * the ProcessingInstruction interface.
- * The target parameter is a String.
- * The data parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * createAttribute(name)
- * This function returns an object that implements
- * the Attr interface.
- * The name parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * createEntityReference(name)
- * This function returns an object that implements
- * the EntityReference interface.
- * The name parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * getElementsByTagName(tagname)
- * This function returns an object that implements
- * the NodeList interface.
- * The tagname parameter is a String.
- * importNode(importedNode, deep)
- * This function returns an object that implements
- * the Node interface.
- * The importedNode parameter is an object that implements
- * the Node interface.
- * The deep parameter is a Boolean.
- * This function can raise an object that implements
- * the DOMException interface.
- * createElementNS(namespaceURI, qualifiedName)
- * This function returns an object that implements
- * the Element interface.
- * The namespaceURI parameter is a String.
- * The qualifiedName parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * createAttributeNS(namespaceURI, qualifiedName)
- * This function returns an object that implements
- * the Attr interface.
- * The namespaceURI parameter is a String.
- * The qualifiedName parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * getElementsByTagNameNS(namespaceURI, localName)
- * This function returns an object that implements
- * the NodeList interface.
- * The namespaceURI parameter is a String.
- * The localName parameter is a String.
- * getElementById(elementId)
- * This function returns an object that implements
- * the Element interface.
- * The elementId parameter is a String.
- * adoptNode(source)
- * This function returns an object that implements
- * the Node interface.
- * The source parameter is an object that implements
- * the Node interface.
- * This function can raise an object that implements
- * the DOMException interface.
- * normalizeDocument()
- * This function has no return value.
- * renameNode(n, namespaceURI, qualifiedName)
- * This function returns an object that implements
- * the Node interface.
- * The n parameter is an object that implements
- * the Node interface.
- * The namespaceURI parameter is a String.
- * The qualifiedName parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- */
-
-class ECMA_Document
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- //Document *p = new DocumentImpl();
- //if ( ! JS_SetPrivate(cx, obj, p) )
- // return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- Document *p = (Document *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- if (!JSVAL_IS_INT(id))
- return JS_FALSE;
- int index = JSVAL_TO_INT(id);
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- switch (index)
- {
- case prop_doctype:
- {
- DocumentType *p = d->getDoctype();
- *vp = OBJECT_TO_JSVAL(ENGINE->new_DocumentType(p));
- return JS_TRUE;
- }
- case prop_implementation:
- {
- DOMImplementation *p = d->getImplementation();
- *vp = OBJECT_TO_JSVAL(ENGINE->new_DOMImplementation(p));
- return JS_TRUE;
- }
- case prop_documentElement:
- {
- Element *p = d->getDocumentElement();
- *vp = OBJECT_TO_JSVAL(ENGINE->new_Element(p));
- return JS_TRUE;
- }
- case prop_inputEncoding:
- {
- DOMString p = d->getInputEncoding();
- *vp = OBJECT_TO_JSVAL(domToJString(cx, p));
- return JS_TRUE;
- }
- case prop_xmlEncoding:
- {
- DOMString p = d->getXmlEncoding();
- *vp = OBJECT_TO_JSVAL(domToJString(cx, p));
- return JS_TRUE;
- }
- case prop_xmlStandalone:
- {
- *vp = BOOLEAN_TO_JSVAL(d->getXmlStandalone());
- return JS_TRUE;
- }
- case prop_xmlVersion:
- {
- DOMString p = d->getXmlVersion();
- *vp = OBJECT_TO_JSVAL(domToJString(cx, p));
- return JS_TRUE;
- }
- case prop_strictErrorChecking:
- {
- *vp = BOOLEAN_TO_JSVAL(d->getStrictErrorChecking());
- return JS_TRUE;
- }
- case prop_documentURI:
- {
- DOMString p = d->getDocumentURI();
- *vp = OBJECT_TO_JSVAL(domToJString(cx, p));
- return JS_TRUE;
- }
- case prop_domConfig:
- {
- DOMConfiguration *p = d->getDomConfig();
- *vp = OBJECT_TO_JSVAL(ENGINE->new_DOMConfiguration(p));
- return JS_TRUE;
- }
- }
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- if (!JSVAL_IS_INT(id))
- return JS_FALSE;
- int index = JSVAL_TO_INT(id);
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- switch (index)
- {
- case prop_xmlStandalone:
- {
- d->setXmlStandalone(JSVAL_TO_BOOLEAN(*vp));
- return JS_TRUE;
- }
- case prop_xmlVersion:
- {
- d->setXmlVersion(jvToDomString(cx, *vp));
- return JS_TRUE;
- }
- case prop_strictErrorChecking:
- {
- d->setStrictErrorChecking(JSVAL_TO_BOOLEAN(*vp));
- return JS_TRUE;
- }
- case prop_documentURI:
- {
- d->setDocumentURI(jvToDomString(cx, *vp));
- return JS_TRUE;
- }
- }
- return JS_FALSE;
- }
-
-
- //#######################
- //# M E T H O D S
- //#######################
-
- /**
- *
- */
- static JSBool createElement(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *str;
- if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- Element *p = d->createElement(jToDomString(str));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_Element(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool createDocumentFragment(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- DocumentFragment *p = d->createDocumentFragment();
- *rval = OBJECT_TO_JSVAL(ENGINE->new_DocumentFragment(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool createTextNode(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *str;
- if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- Text *p = d->createTextNode(jToDomString(str));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_Text(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool createComment(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *str;
- if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- Comment *p = d->createComment(jToDomString(str));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_Comment(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool createCDATASection(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *str;
- if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- CDATASection *p = d->createCDATASection(jToDomString(str));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_CDATASection(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool createProcessingInstruction(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *name; JSString *data;
- if (!JS_ConvertArguments(cx, argc, argv, "SS", &name, &data))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- ProcessingInstruction *p =
- d->createProcessingInstruction(jToDomString(name), jToDomString(data));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_ProcessingInstruction(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool createAttribute(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *str;
- if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- Attr *p = d->createAttribute(jToDomString(str));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_Attr(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool createEntityReference(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *str;
- if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- EntityReference *p = d->createEntityReference(jToDomString(str));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_EntityReference(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool getElementsByTagName(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *str;
- if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- NodeList p = d->getElementsByTagName(jToDomString(str));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_NodeList(&p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool importNode(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSObject *impnode; JSBool deep;
- if (!JS_ConvertArguments(cx, argc, argv, "ou", &impnode, &deep))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- Node *n = (Node *)JS_GetPrivate(cx, impnode);
- Node *p = d->importNode(n, deep);
- *rval = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool createElementNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *ns; JSString *name;
- if (!JS_ConvertArguments(cx, argc, argv, "SS", &ns, &name))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- Element *p =
- d->createElementNS(jToDomString(ns), jToDomString(name));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_Element(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool createAttributeNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *ns; JSString *name;
- if (!JS_ConvertArguments(cx, argc, argv, "SS", &ns, &name))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- Attr *p =
- d->createAttributeNS(jToDomString(ns), jToDomString(name));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_Attr(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool getElementsByTagNameNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *ns; JSString *name;
- if (!JS_ConvertArguments(cx, argc, argv, "SS", &ns, &name))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- NodeList p =
- d->getElementsByTagNameNS(jToDomString(ns), jToDomString(name));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_NodeList(&p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool getElementById(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSString *str;
- if (!JS_ConvertArguments(cx, argc, argv, "S", &str))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- Element *p = d->getElementById(jToDomString(str));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_Element(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool adoptNode(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSObject *impnode;
- if (!JS_ConvertArguments(cx, argc, argv, "o", &impnode))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- Node *n = (Node *)JS_GetPrivate(cx, impnode);
- Node *p = d->adoptNode(n);
- *rval = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool normalizeDocument(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- d->normalizeDocument();
- return JS_TRUE;
- }
-
- /**
- *
- */
- static JSBool renameNode(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- JSObject *rnode; JSString *nsuri; JSString *qname;
- if (!JS_ConvertArguments(cx, argc, argv, "oSS", &rnode, &nsuri, &qname))
- return JS_FALSE;
- Document *d = (Document *)JS_GetPrivate(cx, obj);
- Node *n = (Node *)JS_GetPrivate(cx, rnode);
- Node *p = d->renameNode(n, jToDomString(nsuri), jToDomString(qname));
- *rval = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
- return JS_TRUE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- enum
- {
- prop_doctype,
- prop_implementation,
- prop_documentElement,
- prop_inputEncoding,
- prop_xmlEncoding,
- prop_xmlStandalone,
- prop_xmlVersion,
- prop_strictErrorChecking,
- prop_documentURI,
- prop_domConfig
- };
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_Document::classDef =
-{
- "Document",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_Document::properties[] =
-{
- { "doctype", prop_doctype,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "implementation", prop_implementation,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "documentElement", prop_documentElement,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "inputEncoding", prop_inputEncoding,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "xmlEncoding", prop_xmlEncoding,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "xmlStandalone", prop_xmlStandalone,
- JSPROP_ENUMERATE },
- { "xmlVersion", prop_xmlVersion,
- JSPROP_ENUMERATE },
- { "strictErrorChecking", prop_strictErrorChecking,
- JSPROP_ENUMERATE },
- { "documentURI", prop_documentURI,
- JSPROP_ENUMERATE },
- { "domConfig", prop_domConfig,
- JSPROP_ENUMERATE },
- { 0 }
-};
-
-JSFunctionSpec ECMA_Document::methods[] =
-{
- { "createElement", createElement, 1, 0, 0 },
- { "createDocumentFragment", createDocumentFragment, 0, 0, 0 },
- { "createTextNode", createTextNode, 1, 0, 0 },
- { "createComment", createComment, 1, 0, 0 },
- { "createCDATASection", createCDATASection, 1, 0, 0 },
- { "createProcessingInstruction", createProcessingInstruction, 2, 0, 0 },
- { "createAttribute", createAttribute, 1, 0, 0 },
- { "createEntityReference", createEntityReference, 1, 0, 0 },
- { "getElementsByTagName", getElementsByTagName, 1, 0, 0 },
- { "importNode", importNode, 2, 0, 0 },
- { "createElementNS", createElementNS, 2, 0, 0 },
- { "createAttributeNS", createAttributeNS, 2, 0, 0 },
- { "getElementsByTagNameNS", getElementsByTagNameNS, 2, 0, 0 },
- { "getElementById", getElementById, 1, 0, 0 },
- { "adoptNode", adoptNode, 1, 0, 0 },
- { "normalizeDocument", normalizeDocument, 0, 0, 0 },
- { "renameNode", renameNode, 3, 0, 0 },
- { 0 }
-};
-
-
-
-
-
-
-//########################################################################
-//# Node
-//########################################################################
-
-/**
- * Properties of the Node Constructor function:
- *
- * Node.ELEMENT_NODE
- * The value of the constant Node.ELEMENT_NODE is 1.
- * Node.ATTRIBUTE_NODE
- * The value of the constant Node.ATTRIBUTE_NODE is 2.
- * Node.TEXT_NODE
- * The value of the constant Node.TEXT_NODE is 3.
- * Node.CDATA_SECTION_NODE
- * The value of the constant Node.CDATA_SECTION_NODE is 4.
- * Node.ENTITY_REFERENCE_NODE
- * The value of the constant Node.ENTITY_REFERENCE_NODE is 5.
- * Node.ENTITY_NODE
- * The value of the constant Node.ENTITY_NODE is 6.
- * Node.PROCESSING_INSTRUCTION_NODE
- * The value of the constant Node.PROCESSING_INSTRUCTION_NODE is 7.
- * Node.COMMENT_NODE
- * The value of the constant Node.COMMENT_NODE is 8.
- * Node.DOCUMENT_NODE
- * The value of the constant Node.DOCUMENT_NODE is 9.
- * Node.DOCUMENT_TYPE_NODE
- * The value of the constant Node.DOCUMENT_TYPE_NODE is 10.
- * Node.DOCUMENT_FRAGMENT_NODE
- * The value of the constant Node.DOCUMENT_FRAGMENT_NODE is 11.
- * Node.NOTATION_NODE
- * The value of the constant Node.NOTATION_NODE is 12.
- * Node.DOCUMENT_POSITION_DISCONNECTED
- * The value of the constant Node.DOCUMENT_POSITION_DISCONNECTED
- * is 0x01.
- * Node.DOCUMENT_POSITION_PRECEDING
- * The value of the constant Node.DOCUMENT_POSITION_PRECEDING
- * is 0x02.
- * Node.DOCUMENT_POSITION_FOLLOWING
- * The value of the constant Node.DOCUMENT_POSITION_FOLLOWING
- * is 0x04.
- * Node.DOCUMENT_POSITION_CONTAINS
- * The value of the constant Node.DOCUMENT_POSITION_CONTAINS
- * is 0x08.
- * Node.DOCUMENT_POSITION_CONTAINED_BY
- * The value of the constant Node.DOCUMENT_POSITION_CONTAINED_BY
- * is 0x10.
- * Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
- * The value of the constant Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
- * is 0x20.
- *
- * Objects that implement the Node interface:
- *
- * Properties of objects that implement the Node interface:
- *
- * nodeName
- * This read-only property is a String.
- * nodeValue
- * This property is a String, can raise an object that implements
- * the DOMException
- * interface on setting and can raise an object that implements
- * the DOMException
- * interface on retrieval.
- * nodeType
- * This read-only property is a Number.
- * parentNode
- * This read-only property is an object that implements
- * the Node interface.
- * childNodes
- * This read-only property is an object that implements
- * the NodeList interface.
- * firstChild
- * This read-only property is an object that implements
- * the Node interface.
- * lastChild
- * This read-only property is an object that implements
- * the Node interface.
- * previousSibling
- * This read-only property is an object that implements
- * the Node interface.
- * nextSibling
- * This read-only property is an object that implements
- * the Node interface.
- * attributes
- * This read-only property is an object that implements
- * the NamedNodeMap interface.
- * ownerDocument
- * This read-only property is an object that implements
- * the Document interface.
- * namespaceURI
- * This read-only property is a String.
- * prefix
- * This property is a String and can raise an object
- * that implements the DOMException interface on setting.
- * localName
- * This read-only property is a String.
- * baseURI
- * This read-only property is a String.
- * textContent
- * This property is a String, can raise an object that implements
- * the DOMException interface on setting and can raise
- * an object that implements the DOMException interface
- * on retrieval.
- *
- *
- * Functions of objects that implement the Node interface:
- *
- * insertBefore(newChild, refChild)
- * This function returns an object that implements
- * the Node interface.
- * The newChild parameter is an object that implements
- * the Node interface.
- * The refChild parameter is an object that implements
- * the Node interface.
- * This function can raise an object that implements
- * the DOMException interface.
- * replaceChild(newChild, oldChild)
- * This function returns an object that implements
- * the Node interface.
- * The newChild parameter is an object that implements
- * the Node interface.
- * The oldChild parameter is an object that implements
- * the Node interface.
- * This function can raise an object that implements
- * the DOMException interface.
- * removeChild(oldChild)
- * This function returns an object that implements
- * the Node interface.
- * The oldChild parameter is an object that implements
- * the Node interface.
- * This function can raise an object that implements
- * the DOMException interface.
- * appendChild(newChild)
- * This function returns an object that implements
- * the Node interface.
- * The newChild parameter is an object that implements
- * the Node interface.
- * This function can raise an object that implements
- * the DOMException interface.
- * hasChildNodes()
- * This function returns a Boolean.
- * cloneNode(deep)
- * This function returns an object that implements
- * the Node interface.
- * The deep parameter is a Boolean.
- * normalize()
- * This function has no return value.
- * isSupported(feature, version)
- * This function returns a Boolean.
- * The feature parameter is a String.
- * The version parameter is a String.
- * hasAttributes()
- * This function returns a Boolean.
- * compareDocumentPosition(other)
- * This function returns a Number.
- * The other parameter is an object that implements
- * the Node interface.
- * This function can raise an object that implements
- * the DOMException interface.
- * isSameNode(other)
- * This function returns a Boolean.
- * The other parameter is an object that implements
- * the Node interface.
- * lookupPrefix(namespaceURI)
- * This function returns a String.
- * The namespaceURI parameter is a String.
- * isDefaultNamespace(namespaceURI)
- * This function returns a Boolean.
- * The namespaceURI parameter is a String.
- * lookupNamespaceURI(prefix)
- * This function returns a String.
- * The prefix parameter is a String.
- * isEqualNode(arg)
- * This function returns a Boolean.
- * The arg parameter is an object that implements
- * the Node interface.
- * getFeature(feature, version)
- * This function returns an object that implements
- * the Object interface.
- * The feature parameter is a String.
- * The version parameter is a String.
- * setUserData(key, data, handler)
- * This function returns an object that implements
- * the any type interface.
- * The key parameter is a String.
- * The data parameter is an object that implements
- * the any type interface.
- * The handler parameter is an object that implements
- * the UserDataHandler interface.
- * getUserData(key)
- * This function returns an object that implements
- * the any type interface.
- * The key parameter is a String.
- *
- */
-
-class ECMA_Node
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- Node *p = new NodeImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- staticProperties, staticMethods);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- Node *p = (Node *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- if (!JSVAL_IS_INT(id))
- return JS_FALSE;
- int index = JSVAL_TO_INT(id);
- Node *n = (Node *)JS_GetPrivate(cx, obj);
- switch (index)
- {
- case prop_nodeName:
- {
- *vp = OBJECT_TO_JSVAL(domToJString(cx, n->getNodeName()));
- return JS_TRUE;
- }
- case prop_nodeValue:
- {
- *vp = OBJECT_TO_JSVAL(domToJString(cx, n->getNodeValue()));
- return JS_TRUE;
- }
- case prop_nodeType:
- {
- *vp = INT_TO_JSVAL(n->getNodeType());
- return JS_TRUE;
- }
- case prop_parentNode:
- {
- Node *p = n->getParentNode();
- *vp = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
- return JS_TRUE;
- }
- case prop_childNodes:
- {
- NodeList p = n->getChildNodes();
- *vp = OBJECT_TO_JSVAL(ENGINE->new_NodeList(&p));
- return JS_TRUE;
- }
- case prop_firstChild:
- {
- Node *p = n->getFirstChild();
- *vp = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
- return JS_TRUE;
- }
- case prop_lastChild:
- {
- Node *p = n->getLastChild();
- *vp = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
- return JS_TRUE;
- }
- case prop_previousSibling:
- {
- Node *p = n->getPreviousSibling();
- *vp = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
- return JS_TRUE;
- }
- case prop_nextSibling:
- {
- Node *p = n->getNextSibling();
- *vp = OBJECT_TO_JSVAL(ENGINE->new_Node(p));
- return JS_TRUE;
- }
- case prop_attributes:
- {
- NamedNodeMap p = n->getAttributes();
- *vp = OBJECT_TO_JSVAL(ENGINE->new_NamedNodeMap(&p));
- return JS_TRUE;
- }
- case prop_ownerDocument:
- {
- Document *p = n->getOwnerDocument();
- *vp = OBJECT_TO_JSVAL(ENGINE->new_Document(p));
- return JS_TRUE;
- }
- case prop_namespaceURI:
- {
- DOMString s = n->getNamespaceURI();
- *vp = OBJECT_TO_JSVAL(domToJString(cx, s));
- return JS_TRUE;
- }
- case prop_prefix:
- {
- DOMString s = n->getPrefix();
- *vp = OBJECT_TO_JSVAL(domToJString(cx, s));
- return JS_TRUE;
- }
- case prop_localName:
- {
- DOMString s = n->getLocalName();
- *vp = OBJECT_TO_JSVAL(domToJString(cx, s));
- return JS_TRUE;
- }
- case prop_baseURI:
- {
- DOMString s = n->getBaseURI();
- *vp = OBJECT_TO_JSVAL(domToJString(cx, s));
- return JS_TRUE;
- }
- case prop_textContent:
- {
- DOMString s = n->getTextContent();
- *vp = OBJECT_TO_JSVAL(domToJString(cx, s));
- return JS_TRUE;
- }
- }
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- if (!JSVAL_IS_INT(id))
- return JS_FALSE;
- //Node *p = (Node *) JS_GetPrivate(cx, obj);
- switch( JSVAL_TO_INT( id ) )
- {
- case prop_nodeValue:
- {
- return JS_TRUE;
- }
- case prop_prefix:
- {
- //*vp = INT_TO_JSVAL(priv->getNode()->GetAge());
- return JS_TRUE;
- }
- }
- return JS_FALSE;
- }
-
-
- //#######################
- //# M E T H O D S
- //#######################
-
- /**
- *
- */
- static JSBool insertBefore(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool replaceChild(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool removeChild(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool appendChild(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool hasChildNodes(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool cloneNode(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool normalize(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool isSupported(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool hasAttributes(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool compareDocumentPosition(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool isSameNode(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool lookupPrefix(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool isDefaultNamespace(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool lookupNamespaceURI(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool isEqualNode(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getFeature(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool setUserData(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getUserData(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- enum
- {
- prop_nodeName,
- prop_nodeValue,
- prop_nodeType,
- prop_parentNode,
- prop_childNodes,
- prop_firstChild,
- prop_lastChild,
- prop_previousSibling,
- prop_nextSibling,
- prop_attributes,
- prop_ownerDocument,
- prop_namespaceURI,
- prop_prefix,
- prop_localName,
- prop_baseURI,
- prop_textContent
- };
- static JSPropertySpec properties[];
- static JSPropertySpec staticProperties[];
- static JSFunctionSpec methods[];
- static JSFunctionSpec staticMethods[];
-
-};
-
-JSClass ECMA_Node::classDef =
-{
- "Node",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_Node::properties[] =
-{
- { "nodeName", prop_nodeName,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "nodeValue", prop_nodeValue,
- JSPROP_ENUMERATE },
- { "nodeType", prop_nodeType,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "parentNode", prop_parentNode,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "childNodes", prop_childNodes,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "firstChild", prop_firstChild,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "lastChild", prop_lastChild,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "previousSibling", prop_previousSibling,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "nextSibling", prop_nextSibling,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "attributes", prop_attributes,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "ownerDocument", prop_ownerDocument,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "namespaceURI", prop_namespaceURI,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "prefix", prop_prefix,
- JSPROP_ENUMERATE },
- { "localName", prop_localName,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "baseURI", prop_baseURI,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "textContent", prop_textContent,
- JSPROP_ENUMERATE },
- { 0 }
-};
-
-JSPropertySpec ECMA_Node::staticProperties[] =
-{
- { "ELEMENT_NODE", Node::ELEMENT_NODE,
- JSPROP_READONLY, JSGetEnumProperty },
- { "ATTRIBUTE_NODE", Node::ATTRIBUTE_NODE,
- JSPROP_READONLY, JSGetEnumProperty },
- { "TEXT_NODE", Node::TEXT_NODE,
- JSPROP_READONLY, JSGetEnumProperty },
- { "CDATA_SECTION_NODE", Node::CDATA_SECTION_NODE,
- JSPROP_READONLY, JSGetEnumProperty },
- { "ENTITY_REFERENCE_NODE", Node::ENTITY_REFERENCE_NODE,
- JSPROP_READONLY, JSGetEnumProperty },
- { "ENTITY_NODE", Node::ENTITY_NODE,
- JSPROP_READONLY, JSGetEnumProperty },
- { "PROCESSING_INSTRUCTION_NODE", Node::PROCESSING_INSTRUCTION_NODE,
- JSPROP_READONLY, JSGetEnumProperty },
- { "COMMENT_NODE", Node::COMMENT_NODE,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DOCUMENT_NODE", Node::DOCUMENT_NODE,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DOCUMENT_TYPE_NODE", Node::DOCUMENT_TYPE_NODE,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DOCUMENT_FRAGMENT_NODE", Node::DOCUMENT_FRAGMENT_NODE,
- JSPROP_READONLY, JSGetEnumProperty },
- { "NOTATION_NODE", Node::NOTATION_NODE,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DOCUMENT_POSITION_DISCONNECTED", 0x01,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DOCUMENT_POSITION_PRECEDING", 0x02,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DOCUMENT_POSITION_FOLLOWING", 0x04,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DOCUMENT_POSITION_CONTAINS", 0x08,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DOCUMENT_POSITION_CONTAINED_BY", 0x10,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", 0x20,
- JSPROP_READONLY, JSGetEnumProperty },
- { 0 }
-};
-
-JSFunctionSpec ECMA_Node::methods[] =
-{
- { "insertBefore", insertBefore, 2, 0, 0 },
- { "replaceChild", replaceChild, 2, 0, 0 },
- { "removeChild", removeChild, 1, 0, 0 },
- { "appendChild", appendChild, 1, 0, 0 },
- { "hasChildNodes", hasChildNodes, 0, 0, 0 },
- { "cloneNode", cloneNode, 1, 0, 0 },
- { "normalize", normalize, 0, 0, 0 },
- { "isSupported", isSupported, 2, 0, 0 },
- { "hasAttributes", hasAttributes, 0, 0, 0 },
- { "compareDocumentPosition", compareDocumentPosition, 1, 0, 0 },
- { "isSameNode", isSameNode, 1, 0, 0 },
- { "lookupPrefix", lookupPrefix, 1, 0, 0 },
- { "isDefaultNamespace", isDefaultNamespace, 1, 0, 0 },
- { "lookupNamespaceURI", lookupNamespaceURI, 1, 0, 0 },
- { "isEqualNode", isEqualNode, 1, 0, 0 },
- { "getFeature", getFeature, 2, 0, 0 },
- { "setUserData", setUserData, 3, 0, 0 },
- { "getUserData", getUserData, 1, 0, 0 },
- { 0 }
-};
-
-JSFunctionSpec ECMA_Node::staticMethods[] =
-{
- { 0 }
-};
-
-
-
-
-
-
-//########################################################################
-//# NodeList
-//########################################################################
-
-/**
- * Objects that implement the NodeList interface:
- *
- * Properties of objects that implement the NodeList interface:
- *
- * length
- * This read-only property is a Number.
- *
- * Functions of objects that implement the NodeList interface:
- *
- * item(index)
- * This function returns an object that implements
- * the Node interface.
- * The index parameter is a Number.
- * Note: This object can also be dereferenced using square
- * bracket notation (e.g. obj[1]). Dereferencing with
- * an integer index is equivalent to invoking the item
- * function with that index.
- *
- *
- */
-
-class ECMA_NodeList
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- NodeList *p = new NodeList();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- NodeList *p = (NodeList *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - We are using this one for indexes
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSGetNamedProperty - Provide a second property getter if
- * the default one is delegated to indexes
- */
- static JSBool JSGetNamedProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- //#######################
- //# M E T H O D S
- //#######################
-
- /**
- *
- */
- static JSBool item(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- enum
- {
- prop_length,
- prop_item
- };
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_NodeList::classDef =
-{
- "NodeList",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_NodeList::properties[] =
-{
- { "length", prop_length,
- JSPROP_ENUMERATE|JSPROP_READONLY, JSGetNamedProperty },
- { 0 }
-};
-
-JSFunctionSpec ECMA_NodeList::methods[] =
-{
- { "item", item, 1, 0, 0 },
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# NamedNodeMap
-//########################################################################
-
-/**
- * Objects that implement the NamedNodeMap interface:
- *
- * Properties of objects that implement the NamedNodeMap interface:
- *
- * length
- * This read-only property is a Number.
- *
- * Functions of objects that implement the NamedNodeMap interface:
- *
- * getNamedItem(name)
- * This function returns an object that implements
- * the Node interface.
- * The name parameter is a String.
- * setNamedItem(arg)
- * This function returns an object that implements
- * the Node interface.
- * The arg parameter is an object that implements
- * the Node interface.
- * This function can raise an object that implements
- * the DOMException interface.
- * removeNamedItem(name)
- * This function returns an object that implements
- * the Node interface.
- * The name parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * item(index)
- * This function returns an object that implements
- * the Node interface.
- * The index parameter is a Number.
- * Note: This object can also be dereferenced using square
- * bracket notation (e.g. obj[1]). Dereferencing with
- * an integer index is equivalent to invoking the item
- * function with that index.
- * getNamedItemNS(namespaceURI, localName)
- * This function returns an object that implements
- * the Node interface.
- * The namespaceURI parameter is a String.
- * The localName parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * setNamedItemNS(arg)
- * This function returns an object that implements
- * the Node interface.
- * The arg parameter is an object that implements
- * the Node interface.
- * This function can raise an object that implements
- * the DOMException interface.
- * removeNamedItemNS(namespaceURI, localName)
- * This function returns an object that implements
- * the Node interface.
- * The namespaceURI parameter is a String.
- * The localName parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- */
-
-
-class ECMA_NamedNodeMap
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- NamedNodeMap *p = new NamedNodeMap();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- NamedNodeMap *p = (NamedNodeMap *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetNamedProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- //#######################
- //# M E T H O D S
- //#######################
-
- /**
- *
- */
- static JSBool getNamedItem(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool setNamedItem(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool removeNamedItem(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool item(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getNamedItemNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool setNamedItemNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool removeNamedItemNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- enum
- {
- prop_length
- };
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_NamedNodeMap::classDef =
-{
- "NamedNodeMap",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_NamedNodeMap::properties[] =
-{
- { "length", prop_length,
- JSPROP_ENUMERATE|JSPROP_READONLY, JSGetNamedProperty },
- { 0 }
-};
-
-JSFunctionSpec ECMA_NamedNodeMap::methods[] =
-{
- { "getNamedItem", getNamedItem, 1, 0, 0 },
- { "setNamedItem", setNamedItem, 1, 0, 0 },
- { "removeNamedItem", removeNamedItem, 1, 0, 0 },
- { "item", item, 1, 0, 0 },
- { "getNamedItemNS", getNamedItemNS, 2, 0, 0 },
- { "setNamedItemNS", setNamedItemNS, 2, 0, 0 },
- { "removeNamedItemNS", removeNamedItemNS, 2, 0, 0 },
- { 0 }
-};
-
-
-
-
-//########################################################################
-//# CharacterData
-//########################################################################
-
-/**
- * Objects that implement the CharacterData interface:
- *
- * Objects that implement the CharacterData interface have all
- * properties and functions of the Node interface as well as
- * the properties and functions defined below. Properties
- * of objects that implement the CharacterData interface:
- *
- *
- * data
- * This property is a String, can raise an object
- * that implements the DOMException interface on setting
- * and can raise an object that implements the DOMException
- * interface on retrieval.
- * length
- * This read-only property is a Number.
- *
- * Functions of objects that implement the CharacterData interface:
- *
- * substringData(offset, count)
- * This function returns a String.
- * The offset parameter is a Number.
- * The count parameter is a Number.
- * This function can raise an object that implements
- * the DOMException interface.
- * appendData(arg)
- * This function has no return value.
- * The arg parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * insertData(offset, arg)
- * This function has no return value.
- * The offset parameter is a Number.
- * The arg parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * deleteData(offset, count)
- * This function has no return value.
- * The offset parameter is a Number.
- * The count parameter is a Number.
- * This function can raise an object that implements
- * the DOMException interface.
- * replaceData(offset, count, arg)
- * This function has no return value.
- * The offset parameter is a Number.
- * The count parameter is a Number.
- * The arg parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- */
-
-class ECMA_CharacterData
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- CharacterData *p = new CharacterDataImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- CharacterData *p = (CharacterData *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
- //#######################
- //# M E T H O D S
- //#######################
-
- /**
- *
- */
- static JSBool substringData(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool appendData(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool insertData(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool deleteData(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool replaceData(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- enum
- {
- prop_data,
- prop_length
- };
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_CharacterData::classDef =
-{
- "CharacterData",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_CharacterData::properties[] =
-{
- { "data", prop_data,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "length", prop_length,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { 0 }
-};
-
-JSFunctionSpec ECMA_CharacterData::methods[] =
-{
- { "substringData", substringData, 2, 0, 0 },
- { "appendData", appendData, 1, 0, 0 },
- { "insertData", insertData, 2, 0, 0 },
- { "deleteData", deleteData, 2, 0, 0 },
- { "replaceData", replaceData, 3, 0, 0 },
- { 0 }
-};
-
-
-
-
-//########################################################################
-//# Attr
-//########################################################################
-
-/**
- * Objects that implement the Attr interface:
- *
- * Objects that implement the Attr interface have all properties
- * and functions of the Node interface as well as the properties
- * and functions defined below.
- * Properties of objects that implement the Attr interface:
- *
- *
- * name
- * This read-only property is a String.
- * specified
- * This read-only property is a Boolean.
- * value
- * This property is a String and can raise an object
- * that implements the DOMException interface on setting.
- * ownerElement
- * This read-only property is an object that implements
- * the Element interface.
- * schemaTypeInfo
- * This read-only property is an object that implements
- * the TypeInfo interface.
- * isId
- * This read-only property is a Boolean.
- *
- */
-
-class ECMA_Attr
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- //Attr *p = new AttrImpl();
- //if ( ! JS_SetPrivate(cx, obj, p) )
- // return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- Attr *p = (Attr *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- enum
- {
- prop_name,
- prop_specified,
- prop_value,
- prop_ownerElement,
- prop_schemaTypeInfo,
- prop_isId,
- };
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_Attr::classDef =
-{
- "Attr",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_Attr::properties[] =
-{
- { "name", prop_name,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "specified", prop_specified,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "value", prop_value,
- JSPROP_ENUMERATE },
- { "ownerElement", prop_ownerElement,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "schemaTypeInfo", prop_schemaTypeInfo,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "isId", prop_isId,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { 0 }
-};
-
-JSFunctionSpec ECMA_Attr::methods[] =
-{
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# Element
-//########################################################################
-
-/**
- * Objects that implement the Element interface:
- *
- * Objects that implement the Element interface have all properties
- * and functions of the Node interface as well as the properties
- * and functions defined below.
- * Properties of objects that implement the Element interface:
- *
- *
- * tagName
- * This read-only property is a String.
- * schemaTypeInfo
- * This read-only property is an object that implements
- * the TypeInfo interface.
- *
- * Functions of objects that implement the Element interface:
- *
- * getAttribute(name)
- * This function returns a String.
- * The name parameter is a String.
- * setAttribute(name, value)
- * This function has no return value.
- * The name parameter is a String.
- * The value parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * removeAttribute(name)
- * This function has no return value.
- * The name parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * getAttributeNode(name)
- * This function returns an object that implements
- * the Attr interface.
- * The name parameter is a String.
- * setAttributeNode(newAttr)
- * This function returns an object that implements
- * the Attr interface.
- * The newAttr parameter is an object that implements
- * the Attr interface.
- * This function can raise an object that implements
- * the DOMException interface.
- * removeAttributeNode(oldAttr)
- * This function returns an object that implements
- * the Attr interface.
- * The oldAttr parameter is an object that implements
- * the Attr interface.
- * This function can raise an object that implements
- * the DOMException interface.
- * getElementsByTagName(name)
- * This function returns an object that implements
- * the NodeList interface.
- * The name parameter is a String.
- * getAttributeNS(namespaceURI, localName)
- * This function returns a String.
- * The namespaceURI parameter is a String.
- * The localName parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * setAttributeNS(namespaceURI, qualifiedName, value)
- * This function has no return value.
- * The namespaceURI parameter is a String.
- * The qualifiedName parameter is a String.
- * The value parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * removeAttributeNS(namespaceURI, localName)
- * This function has no return value.
- * The namespaceURI parameter is a String.
- * The localName parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * getAttributeNodeNS(namespaceURI, localName)
- * This function returns an object that implements
- * the Attr interface.
- * The namespaceURI parameter is a String.
- * The localName parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * setAttributeNodeNS(newAttr)
- * This function returns an object that implements
- * the Attr interface.
- * The newAttr parameter is an object that implements
- * the Attr interface.
- * This function can raise an object that implements
- * the DOMException interface.
- * getElementsByTagNameNS(namespaceURI, localName)
- * This function returns an object that implements
- * the NodeList interface.
- * The namespaceURI parameter is a String.
- * The localName parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * hasAttribute(name)
- * This function returns a Boolean.
- * The name parameter is a String.
- * hasAttributeNS(namespaceURI, localName)
- * This function returns a Boolean.
- * The namespaceURI parameter is a String.
- * The localName parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * setIdAttribute(name, isId)
- * This function has no return value.
- * The name parameter is a String.
- * The isId parameter is a Boolean.
- * This function can raise an object that implements
- * the DOMException interface.
- * setIdAttributeNS(namespaceURI, localName, isId)
- * This function has no return value.
- * The namespaceURI parameter is a String.
- * The localName parameter is a String.
- * The isId parameter is a Boolean.
- * This function can raise an object that implements
- * the DOMException interface.
- * setIdAttributeNode(idAttr, isId)
- * This function has no return value.
- * The idAttr parameter is an object that implements
- * the Attr interface.
- * The isId parameter is a Boolean.
- * This function can raise an object that implements
- * the DOMException interface.
- */
-
-class ECMA_Element
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- Element *p = new ElementImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- Element *p = (Element *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- //############################
- //# M E T H O D S
- //############################
-
- /**
- *
- */
- static JSBool getAttribute(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool setAttribute(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool removeAttribute(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getAttributeNode(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool setAttributeNode(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool removeAttributeNode(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getElementsByTagName(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getAttributeNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool setAttributeNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool removeAttributeNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getAttributeNodeNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool setAttributeNodeNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getElementsByTagNameNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool hasAttribute(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool hasAttributeNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool setIdAttribute(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool setIdAttributeNS(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool setIdAttributeNode(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- enum
- {
- prop_tagName,
- prop_schemaTypeInfo
- };
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_Element::classDef =
-{
- "Element",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_Element::properties[] =
-{
- { "tagName", prop_tagName,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "schemaTypeInfo", prop_schemaTypeInfo,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { 0 }
-};
-
-JSFunctionSpec ECMA_Element::methods[] =
-{
- { "getAttribute", getAttribute, 1, 0, 0 },
- { "setAttribute", setAttribute, 2, 0, 0 },
- { "removeAttribute", removeAttribute, 1, 0, 0 },
- { "getAttributeNode", getAttributeNode, 1, 0, 0 },
- { "setAttributeNode", setAttributeNode, 1, 0, 0 },
- { "removeAttributeNode", removeAttributeNode, 1, 0, 0 },
- { "getElementsByTagName", getElementsByTagName, 1, 0, 0 },
- { "getAttributeNS", getAttributeNS, 2, 0, 0 },
- { "setAttributeNS", setAttributeNS, 3, 0, 0 },
- { "removeAttributeNS", removeAttributeNS, 2, 0, 0 },
- { "getAttributeNodeNS", getAttributeNodeNS, 2, 0, 0 },
- { "setAttributeNodeNS", setAttributeNodeNS, 1, 0, 0 },
- { "getElementsByTagNameNS", getElementsByTagNameNS, 2, 0, 0 },
- { "hasAttribute", hasAttribute, 1, 0, 0 },
- { "hasAttributeNS", hasAttributeNS, 2, 0, 0 },
- { "setIdAttribute", setIdAttribute, 2, 0, 0 },
- { "setIdAttributeNS", setIdAttributeNS, 3, 0, 0 },
- { "setIdAttributeNode", setIdAttributeNode, 2, 0, 0 },
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# Text
-//########################################################################
-
-/**
- * Objects that implement the Text interface:
- *
- * Objects that implement the Text interface have all properties
- * and functions of the CharacterData interface as well as
- * the properties and functions defined below. Properties of objects
- * that implement the Text interface:
- *
- *
- * isElementContentWhitespace
- * This read-only property is a Boolean.
- * wholeText
- * This read-only property is a String.
- *
- * Functions of objects that implement the Text interface:
- *
- * splitText(offset)
- * This function returns an object that implements
- * the Text interface.
- * The offset parameter is a Number.
- * This function can raise an object that implements
- * the DOMException interface.
- * replaceWholeText(content)
- * This function returns an object that implements
- * the Text interface.
- * The content parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- */
-
-class ECMA_Text
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- Text *p = new TextImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- Text *p = (Text *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- //############################
- //# M E T H O D S
- //############################
-
- /**
- *
- */
- static JSBool splitText(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool replaceWholeText(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- enum
- {
- prop_isElementContentWhitespace,
- prop_wholeText
- };
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_Text::classDef =
-{
- "Text",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_Text::properties[] =
-{
- { "isElementContentWhitespace", prop_isElementContentWhitespace,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "wholeText", prop_wholeText,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { 0 }
-};
-
-JSFunctionSpec ECMA_Text::methods[] =
-{
- { "splitText", splitText, 1, 0, 0 },
- { "replaceWholeText", replaceWholeText, 1, 0, 0 },
- { 0 }
-};
-
-
-
-
-
-
-//########################################################################
-//# Comment
-//########################################################################
-
-/**
- * Objects that implement the Comment interface:
- *
- * Objects that implement the Comment interface have all properties
- * and functions of the CharacterData interface.
- *
- */
-
-class ECMA_Comment
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- Comment *p = new CommentImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- Comment *p = (Comment *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_Comment::classDef =
-{
- "Comment",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_Comment::properties[] =
-{
- { 0 }
-};
-
-JSFunctionSpec ECMA_Comment::methods[] =
-{
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# TypeInfo
-//########################################################################
-
-/**
- * Properties of the TypeInfo Constructor function:
- *
- * TypeInfo.DERIVATION_RESTRICTION
- * The value of the constant TypeInfo.DERIVATION_RESTRICTION
- * is 0x00000001.
- * TypeInfo.DERIVATION_EXTENSION
- * The value of the constant TypeInfo.DERIVATION_EXTENSION
- * is 0x00000002.
- * TypeInfo.DERIVATION_UNION
- * The value of the constant TypeInfo.DERIVATION_UNION
- * is 0x00000004.
- * TypeInfo.DERIVATION_LIST
- * The value of the constant TypeInfo.DERIVATION_LIST
- * is 0x00000008.
- *
- * Objects that implement the TypeInfo interface:
- *
- * Properties of objects that implement the TypeInfo interface:
- *
- * typeName
- * This read-only property is a String.
- * typeNamespace
- * This read-only property is a String.
- *
- * Functions of objects that implement the TypeInfo interface:
- *
- * isDerivedFrom(typeNamespaceArg, typeNameArg, derivationMethod)
- * This function returns a Boolean.
- * The typeNamespaceArg parameter is a String.
- * The typeNameArg parameter is a String.
- * The derivationMethod parameter is a Number.
- */
-
-class ECMA_TypeInfo
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- //TypeInfo *p = new TypeInfoImpl();
- //if ( ! JS_SetPrivate(cx, obj, p) )
- // return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- staticProperties, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- TypeInfo *p = (TypeInfo *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- //############################
- //# M E T H O D S
- //############################
-
- /**
- *
- */
- static JSBool isDerivedFrom(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- enum
- {
- prop_typeName,
- prop_typeNamespace
- };
- static JSFunctionSpec methods[];
- static JSPropertySpec staticProperties[];
-
-};
-
-JSClass ECMA_TypeInfo::classDef =
-{
- "TypeInfo",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_TypeInfo::properties[] =
-{
- { "typeName", prop_typeName,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "typeNamespace", prop_typeNamespace,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { 0 }
-};
-
-JSFunctionSpec ECMA_TypeInfo::methods[] =
-{
- { "isDerivedFrom", isDerivedFrom, 3, 0, 0 },
- { 0 }
-};
-
-JSPropertySpec ECMA_TypeInfo::staticProperties[] =
-{
- { "DERIVATION_RESTRICTION", TypeInfo::DERIVATION_RESTRICTION,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DERIVATION_EXTENSION", TypeInfo::DERIVATION_EXTENSION,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DERIVATION_UNION", TypeInfo::DERIVATION_UNION,
- JSPROP_READONLY, JSGetEnumProperty },
- { "DERIVATION_LIST", TypeInfo::DERIVATION_LIST,
- JSPROP_READONLY, JSGetEnumProperty },
- { 0 }
-};
-
-
-
-
-
-
-//########################################################################
-//# UserDataHandler
-//########################################################################
-
-/**
- * Properties of the UserDataHandler Constructor function:
- *
- * UserDataHandler.NODE_CLONED
- * The value of the constant UserDataHandler.NODE_CLONED is 1.
- * UserDataHandler.NODE_IMPORTED
- * The value of the constant UserDataHandler.NODE_IMPORTED is 2.
- * UserDataHandler.NODE_DELETED
- * The value of the constant UserDataHandler.NODE_DELETED is 3.
- * UserDataHandler.NODE_RENAMED
- * The value of the constant UserDataHandler.NODE_RENAMED is 4.
- * UserDataHandler.NODE_ADOPTED
- * The value of the constant UserDataHandler.NODE_ADOPTED is 5.
- *
- * UserDataHandler function:
- * This function has no return value.
- * The first parameter is a Number.
- * The second parameter is a String.
- * The third parameter is an object that implements the any
- * type interface.
- * The fourth parameter is an object that implements the Node
- * interface.
- * The fifth parameter is an object that implements the Node interface.
- * Properties of the DOMError Constructor function:
- *
- *
- * DOMError.SEVERITY_WARNING
- * The value of the constant DOMError.SEVERITY_WARNING is 1.
- * DOMError.SEVERITY_ERROR
- * The value of the constant DOMError.SEVERITY_ERROR is 2.
- * DOMError.SEVERITY_FATAL_ERROR
- * The value of the constant DOMError.SEVERITY_FATAL_ERROR is 3.
- */
-
-
-class ECMA_UserDataHandler
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- //UserDataHandler *p = new UserDataHandlerImpl();
- //if ( ! JS_SetPrivate(cx, obj, p) )
- // return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- staticProperties, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- UserDataHandler *p = (UserDataHandler *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
- static JSPropertySpec staticProperties[];
-
-};
-
-JSClass ECMA_UserDataHandler::classDef =
-{
- "UserDataHandler",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_UserDataHandler::properties[] =
-{
- { 0 }
-};
-
-JSFunctionSpec ECMA_UserDataHandler::methods[] =
-{
- { 0 }
-};
-
-
-JSPropertySpec ECMA_UserDataHandler::staticProperties[] =
-{
- { "NODE_CLONED", UserDataHandler::NODE_CLONED,
- JSPROP_READONLY, JSGetEnumProperty },
- { "NODE_IMPORTED", UserDataHandler::NODE_IMPORTED,
- JSPROP_READONLY, JSGetEnumProperty },
- { "NODE_DELETED", UserDataHandler::NODE_DELETED,
- JSPROP_READONLY, JSGetEnumProperty },
- { "NODE_RENAMED", UserDataHandler::NODE_RENAMED,
- JSPROP_READONLY, JSGetEnumProperty },
- { "NODE_ADOPTED", UserDataHandler::NODE_ADOPTED,
- JSPROP_READONLY, JSGetEnumProperty },
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# DOMError
-//########################################################################
-
-/**
- * Objects that implement the DOMError interface:
- *
- * Properties of objects that implement the DOMError interface:
- *
- * severity
- * This read-only property is a Number.
- * message
- * This read-only property is a String.
- * type
- * This read-only property is a String.
- * relatedException
- * This read-only property is an object that implements
- * the Object interface.
- * relatedData
- * This read-only property is an object that implements
- * the Object interface.
- * location
- * This read-only property is an object that implements
- * the DOMLocator interface.
- *
- * DOMErrorHandler function:
- * This function returns a Boolean.
- * The parameter is an object that implements the
- * DOMError interface.
- *
- *
- */
-
-class ECMA_DOMError
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- //DOMError *p = new DOMErrorImpl();
- //if ( ! JS_SetPrivate(cx, obj, p) )
- // return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- staticProperties, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- DOMError *p = (DOMError *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- enum
- {
- prop_severity,
- prop_message,
- prop_type,
- prop_relatedException,
- prop_relatedData,
- prop_location
- };
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
- static JSPropertySpec staticProperties[];
-
-};
-
-JSClass ECMA_DOMError::classDef =
-{
- "DOMError",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_DOMError::properties[] =
-{
- { "severity", prop_severity,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "message", prop_message,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "type", prop_type,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "relatedException", prop_relatedException,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "relatedData", prop_relatedData,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "location", prop_location,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { 0 }
-};
-
-JSFunctionSpec ECMA_DOMError::methods[] =
-{
- { 0 }
-};
-
-
-JSPropertySpec ECMA_DOMError::staticProperties[] =
-{
- { "SEVERITY_WARNING", DOMError::SEVERITY_WARNING,
- JSPROP_READONLY, JSGetEnumProperty },
- { "SEVERITY_ERROR", DOMError::SEVERITY_ERROR,
- JSPROP_READONLY, JSGetEnumProperty },
- { "SEVERITY_FATAL_ERROR", DOMError::SEVERITY_FATAL_ERROR,
- JSPROP_READONLY, JSGetEnumProperty },
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# DOMLocator
-//########################################################################
-
-/**
- * Objects that implement the DOMLocator interface:
- *
- * Properties of objects that implement the DOMLocator interface:
- *
- * lineNumber
- * This read-only property is a Number.
- * columnNumber
- * This read-only property is a Number.
- * byteOffset
- * This read-only property is a Number.
- * utf16Offset
- * This read-only property is a Number.
- * relatedNode
- * This read-only property is an object that implements
- * the Node interface.
- * uri
- * This read-only property is a String.
- */
-
-class ECMA_DOMLocator
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- DOMLocator *p = new DOMLocatorImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- DOMLocator *p = (DOMLocator *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- enum
- {
- prop_lineNumber,
- prop_columnNumber,
- prop_byteOffset,
- prop_utf16Offset,
- prop_relatedNode,
- prop_uri,
- };
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_DOMLocator::classDef =
-{
- "DOMLocator",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_DOMLocator::properties[] =
-{
- { "lineNumber", prop_lineNumber,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "columnNumber", prop_columnNumber,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "byteOffset", prop_byteOffset,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "utf16Offset", prop_utf16Offset,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "relatedNode", prop_relatedNode,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { "uri", prop_uri,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { 0 }
-};
-
-JSFunctionSpec ECMA_DOMLocator::methods[] =
-{
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# DOMConfiguration
-//########################################################################
-
-/**
- * Objects that implement the DOMConfiguration interface:
- *
- * Properties of objects that implement the DOMConfiguration interface:
- *
- * parameterNames
- * This read-only property is an object that implements
- * the DOMStringList interface.
- *
- * Functions of objects that implement the DOMConfiguration interface:
- *
- * setParameter(name, value)
- * This function has no return value.
- * The name parameter is a String.
- * The value parameter is an object that implements
- * the any type interface.
- * This function can raise an object that implements
- * the DOMException interface.
- * getParameter(name)
- * This function returns an object that implements
- * the any type interface.
- * The name parameter is a String.
- * This function can raise an object that implements
- * the DOMException interface.
- * canSetParameter(name, value)
- * This function returns a Boolean.
- * The name parameter is a String.
- * The value parameter is an object that implements
- * the any type interface.
- */
-
-
-class ECMA_DOMConfiguration
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- DOMConfiguration *p = new DOMConfigurationImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- DOMConfiguration *p = (DOMConfiguration *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- //############################
- //# M E T H O D S
- //############################
-
- /**
- *
- */
- static JSBool setParameter(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool getParameter(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
- /**
- *
- */
- static JSBool canSetParameter(JSContext *cx, JSObject *obj,
- uintN argc, jsval *argv, jsval *rval)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- enum
- {
- prop_parameterNames
- };
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_DOMConfiguration::classDef =
-{
- "DOMConfiguration",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_DOMConfiguration::properties[] =
-{
- { "parameterNames", prop_parameterNames,
- JSPROP_ENUMERATE|JSPROP_READONLY },
- { 0 }
-};
-
-JSFunctionSpec ECMA_DOMConfiguration::methods[] =
-{
- { "setParameter", setParameter, 2, 0, 0 },
- { "getParameter", getParameter, 1, 0, 0 },
- { "canSetParameter", canSetParameter, 2, 0, 0 },
- { 0 }
-};
-
-
-
-
-
-
-//########################################################################
-//# CDATASection
-//########################################################################
-
-/**
- * Objects that implement the CDATASection interface:
- *
- * Objects that implement the CDATASection interface
- * have all properties and functions of the Text interface.
- *
- */
-
-class ECMA_CDATASection
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- CDATASection *p = new CDATASectionImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- CDATASection *p = (CDATASection *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_CDATASection::classDef =
-{
- "CDATASection",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_CDATASection::properties[] =
-{
- { 0 }
-};
-
-JSFunctionSpec ECMA_CDATASection::methods[] =
-{
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# DocumentType
-//########################################################################
-
-/**
- * Objects that implement the DocumentType interface:
- *
- * Objects that implement the DocumentType interface have all
- * properties and functions of the Node interface as well as
- * the properties and functions defined below.
- * Properties of objects that implement the DocumentType interface:
- *
- *
- * name
- * This read-only property is a String.
- * entities
- * This read-only property is an object that implements
- * the NamedNodeMap interface.
- * notations
- * This read-only property is an object that implements
- * the NamedNodeMap interface.
- * publicId
- * This read-only property is a String.
- * systemId
- * This read-only property is a String.
- * internalSubset
- * This read-only property is a String.
- */
-
-
-class ECMA_DocumentType
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- DocumentType *p = new DocumentTypeImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- DocumentType *p = (DocumentType *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- enum
- {
- prop_name,
- prop_entities,
- prop_notations,
- prop_systemId,
- prop_publicId,
- prop_internalSubset
- };
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_DocumentType::classDef =
-{
- "DocumentType",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_DocumentType::properties[] =
-{
- { "name", prop_name, JSPROP_ENUMERATE|JSPROP_READONLY },
- { "entities", prop_entities, JSPROP_ENUMERATE|JSPROP_READONLY },
- { "notations", prop_notations, JSPROP_ENUMERATE|JSPROP_READONLY },
- { "systemId", prop_systemId, JSPROP_ENUMERATE|JSPROP_READONLY },
- { "publicId", prop_publicId, JSPROP_ENUMERATE|JSPROP_READONLY },
- { "internalSubset", prop_internalSubset, JSPROP_ENUMERATE|JSPROP_READONLY },
- { 0 }
-};
-
-JSFunctionSpec ECMA_DocumentType::methods[] =
-{
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# Notation
-//########################################################################
-
-/**
- * Objects that implement the Notation interface:
- *
- * Objects that implement the Notation interface have all
- * properties and functions of the Node interface as well as
- * the properties and functions defined below.
- * Properties of objects that implement the Notation interface:
- *
- *
- * publicId
- * This read-only property is a String.
- * systemId
- * This read-only property is a String.
- */
-
-class ECMA_Notation
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- Notation *p = new NotationImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- Notation *p = (Notation *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- enum
- {
- prop_publicId,
- prop_systemId
- };
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_Notation::classDef =
-{
- "Notation",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_Notation::properties[] =
-{
- { "publicId", prop_publicId, JSPROP_ENUMERATE|JSPROP_READONLY },
- { "systemId", prop_systemId, JSPROP_ENUMERATE|JSPROP_READONLY },
- { 0 }
-};
-
-JSFunctionSpec ECMA_Notation::methods[] =
-{
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# Entity
-//########################################################################
-
-/**
- * Objects that implement the Entity interface:
- *
- * Objects that implement the Entity interface have all properties
- * and functions of the Node interface as well as the properties
- * and functions defined below.
- * Properties of objects that implement the Entity interface:
- *
- *
- * publicId
- * This read-only property is a String.
- * systemId
- * This read-only property is a String.
- * notationName
- * This read-only property is a String.
- * inputEncoding
- * This read-only property is a String.
- * xmlEncoding
- * This read-only property is a String.
- * xmlVersion
- * This read-only property is a String.
- */
-
-class ECMA_Entity
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- Entity *p = new EntityImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- Entity *p = (Entity *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- enum
- {
- prop_publicId,
- prop_systemId,
- prop_notationName,
- prop_inputEncoding,
- prop_xmlEncoding,
- prop_xmlVersion
- };
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_Entity::classDef =
-{
- "Entity",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_Entity::properties[] =
-{
- { "publicId", prop_publicId, JSPROP_ENUMERATE|JSPROP_READONLY },
- { "systemId", prop_systemId, JSPROP_ENUMERATE|JSPROP_READONLY },
- { "notationName", prop_notationName, JSPROP_ENUMERATE|JSPROP_READONLY },
- { "inputEncoding", prop_inputEncoding, JSPROP_ENUMERATE|JSPROP_READONLY },
- { "xmlEncoding", prop_xmlEncoding, JSPROP_ENUMERATE|JSPROP_READONLY },
- { "xmlVersion", prop_xmlVersion, JSPROP_ENUMERATE|JSPROP_READONLY },
- { 0 }
-};
-
-JSFunctionSpec ECMA_Entity::methods[] =
-{
- { 0 }
-};
-
-
-
-
-//########################################################################
-//# EntityReference
-//########################################################################
-
-/**
- * Objects that implement the EntityReference interface:
- *
- * Objects that implement the EntityReference interface have all
- * properties and functions of the Node interface.
- *
- */
-
-
-class ECMA_EntityReference
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- EntityReference *p = new EntityReferenceImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- EntityReference *p = (EntityReference *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_EntityReference::classDef =
-{
- "EntityReference",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_EntityReference::properties[] =
-{
- { 0 }
-};
-
-JSFunctionSpec ECMA_EntityReference::methods[] =
-{
- { 0 }
-};
-
-
-
-
-
-//########################################################################
-//# ProcessingInstruction
-//########################################################################
-
-/**
- * Objects that implement the ProcessingInstruction interface:
- *
- * Objects that implement the ProcessingInstruction interface
- * have all properties and functions of the Node interface
- * as well as the properties and functions defined below.
- * Properties of objects that implement the ProcessingInstruction
- * interface:
- *
- * target
- * This read-only property is a String.
- * data
- * This property is a String and can raise an object
- * that implements the DOMException interface on setting.
- *
- */
-
-
-class ECMA_ProcessingInstruction
-{
-public:
-
- /**
- * JSConstructor - Callback for when a this object is created
- */
- static JSBool JSConstructor(JSContext *cx, JSObject *obj, uintN argc,
- jsval *argv, jsval *rval)
- {
- if (argc != 1)
- return JS_FALSE;
- ProcessingInstruction *p = new ProcessingInstructionImpl();
- if ( ! JS_SetPrivate(cx, obj, p) )
- return JS_FALSE;
- *rval = OBJECT_TO_JSVAL(obj);
- return JS_TRUE;
- }
-
- /**
- * JSInit - Create a prototype for this class
- */
- static JSObject* JSInit(JSContext *cx, JSObject *obj, JSObject *proto = NULL)
- {
- JSObject *newObj = JS_InitClass(cx, obj, proto, &classDef,
- JSConstructor, 0,
- properties, methods,
- NULL, NULL);
- return newObj;
- }
-
- /**
- * JSDestructor - Callback for when a this object is destroyed
- */
- static void JSDestructor(JSContext *cx, JSObject *obj)
- {
- ProcessingInstruction *p = (ProcessingInstruction *) JS_GetPrivate(cx, obj);
- delete p;
- }
-
- /**
- * JSGetProperty - Callback for retrieving properties
- */
- static JSBool JSGetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
- /**
- * JSSetProperty - Callback for setting properties
- */
- static JSBool JSSetProperty(JSContext *cx, JSObject *obj,
- jsval id, jsval *vp)
- {
- return JS_FALSE;
- }
-
-
- static JSClass classDef;
-
-private:
-
- // Standard JS Binding fields
- static JSPropertySpec properties[];
- enum
- {
- prop_target,
- prop_data
- };
- static JSFunctionSpec methods[];
-
-};
-
-JSClass ECMA_ProcessingInstruction::classDef =
-{
- "ProcessingInstruction",
- JSCLASS_HAS_PRIVATE,
- JS_PropertyStub, JS_PropertyStub,
- JSGetProperty, JSSetProperty,
- JS_EnumerateStub, JS_ResolveStub,
- JS_ConvertStub, JSDestructor
-};
-
-
-
-JSPropertySpec ECMA_ProcessingInstruction::properties[] =
-{
- { "target", prop_target, JSPROP_ENUMERATE|JSPROP_READONLY },
- { "data", prop_data, JSPROP_ENUMERATE },
- { 0 }
-};
-
-JSFunctionSpec ECMA_ProcessingInstruction::methods[] =
-{
- { 0 }
-};
-
-
-
-/**
- * Note: In addition of having DOMConfiguration parameters
- * exposed to the application using the setParameter
- * and getParameter, those parameters are also exposed
- * as ECMAScript properties on the DOMConfiguration object.
- * The name of the parameter is converted into a property name
- * using a camel-case convention:
- * the character '-' (HYPHEN-MINUS) is removed
- * and the following character is
- * being replaced by its uppercase equivalent.
- */
-
-
-
-
-
-//########################################################################
-//# M A I N B I N D I N G
-//########################################################################
-
-bool JavascriptEngine::createClasses()
-{
- proto_Node =
- ECMA_Node::JSInit(cx, globalObj);
- proto_CharacterData =
- ECMA_CharacterData::JSInit(cx, globalObj, proto_Node);
- proto_Text =
- ECMA_Text::JSInit(cx, globalObj, proto_CharacterData);
- proto_CDATASection =
- ECMA_CDATASection::JSInit(cx, globalObj, proto_Text);
- proto_Document =
- ECMA_Document::JSInit(cx, globalObj, proto_CDATASection);
- return true;
-}
-
-
-JSObject *JavascriptEngine::wrapDocument(const Document *doc)
-{
- if (!doc)
- {
- error("wrapDocument: null document parameter");
- return NULL;
- }
-
- JSObject *jsdoc = JS_NewObject(cx, &ECMA_Document::classDef,
- proto_Document, NULL);
-
- //Wrap around the document... done!
- JS_SetPrivate(cx, jsdoc, (void *)doc);
-
- return jsdoc;
-}
-
-JSObject *JavascriptEngine::new_Attr(Attr *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_Attr::classDef,
- proto_Attr,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_CDATASection(CDATASection *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_CDATASection::classDef,
- proto_CDATASection,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_CharacterData(CharacterData *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_CharacterData::classDef,
- proto_CharacterData,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_Comment(Comment *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_Comment::classDef,
- proto_Comment,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_Document(Document *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_Document::classDef,
- proto_Document,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_DocumentFragment(DocumentFragment *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_DocumentFragment::classDef,
- proto_DocumentFragment,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_DocumentType(DocumentType *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_DocumentType::classDef,
- proto_DocumentType,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_DOMConfiguration(DOMConfiguration *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_DOMConfiguration::classDef,
- proto_DOMConfiguration,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_DOMError(DOMError *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_DOMError::classDef,
- proto_DOMError,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_DOMException(DOMException *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_DOMException::classDef,
- proto_DOMException,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_DOMImplementation(DOMImplementation *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_DOMImplementation::classDef,
- proto_DOMImplementation,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_DOMImplementationList(DOMImplementationList *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_DOMImplementationList::classDef,
- proto_DOMImplementationList,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_DOMImplementationRegistry(DOMImplementationSource *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_DOMImplementationRegistry::classDef,
- proto_DOMImplementationRegistry,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_DOMImplementationSource(DOMImplementationSource *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_DOMImplementationSource::classDef,
- proto_DOMImplementationSource,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_DOMLocator(DOMLocator *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_DOMLocator::classDef,
- proto_DOMLocator,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_DOMStringList(DOMStringList *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_DOMStringList::classDef,
- proto_DOMStringList,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_Element(Element *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_Element::classDef,
- proto_Element,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_Entity(Entity *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_Entity::classDef,
- proto_Entity,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_EntityReference(EntityReference *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_EntityReference::classDef,
- proto_EntityReference,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_NamedNodeMap(NamedNodeMap *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_NamedNodeMap::classDef,
- proto_NamedNodeMap,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_NameList(NameList *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_NameList::classDef,
- proto_NameList,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_Node(Node *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_Node::classDef,
- proto_Node,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_NodeList(NodeList *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_NodeList::classDef,
- proto_NodeList,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_Notation(Notation *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_Notation::classDef,
- proto_Notation,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_ProcessingInstruction(ProcessingInstruction *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_ProcessingInstruction::classDef,
- proto_ProcessingInstruction,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_Text(Text *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_Text::classDef,
- proto_Text,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_TypeInfo(TypeInfo *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_TypeInfo::classDef,
- proto_TypeInfo,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-JSObject *JavascriptEngine::new_UserDataHandler(UserDataHandler *obj)
-{
- JSObject *newObj = JS_NewObject(cx,
- &ECMA_UserDataHandler::classDef,
- proto_UserDataHandler,
- NULL);
- JS_SetPrivate(cx, newObj, obj);
- return newObj;
-}
-
-
-
-
-} // namespace dom
-} // namespace w3c
-} // namespace org
-
-//########################################################################
-//# E N D O F F I L E
-//########################################################################
-
diff --git a/src/dom/jsdombind.cpp b/src/dom/jsdombind.cpp
--- /dev/null
+++ b/src/dom/jsdombind.cpp
@@ -0,0 +1,3959 @@
+ /**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+/**
+ * This code provides the ECMAScript (Javascript) binding to the classes
+ * of the DOM Level 3 Core. This should provide DOM manipulation for
+ * most general-purpose XML and Document-like applications. More specialized
+ * applications like SVG should inherit from the core C++ classes, and also
+ * use the prototypes in this file as the basis for their bindings.
+ *
+ * To ensure that we at least attempt to bind ECMAScript to DOM
+ * as closely as possible to the standards, we will include the entire
+ * Appendix H of the XML Level 3 Core spec as annotations in this file.
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding.html
+ */
+
+
+
+ #include "domimpl.h"
+ #include "jsdombind.h"
+
+ #include <stdarg.h>
+
+
+ namespace org
+ {
+ namespace w3c
+ {
+ namespace dom
+ {
+
+
+//########################################################################
+//# M E S S A G E S
+//########################################################################
+void JavascriptDOMBinder::error(char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stderr, "JS error: ");
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+}
+
+
+void JavascriptDOMBinder::trace(char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stdout, "JS: ");
+ vfprintf(stdout, fmt, args);
+ fprintf(stdout, "\n");
+ va_end(args);
+}
+
+
+
+//########################################################################
+//# U T I L I T Y
+//########################################################################
+
+//Use this for getting the JavascriptEngine from an object method
+#define BINDER ((JavascriptDOMBinder *) JS_GetContextPrivate(cx))
+
+#define NewObjectVal (CLASSNAME) \
+ OBJECT_TO_JSVAL( JS_NewObject(cx, \
+ &wrapperClassDef, \
+ (JavascriptDOMBinder *) JS_GetContextPrivate(cx)->proto_## CLASSNAME, \
+ (void *) priv) );
+
+#define NewObjectPtrVal (CLASSNAME) \
+ OBJECT_TO_JSVAL( JS_NewObject(cx, \
+ &wrapperClassDef, \
+ (JavascriptDOMBinder *) JS_GetContextPrivate(cx)->proto_## CLASSNAME, \
+ (void *) new ## CLASSNAME ## Ptr (priv) ));
+
+/**
+ * The name of the property is an enumeration, so just return the value.
+ */
+static JSBool GetEnumProperty(JSContext *cx, JSObject *obj,
+ jsval id, jsval *vp)
+{
+ *vp = id;
+ return JS_TRUE;
+}
+
+
+static JSString *domToJString(JSContext *cx, const DOMString &s)
+{
+ JSString *str = JS_NewStringCopyN(cx, s.c_str(), s.size());
+ return str;
+}
+
+static DOMString jvToDomString(JSContext *cx, jsval s)
+{
+ JSString *jstr = JS_ValueToString(cx, s);
+ DOMString str = JS_GetStringBytes(jstr);
+ return str;
+}
+
+static DOMString jToDomString(JSString *s)
+{
+ DOMString str = JS_GetStringBytes(s);
+ return str;
+}
+
+
+//########################################################################
+//# C L A S S E S
+//########################################################################
+
+
+/**
+ * Appendix H: ECMAScript Language Binding
+ *
+ * This appendix contains the complete ECMAScript [ECMAScript] binding for the
+ * Level 3 Document Object Model Core definitions. H.1 ECMAScript Binding
+ * Extension
+ *
+ */
+
+class Wrapper
+{
+public:
+
+ Wrapper(JSContext *context, JSObject *object)
+ { cx = context; obj = object; }
+
+ virtual ~Wrapper()
+ {}
+
+ virtual JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ virtual JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ virtual JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+protected:
+
+ JSContext *cx;
+
+ JSObject *obj;
+
+};
+
+/**
+ * WrapperProperty - Callback for retrieving properties
+ */
+static JSBool wrapperGetProperty(JSContext *cx, JSObject *obj,
+ jsval id, jsval *vp)
+{
+ Wrapper *w = (Wrapper *) JS_GetPrivate(cx, obj);
+ return w->getProperty(id, vp);
+}
+
+/**
+ * JSSetProperty - Callback for setting properties
+ */
+static JSBool wrapperSetProperty(JSContext *cx, JSObject *obj,
+ jsval id, jsval *vp)
+{
+ Wrapper *w = (Wrapper *) JS_GetPrivate(cx, obj);
+ return w->setProperty(id, vp);
+}
+
+/**
+ * JSConstructor - Callback for when a this object is created
+ */
+static JSBool wrapperConstructor(JSContext *cx, JSObject *obj, uintN argc,
+ jsval *argv, jsval *rval)
+{
+ Wrapper *w = new Wrapper(cx, obj);
+ JSBool ret = w->init(argc, argv);
+ *rval = OBJECT_TO_JSVAL(obj);
+ return ret;
+}
+
+/**
+ * JSDestructor - Callback for when a this object is destroyed
+ */
+static void wrapperDestructor(JSContext *cx, JSObject *obj)
+{
+ Wrapper *w = (Wrapper *) JS_GetPrivate(cx, obj);
+ delete w;
+}
+
+static JSClass wrapperClassDef =
+{
+ "DOMWrapper",
+ JSCLASS_HAS_PRIVATE,
+ JS_PropertyStub, JS_PropertyStub,
+ wrapperGetProperty, wrapperSetProperty,
+ JS_EnumerateStub, JS_ResolveStub,
+ JS_ConvertStub, wrapperDestructor
+};
+
+
+/**
+ * JSInit - Create a prototype for this class
+ */
+static JSObject* wrapperInit(JSContext *cx, JSObject *obj,
+ JSNative constructor,
+ JSPropertySpec *properties,
+ JSFunctionSpec *methods,
+ JSPropertySpec *staticProperties,
+ JSFunctionSpec *staticMethods,
+ JSObject *proto = NULL)
+{
+ JSObject *protoObj = JS_InitClass(cx, obj, proto,
+ &wrapperClassDef,
+ wrapperConstructor, 0,
+ properties,
+ methods,
+ staticProperties,
+ staticMethods);
+ return protoObj;
+}
+
+#define WRAP_NAME(NAME) NAME ## _wrapper
+#define CLASS_NAME(NAME) WRAP_NAME(NAME)
+
+#define CONST_NAME(NAME) NAME ## _constructor
+#define CONSTRUCTOR_NAME(NAME) CONST_NAME(NAME)
+
+#define PT_NAME(NAME) NAME ## _properties
+#define PROPERTY_TABLE(NAME) PT_NAME(NAME)
+
+#define M_NAME(NAME) NAME ## _method
+#define METHOD_NAME(NAME) M_NAME(NAME)
+#define MT_NAME(NAME) NAME ## _methods
+#define METHOD_TABLE(NAME) MT_NAME(NAME)
+
+#define SPT_NAME(NAME) NAME ## _staticProperties
+#define STATIC_PROPERTY_TABLE(NAME) SPT_NAME(NAME)
+
+#define SMT_NAME(NAME) NAME ## _staticMethods
+#define STATIC_METHOD_TABLE(NAME) SMT_NAME(NAME)
+
+#define METHOD(NAME) \
+static JSBool NAME(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) \
+{ return ((CLASS_NAME(CURRENT_CLASS) *) JS_GetPrivate(cx, obj))->METHOD_NAME(NAME)(argc, argv, rval); } \
+ JSBool METHOD_NAME(NAME)(uintN argc, jsval *argv, jsval *rval)
+
+#define CONSTRUCTOR(NAME) \
+static JSBool CONSTRUCTOR_NAME(NAME)(JSContext *cx, \
+ JSObject *obj, uintN argc, \
+ jsval *argv, jsval *rval) \
+{ \
+ CLASS_NAME(NAME) *w = new CLASS_NAME(NAME)(cx, obj); \
+ JSBool ret = w->init(argc, argv); \
+ *rval = OBJECT_TO_JSVAL(obj); \
+ return ret; \
+}
+
+#define CREATE_PROTO(NAME, cx, obj, proto) \
+ JS_InitClass(cx, obj, proto, &wrapperClassDef, \
+ CONSTRUCTOR_NAME(NAME), 0, \
+ PROPERTY_TABLE(NAME), \
+ METHOD_TABLE(NAME), \
+ STATIC_PROPERTY_TABLE(NAME), \
+ STATIC_METHOD_TABLE(NAME));
+
+//########################################################################
+//# DOMImplementationRegistry
+//########################################################################
+
+/**
+ * This section defines the DOMImplementationRegistry object, discussed in
+ * Bootstrapping, for ECMAScript.
+ *
+ *
+ * Objects that implements the DOMImplementationRegistry interface
+ *
+ * DOMImplementationRegistry is a global variable which has the following
+ * functions:
+ *
+ * getDOMImplementation(features)
+ * This method returns the first registered object that implements
+ * the DOMImplementation interface and has the desired features,
+ * or null if none is found. The features parameter is a String.
+ * See also DOMImplementationSource.getDOMImplementation().
+ *
+ * getDOMImplementationList(features)
+ * This method returns a DOMImplementationList list of registered
+ * object that implements the DOMImplementation interface and
+ * has the desired features. The features parameter is a String.
+ * See also DOMImplementationSource.getDOMImplementationList().
+ *
+ *
+ */
+#define CURRENT_CLASS DOMImplementationRegistry
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { "getDOMImplementation",
+ CLASS_NAME(CURRENT_CLASS)::getDOMImplementation, 1, 0, 0 },
+ { "getDOMImplementationList",
+ CLASS_NAME(CURRENT_CLASS)::getDOMImplementationList, 1, 0, 0 },
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+/**
+ * H.2 Other Core interfaces
+ */
+
+
+
+
+//########################################################################
+//# DOMException
+//########################################################################
+
+/**
+ * Properties of the DOMException Constructor function:
+ *
+ * DOMException.INDEX_SIZE_ERR
+ * The value of the constant DOMException.INDEX_SIZE_ERR is 1.
+ * DOMException.DOMSTRING_SIZE_ERR
+ * The value of the constant DOMException.DOMSTRING_SIZE_ERR is 2.
+ * DOMException.HIERARCHY_REQUEST_ERR
+ * The value of the constant DOMException.HIERARCHY_REQUEST_ERR is 3.
+ * DOMException.WRONG_DOCUMENT_ERR
+ * The value of the constant DOMException.WRONG_DOCUMENT_ERR is 4.
+ * DOMException.INVALID_CHARACTER_ERR
+ * The value of the constant DOMException.INVALID_CHARACTER_ERR is 5.
+ * DOMException.NO_DATA_ALLOWED_ERR
+ * The value of the constant DOMException.NO_DATA_ALLOWED_ERR is 6.
+ * DOMException.NO_MODIFICATION_ALLOWED_ERR
+ * The value of the constant DOMException.NO_MODIFICATION_ALLOWED_ERR is 7.
+ * DOMException.NOT_FOUND_ERR
+ * The value of the constant DOMException.NOT_FOUND_ERR is 8.
+ * DOMException.NOT_SUPPORTED_ERR
+ * The value of the constant DOMException.NOT_SUPPORTED_ERR is 9.
+ * DOMException.INUSE_ATTRIBUTE_ERR
+ * The value of the constant DOMException.INUSE_ATTRIBUTE_ERR is 10.
+ * DOMException.INVALID_STATE_ERR
+ * The value of the constant DOMException.INVALID_STATE_ERR is 11.
+ * DOMException.SYNTAX_ERR
+ * The value of the constant DOMException.SYNTAX_ERR is 12.
+ * DOMException.INVALID_MODIFICATION_ERR
+ * The value of the constant DOMException.INVALID_MODIFICATION_ERR is 13.
+ * DOMException.NAMESPACE_ERR
+ * The value of the constant DOMException.NAMESPACE_ERR is 14.
+ * DOMException.INVALID_ACCESS_ERR
+ * The value of the constant DOMException.INVALID_ACCESS_ERR is 15.
+ * DOMException.VALIDATION_ERR
+ * The value of the constant DOMException.VALIDATION_ERR is 16.
+ * DOMException.TYPE_MISMATCH_ERR
+ * The value of the constant DOMException.TYPE_MISMATCH_ERR is 17.
+ *
+ * Objects that implement the DOMException interface:
+ *
+ * Properties of objects that implement the DOMException interface:
+ *
+ * code
+ * This property is a Number.
+ *
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS DOMException
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { "code", CLASS_NAME(CURRENT_CLASS)::prop_code, JSPROP_ENUMERATE },
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { "INDEX_SIZE_ERR", DOMException::INDEX_SIZE_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "DOMSTRING_SIZE_ERR", DOMException::DOMSTRING_SIZE_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "HIERARCHY_REQUEST_ERR", DOMException::HIERARCHY_REQUEST_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "WRONG_DOCUMENT_ERR", DOMException::WRONG_DOCUMENT_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "INVALID_CHARACTER_ERR", DOMException::INVALID_CHARACTER_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "NO_DATA_ALLOWED_ERR", DOMException::NO_DATA_ALLOWED_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "NO_MODIFICATION_ALLOWED_ERR", DOMException::NO_MODIFICATION_ALLOWED_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "NOT_FOUND_ERR", DOMException::NOT_FOUND_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "NOT_SUPPORTED_ERR", DOMException::NOT_SUPPORTED_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "INUSE_ATTRIBUTE_ERR", DOMException::INUSE_ATTRIBUTE_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "INVALID_STATE_ERR", DOMException::INVALID_STATE_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "SYNTAX_ERR", DOMException::SYNTAX_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "INVALID_MODIFICATION_ERR", DOMException::INVALID_MODIFICATION_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "NAMESPACE_ERR", DOMException::NAMESPACE_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "INVALID_ACCESS_ERR", DOMException::INVALID_ACCESS_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "VALIDATION_ERR", DOMException::VALIDATION_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { "TYPE_MISMATCH_ERR", DOMException::TYPE_MISMATCH_ERR,
+ JSPROP_READONLY, GetEnumProperty },
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+//########################################################################
+//# DOMStringList
+//########################################################################
+
+/**
+ * Objects that implement the DOMStringList interface:
+ *
+ * Properties of objects that implement the DOMStringList interface:
+ *
+ * length
+ * This read-only property is a Number.
+ *
+ * Functions of objects that implement the DOMStringList interface:
+ *
+ * item(index)
+ * This function returns a String.
+ * The index parameter is a Number.
+ * Note: This object can also be dereferenced using square bracket
+ * notation (e.g. obj[1]). Dereferencing with an integer index
+ * is equivalent to invoking the item function with that index.
+ *
+ * contains(str)
+ * This function returns a Boolean.
+ * The str parameter is a String.
+ *
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS DOMStringList
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+//########################################################################
+//# NameList
+//########################################################################
+
+/**
+ * Objects that implement the NameList interface:
+ *
+ * Properties of objects that implement the NameList interface:
+ *
+ * length
+ * This read-only property is a Number.
+ *
+ * Functions of objects that implement the NameList interface:
+ *
+ * getName(index)
+ * This function returns a String.
+ * The index parameter is a Number.
+ * getNamespaceURI(index)
+ * This function returns a String.
+ * The index parameter is a Number.
+ * contains(str)
+ * This function returns a Boolean.
+ * The str parameter is a String.
+ * containsNS(namespaceURI, name)
+ * This function returns a Boolean.
+ * The namespaceURI parameter is a String.
+ * The name parameter is a String.
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS NameList
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+//########################################################################
+//# DOMImplementationList
+//########################################################################
+
+/**
+ * Objects that implement the DOMImplementationList interface:
+ *
+ * Properties of objects that implement the DOMImplementationList interface:
+ *
+ * length
+ * This read-only property is a Number.
+ *
+ * Functions of objects that implement the DOMImplementationList interface:
+ *
+ * item(index)
+ * This function returns an object that implements the
+ * DOMImplementation interface.
+ * The index parameter is a Number.
+ * Note: This object can also be dereferenced using square bracket
+ * notation (e.g. obj[1]). Dereferencing with an integer index
+ * is equivalent to invoking the item function with that index.
+ *
+ *
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS DOMImplementationList
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+//########################################################################
+//# DOMImplementationSource
+//########################################################################
+
+/**
+ * Objects that implement the DOMImplementationSource interface:
+ *
+ * Functions of objects that implement the DOMImplementationSource interface:
+ *
+ * getDOMImplementation(features)
+ * This function returns an object that implements the
+ * DOMImplementation interface.
+ * The features parameter is a String.
+ * getDOMImplementationList(features)
+ * This function returns an object that implements the
+ * DOMImplementationList interface.
+ * The features parameter is a String.
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS DOMImplementationSource
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+
+//########################################################################
+//# DOMImplementation
+//########################################################################
+
+/**
+ * Objects that implement the DOMImplementation interface:
+ *
+ * Functions of objects that implement the DOMImplementation interface:
+ *
+ * hasFeature(feature, version)
+ * This function returns a Boolean.
+ * The feature parameter is a String.
+ * The version parameter is a String.
+ * createDocumentType(qualifiedName, publicId, systemId)
+ * This function returns an object that implements the
+ * DocumentType interface.
+ * The qualifiedName parameter is a String.
+ * The publicId parameter is a String.
+ * The systemId parameter is a String.
+ * This function can raise an object that implements the
+ * DOMException interface.
+ * createDocument(namespaceURI, qualifiedName, doctype)
+ * This function returns an object that implements the
+ * Document interface.
+ * The namespaceURI parameter is a String.
+ * The qualifiedName parameter is a String.
+ * The doctype parameter is an object that implements the
+ * DocumentType interface.
+ * This function can raise an object that implements the
+ * DOMException interface.
+ * getFeature(feature, version)
+ * This function returns an object that implements
+ * the Object interface.
+ * The feature parameter is a String.
+ * The version parameter is a String.
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS DOMImplementation
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+
+
+//########################################################################
+//# DocumentFragment
+//########################################################################
+
+/**
+ * Objects that implement the DocumentFragment interface:
+ *
+ * Objects that implement the DocumentFragment interface have all
+ * properties and functions of the Node interface.
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS DocumentFragment
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+//########################################################################
+//# Document
+//########################################################################
+
+/**
+ * Objects that implement the Document interface:
+ *
+ * Objects that implement the Document interface have all properties
+ * and functions of the Node interface as well as the properties
+ * and functions defined below.
+ * Properties of objects that implement the Document interface:
+ *
+ *
+ * doctype
+ * This read-only property is an object that implements
+ * the DocumentType interface.
+ * implementation
+ * This read-only property is an object that implements
+ * the DOMImplementation interface.
+ * documentElement
+ * This read-only property is an object that implements
+ * the Element interface.
+ * inputEncoding
+ * This read-only property is a String.
+ * xmlEncoding
+ * This read-only property is a String.
+ * xmlStandalone
+ * This property is a Boolean and can raise an object
+ * that implements the DOMException interface on setting.
+ * xmlVersion
+ * This property is a String and can raise an object
+ * that implements the DOMException interface on setting.
+ * strictErrorChecking
+ * This property is a Boolean.
+ * documentURI
+ * This property is a String.
+ * domConfig
+ * This read-only property is an object that implements
+ * the DOMConfiguration interface.
+ *
+ *
+ * Functions of objects that implement the Document interface:
+ *
+ * createElement(tagName)
+ * This function returns an object that implements
+ * the Element interface.
+ * The tagName parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * createDocumentFragment()
+ * This function returns an object that implements
+ * the DocumentFragment interface.
+ * createTextNode(data)
+ * This function returns an object that implements
+ * the Text interface.
+ * The data parameter is a String.
+ * createComment(data)
+ * This function returns an object that implements
+ * the Comment interface.
+ * The data parameter is a String.
+ * createCDATASection(data)
+ * This function returns an object that implements
+ * the CDATASection interface.
+ * The data parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * createProcessingInstruction(target, data)
+ * This function returns an object that implements
+ * the ProcessingInstruction interface.
+ * The target parameter is a String.
+ * The data parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * createAttribute(name)
+ * This function returns an object that implements
+ * the Attr interface.
+ * The name parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * createEntityReference(name)
+ * This function returns an object that implements
+ * the EntityReference interface.
+ * The name parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * getElementsByTagName(tagname)
+ * This function returns an object that implements
+ * the NodeList interface.
+ * The tagname parameter is a String.
+ * importNode(importedNode, deep)
+ * This function returns an object that implements
+ * the Node interface.
+ * The importedNode parameter is an object that implements
+ * the Node interface.
+ * The deep parameter is a Boolean.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * createElementNS(namespaceURI, qualifiedName)
+ * This function returns an object that implements
+ * the Element interface.
+ * The namespaceURI parameter is a String.
+ * The qualifiedName parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * createAttributeNS(namespaceURI, qualifiedName)
+ * This function returns an object that implements
+ * the Attr interface.
+ * The namespaceURI parameter is a String.
+ * The qualifiedName parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * getElementsByTagNameNS(namespaceURI, localName)
+ * This function returns an object that implements
+ * the NodeList interface.
+ * The namespaceURI parameter is a String.
+ * The localName parameter is a String.
+ * getElementById(elementId)
+ * This function returns an object that implements
+ * the Element interface.
+ * The elementId parameter is a String.
+ * adoptNode(source)
+ * This function returns an object that implements
+ * the Node interface.
+ * The source parameter is an object that implements
+ * the Node interface.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * normalizeDocument()
+ * This function has no return value.
+ * renameNode(n, namespaceURI, qualifiedName)
+ * This function returns an object that implements
+ * the Node interface.
+ * The n parameter is an object that implements
+ * the Node interface.
+ * The namespaceURI parameter is a String.
+ * The qualifiedName parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS Document
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+ DocumentPtr doc;
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+//########################################################################
+//# Node
+//########################################################################
+
+/**
+ * Properties of the Node Constructor function:
+ *
+ * Node.ELEMENT_NODE
+ * The value of the constant Node.ELEMENT_NODE is 1.
+ * Node.ATTRIBUTE_NODE
+ * The value of the constant Node.ATTRIBUTE_NODE is 2.
+ * Node.TEXT_NODE
+ * The value of the constant Node.TEXT_NODE is 3.
+ * Node.CDATA_SECTION_NODE
+ * The value of the constant Node.CDATA_SECTION_NODE is 4.
+ * Node.ENTITY_REFERENCE_NODE
+ * The value of the constant Node.ENTITY_REFERENCE_NODE is 5.
+ * Node.ENTITY_NODE
+ * The value of the constant Node.ENTITY_NODE is 6.
+ * Node.PROCESSING_INSTRUCTION_NODE
+ * The value of the constant Node.PROCESSING_INSTRUCTION_NODE is 7.
+ * Node.COMMENT_NODE
+ * The value of the constant Node.COMMENT_NODE is 8.
+ * Node.DOCUMENT_NODE
+ * The value of the constant Node.DOCUMENT_NODE is 9.
+ * Node.DOCUMENT_TYPE_NODE
+ * The value of the constant Node.DOCUMENT_TYPE_NODE is 10.
+ * Node.DOCUMENT_FRAGMENT_NODE
+ * The value of the constant Node.DOCUMENT_FRAGMENT_NODE is 11.
+ * Node.NOTATION_NODE
+ * The value of the constant Node.NOTATION_NODE is 12.
+ * Node.DOCUMENT_POSITION_DISCONNECTED
+ * The value of the constant Node.DOCUMENT_POSITION_DISCONNECTED
+ * is 0x01.
+ * Node.DOCUMENT_POSITION_PRECEDING
+ * The value of the constant Node.DOCUMENT_POSITION_PRECEDING
+ * is 0x02.
+ * Node.DOCUMENT_POSITION_FOLLOWING
+ * The value of the constant Node.DOCUMENT_POSITION_FOLLOWING
+ * is 0x04.
+ * Node.DOCUMENT_POSITION_CONTAINS
+ * The value of the constant Node.DOCUMENT_POSITION_CONTAINS
+ * is 0x08.
+ * Node.DOCUMENT_POSITION_CONTAINED_BY
+ * The value of the constant Node.DOCUMENT_POSITION_CONTAINED_BY
+ * is 0x10.
+ * Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
+ * The value of the constant Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
+ * is 0x20.
+ *
+ * Objects that implement the Node interface:
+ *
+ * Properties of objects that implement the Node interface:
+ *
+ * nodeName
+ * This read-only property is a String.
+ * nodeValue
+ * This property is a String, can raise an object that implements
+ * the DOMException
+ * interface on setting and can raise an object that implements
+ * the DOMException
+ * interface on retrieval.
+ * nodeType
+ * This read-only property is a Number.
+ * parentNode
+ * This read-only property is an object that implements
+ * the Node interface.
+ * childNodes
+ * This read-only property is an object that implements
+ * the NodeList interface.
+ * firstChild
+ * This read-only property is an object that implements
+ * the Node interface.
+ * lastChild
+ * This read-only property is an object that implements
+ * the Node interface.
+ * previousSibling
+ * This read-only property is an object that implements
+ * the Node interface.
+ * nextSibling
+ * This read-only property is an object that implements
+ * the Node interface.
+ * attributes
+ * This read-only property is an object that implements
+ * the NamedNodeMap interface.
+ * ownerDocument
+ * This read-only property is an object that implements
+ * the Document interface.
+ * namespaceURI
+ * This read-only property is a String.
+ * prefix
+ * This property is a String and can raise an object
+ * that implements the DOMException interface on setting.
+ * localName
+ * This read-only property is a String.
+ * baseURI
+ * This read-only property is a String.
+ * textContent
+ * This property is a String, can raise an object that implements
+ * the DOMException interface on setting and can raise
+ * an object that implements the DOMException interface
+ * on retrieval.
+ *
+ *
+ * Functions of objects that implement the Node interface:
+ *
+ * insertBefore(newChild, refChild)
+ * This function returns an object that implements
+ * the Node interface.
+ * The newChild parameter is an object that implements
+ * the Node interface.
+ * The refChild parameter is an object that implements
+ * the Node interface.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * replaceChild(newChild, oldChild)
+ * This function returns an object that implements
+ * the Node interface.
+ * The newChild parameter is an object that implements
+ * the Node interface.
+ * The oldChild parameter is an object that implements
+ * the Node interface.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * removeChild(oldChild)
+ * This function returns an object that implements
+ * the Node interface.
+ * The oldChild parameter is an object that implements
+ * the Node interface.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * appendChild(newChild)
+ * This function returns an object that implements
+ * the Node interface.
+ * The newChild parameter is an object that implements
+ * the Node interface.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * hasChildNodes()
+ * This function returns a Boolean.
+ * cloneNode(deep)
+ * This function returns an object that implements
+ * the Node interface.
+ * The deep parameter is a Boolean.
+ * normalize()
+ * This function has no return value.
+ * isSupported(feature, version)
+ * This function returns a Boolean.
+ * The feature parameter is a String.
+ * The version parameter is a String.
+ * hasAttributes()
+ * This function returns a Boolean.
+ * compareDocumentPosition(other)
+ * This function returns a Number.
+ * The other parameter is an object that implements
+ * the Node interface.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * isSameNode(other)
+ * This function returns a Boolean.
+ * The other parameter is an object that implements
+ * the Node interface.
+ * lookupPrefix(namespaceURI)
+ * This function returns a String.
+ * The namespaceURI parameter is a String.
+ * isDefaultNamespace(namespaceURI)
+ * This function returns a Boolean.
+ * The namespaceURI parameter is a String.
+ * lookupNamespaceURI(prefix)
+ * This function returns a String.
+ * The prefix parameter is a String.
+ * isEqualNode(arg)
+ * This function returns a Boolean.
+ * The arg parameter is an object that implements
+ * the Node interface.
+ * getFeature(feature, version)
+ * This function returns an object that implements
+ * the Object interface.
+ * The feature parameter is a String.
+ * The version parameter is a String.
+ * setUserData(key, data, handler)
+ * This function returns an object that implements
+ * the any type interface.
+ * The key parameter is a String.
+ * The data parameter is an object that implements
+ * the any type interface.
+ * The handler parameter is an object that implements
+ * the UserDataHandler interface.
+ * getUserData(key)
+ * This function returns an object that implements
+ * the any type interface.
+ * The key parameter is a String.
+ *
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS Node
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+//########################################################################
+//# NodeList
+//########################################################################
+
+/**
+ * Objects that implement the NodeList interface:
+ *
+ * Properties of objects that implement the NodeList interface:
+ *
+ * length
+ * This read-only property is a Number.
+ *
+ * Functions of objects that implement the NodeList interface:
+ *
+ * item(index)
+ * This function returns an object that implements
+ * the Node interface.
+ * The index parameter is a Number.
+ * Note: This object can also be dereferenced using square
+ * bracket notation (e.g. obj[1]). Dereferencing with
+ * an integer index is equivalent to invoking the item
+ * function with that index.
+ *
+ *
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS NodeList
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+//########################################################################
+//# NamedNodeMap
+//########################################################################
+
+/**
+ * Objects that implement the NamedNodeMap interface:
+ *
+ * Properties of objects that implement the NamedNodeMap interface:
+ *
+ * length
+ * This read-only property is a Number.
+ *
+ * Functions of objects that implement the NamedNodeMap interface:
+ *
+ * getNamedItem(name)
+ * This function returns an object that implements
+ * the Node interface.
+ * The name parameter is a String.
+ * setNamedItem(arg)
+ * This function returns an object that implements
+ * the Node interface.
+ * The arg parameter is an object that implements
+ * the Node interface.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * removeNamedItem(name)
+ * This function returns an object that implements
+ * the Node interface.
+ * The name parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * item(index)
+ * This function returns an object that implements
+ * the Node interface.
+ * The index parameter is a Number.
+ * Note: This object can also be dereferenced using square
+ * bracket notation (e.g. obj[1]). Dereferencing with
+ * an integer index is equivalent to invoking the item
+ * function with that index.
+ * getNamedItemNS(namespaceURI, localName)
+ * This function returns an object that implements
+ * the Node interface.
+ * The namespaceURI parameter is a String.
+ * The localName parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * setNamedItemNS(arg)
+ * This function returns an object that implements
+ * the Node interface.
+ * The arg parameter is an object that implements
+ * the Node interface.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * removeNamedItemNS(namespaceURI, localName)
+ * This function returns an object that implements
+ * the Node interface.
+ * The namespaceURI parameter is a String.
+ * The localName parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ */
+
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS NamedNodeMap
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+//########################################################################
+//# CharacterData
+//########################################################################
+
+/**
+ * Objects that implement the CharacterData interface:
+ *
+ * Objects that implement the CharacterData interface have all
+ * properties and functions of the Node interface as well as
+ * the properties and functions defined below. Properties
+ * of objects that implement the CharacterData interface:
+ *
+ *
+ * data
+ * This property is a String, can raise an object
+ * that implements the DOMException interface on setting
+ * and can raise an object that implements the DOMException
+ * interface on retrieval.
+ * length
+ * This read-only property is a Number.
+ *
+ * Functions of objects that implement the CharacterData interface:
+ *
+ * substringData(offset, count)
+ * This function returns a String.
+ * The offset parameter is a Number.
+ * The count parameter is a Number.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * appendData(arg)
+ * This function has no return value.
+ * The arg parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * insertData(offset, arg)
+ * This function has no return value.
+ * The offset parameter is a Number.
+ * The arg parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * deleteData(offset, count)
+ * This function has no return value.
+ * The offset parameter is a Number.
+ * The count parameter is a Number.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * replaceData(offset, count, arg)
+ * This function has no return value.
+ * The offset parameter is a Number.
+ * The count parameter is a Number.
+ * The arg parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS CharacterData
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+
+
+//########################################################################
+//# Attr
+//########################################################################
+
+/**
+ * Objects that implement the Attr interface:
+ *
+ * Objects that implement the Attr interface have all properties
+ * and functions of the Node interface as well as the properties
+ * and functions defined below.
+ * Properties of objects that implement the Attr interface:
+ *
+ *
+ * name
+ * This read-only property is a String.
+ * specified
+ * This read-only property is a Boolean.
+ * value
+ * This property is a String and can raise an object
+ * that implements the DOMException interface on setting.
+ * ownerElement
+ * This read-only property is an object that implements
+ * the Element interface.
+ * schemaTypeInfo
+ * This read-only property is an object that implements
+ * the TypeInfo interface.
+ * isId
+ * This read-only property is a Boolean.
+ *
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS Attr
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+//########################################################################
+//# Element
+//########################################################################
+
+/**
+ * Objects that implement the Element interface:
+ *
+ * Objects that implement the Element interface have all properties
+ * and functions of the Node interface as well as the properties
+ * and functions defined below.
+ * Properties of objects that implement the Element interface:
+ *
+ *
+ * tagName
+ * This read-only property is a String.
+ * schemaTypeInfo
+ * This read-only property is an object that implements
+ * the TypeInfo interface.
+ *
+ * Functions of objects that implement the Element interface:
+ *
+ * getAttribute(name)
+ * This function returns a String.
+ * The name parameter is a String.
+ * setAttribute(name, value)
+ * This function has no return value.
+ * The name parameter is a String.
+ * The value parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * removeAttribute(name)
+ * This function has no return value.
+ * The name parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * getAttributeNode(name)
+ * This function returns an object that implements
+ * the Attr interface.
+ * The name parameter is a String.
+ * setAttributeNode(newAttr)
+ * This function returns an object that implements
+ * the Attr interface.
+ * The newAttr parameter is an object that implements
+ * the Attr interface.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * removeAttributeNode(oldAttr)
+ * This function returns an object that implements
+ * the Attr interface.
+ * The oldAttr parameter is an object that implements
+ * the Attr interface.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * getElementsByTagName(name)
+ * This function returns an object that implements
+ * the NodeList interface.
+ * The name parameter is a String.
+ * getAttributeNS(namespaceURI, localName)
+ * This function returns a String.
+ * The namespaceURI parameter is a String.
+ * The localName parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * setAttributeNS(namespaceURI, qualifiedName, value)
+ * This function has no return value.
+ * The namespaceURI parameter is a String.
+ * The qualifiedName parameter is a String.
+ * The value parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * removeAttributeNS(namespaceURI, localName)
+ * This function has no return value.
+ * The namespaceURI parameter is a String.
+ * The localName parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * getAttributeNodeNS(namespaceURI, localName)
+ * This function returns an object that implements
+ * the Attr interface.
+ * The namespaceURI parameter is a String.
+ * The localName parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * setAttributeNodeNS(newAttr)
+ * This function returns an object that implements
+ * the Attr interface.
+ * The newAttr parameter is an object that implements
+ * the Attr interface.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * getElementsByTagNameNS(namespaceURI, localName)
+ * This function returns an object that implements
+ * the NodeList interface.
+ * The namespaceURI parameter is a String.
+ * The localName parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * hasAttribute(name)
+ * This function returns a Boolean.
+ * The name parameter is a String.
+ * hasAttributeNS(namespaceURI, localName)
+ * This function returns a Boolean.
+ * The namespaceURI parameter is a String.
+ * The localName parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * setIdAttribute(name, isId)
+ * This function has no return value.
+ * The name parameter is a String.
+ * The isId parameter is a Boolean.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * setIdAttributeNS(namespaceURI, localName, isId)
+ * This function has no return value.
+ * The namespaceURI parameter is a String.
+ * The localName parameter is a String.
+ * The isId parameter is a Boolean.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * setIdAttributeNode(idAttr, isId)
+ * This function has no return value.
+ * The idAttr parameter is an object that implements
+ * the Attr interface.
+ * The isId parameter is a Boolean.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS Element
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+//########################################################################
+//# Text
+//########################################################################
+
+/**
+ * Objects that implement the Text interface:
+ *
+ * Objects that implement the Text interface have all properties
+ * and functions of the CharacterData interface as well as
+ * the properties and functions defined below. Properties of objects
+ * that implement the Text interface:
+ *
+ *
+ * isElementContentWhitespace
+ * This read-only property is a Boolean.
+ * wholeText
+ * This read-only property is a String.
+ *
+ * Functions of objects that implement the Text interface:
+ *
+ * splitText(offset)
+ * This function returns an object that implements
+ * the Text interface.
+ * The offset parameter is a Number.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * replaceWholeText(content)
+ * This function returns an object that implements
+ * the Text interface.
+ * The content parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS Text
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+//########################################################################
+//# Comment
+//########################################################################
+
+/**
+ * Objects that implement the Comment interface:
+ *
+ * Objects that implement the Comment interface have all properties
+ * and functions of the CharacterData interface.
+ *
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS Comment
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+
+//########################################################################
+//# TypeInfo
+//########################################################################
+
+/**
+ * Properties of the TypeInfo Constructor function:
+ *
+ * TypeInfo.DERIVATION_RESTRICTION
+ * The value of the constant TypeInfo.DERIVATION_RESTRICTION
+ * is 0x00000001.
+ * TypeInfo.DERIVATION_EXTENSION
+ * The value of the constant TypeInfo.DERIVATION_EXTENSION
+ * is 0x00000002.
+ * TypeInfo.DERIVATION_UNION
+ * The value of the constant TypeInfo.DERIVATION_UNION
+ * is 0x00000004.
+ * TypeInfo.DERIVATION_LIST
+ * The value of the constant TypeInfo.DERIVATION_LIST
+ * is 0x00000008.
+ *
+ * Objects that implement the TypeInfo interface:
+ *
+ * Properties of objects that implement the TypeInfo interface:
+ *
+ * typeName
+ * This read-only property is a String.
+ * typeNamespace
+ * This read-only property is a String.
+ *
+ * Functions of objects that implement the TypeInfo interface:
+ *
+ * isDerivedFrom(typeNamespaceArg, typeNameArg, derivationMethod)
+ * This function returns a Boolean.
+ * The typeNamespaceArg parameter is a String.
+ * The typeNameArg parameter is a String.
+ * The derivationMethod parameter is a Number.
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS TypeInfo
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+
+
+
+//########################################################################
+//# UserDataHandler
+//########################################################################
+
+/**
+ * Properties of the UserDataHandler Constructor function:
+ *
+ * UserDataHandler.NODE_CLONED
+ * The value of the constant UserDataHandler.NODE_CLONED is 1.
+ * UserDataHandler.NODE_IMPORTED
+ * The value of the constant UserDataHandler.NODE_IMPORTED is 2.
+ * UserDataHandler.NODE_DELETED
+ * The value of the constant UserDataHandler.NODE_DELETED is 3.
+ * UserDataHandler.NODE_RENAMED
+ * The value of the constant UserDataHandler.NODE_RENAMED is 4.
+ * UserDataHandler.NODE_ADOPTED
+ * The value of the constant UserDataHandler.NODE_ADOPTED is 5.
+ *
+ * UserDataHandler function:
+ * This function has no return value.
+ * The first parameter is a Number.
+ * The second parameter is a String.
+ * The third parameter is an object that implements the any
+ * type interface.
+ * The fourth parameter is an object that implements the Node
+ * interface.
+ * The fifth parameter is an object that implements the Node interface.
+ * Properties of the DOMError Constructor function:
+ *
+ *
+ * DOMError.SEVERITY_WARNING
+ * The value of the constant DOMError.SEVERITY_WARNING is 1.
+ * DOMError.SEVERITY_ERROR
+ * The value of the constant DOMError.SEVERITY_ERROR is 2.
+ * DOMError.SEVERITY_FATAL_ERROR
+ * The value of the constant DOMError.SEVERITY_FATAL_ERROR is 3.
+ */
+
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS UserDataHandler
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+//########################################################################
+//# DOMError
+//########################################################################
+
+/**
+ * Objects that implement the DOMError interface:
+ *
+ * Properties of objects that implement the DOMError interface:
+ *
+ * severity
+ * This read-only property is a Number.
+ * message
+ * This read-only property is a String.
+ * type
+ * This read-only property is a String.
+ * relatedException
+ * This read-only property is an object that implements
+ * the Object interface.
+ * relatedData
+ * This read-only property is an object that implements
+ * the Object interface.
+ * location
+ * This read-only property is an object that implements
+ * the DOMLocator interface.
+ *
+ * DOMErrorHandler function:
+ * This function returns a Boolean.
+ * The parameter is an object that implements the
+ * DOMError interface.
+ *
+ *
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS DOMError
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+//########################################################################
+//# DOMLocator
+//########################################################################
+
+/**
+ * Objects that implement the DOMLocator interface:
+ *
+ * Properties of objects that implement the DOMLocator interface:
+ *
+ * lineNumber
+ * This read-only property is a Number.
+ * columnNumber
+ * This read-only property is a Number.
+ * byteOffset
+ * This read-only property is a Number.
+ * utf16Offset
+ * This read-only property is a Number.
+ * relatedNode
+ * This read-only property is an object that implements
+ * the Node interface.
+ * uri
+ * This read-only property is a String.
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS DOMLocator
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+
+
+//########################################################################
+//# DOMConfiguration
+//########################################################################
+
+/**
+ * Objects that implement the DOMConfiguration interface:
+ *
+ * Properties of objects that implement the DOMConfiguration interface:
+ *
+ * parameterNames
+ * This read-only property is an object that implements
+ * the DOMStringList interface.
+ *
+ * Functions of objects that implement the DOMConfiguration interface:
+ *
+ * setParameter(name, value)
+ * This function has no return value.
+ * The name parameter is a String.
+ * The value parameter is an object that implements
+ * the any type interface.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * getParameter(name)
+ * This function returns an object that implements
+ * the any type interface.
+ * The name parameter is a String.
+ * This function can raise an object that implements
+ * the DOMException interface.
+ * canSetParameter(name, value)
+ * This function returns a Boolean.
+ * The name parameter is a String.
+ * The value parameter is an object that implements
+ * the any type interface.
+ */
+
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS DOMConfiguration
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+
+//########################################################################
+//# CDATASection
+//########################################################################
+
+/**
+ * Objects that implement the CDATASection interface:
+ *
+ * Objects that implement the CDATASection interface
+ * have all properties and functions of the Text interface.
+ *
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS CDATASection
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+
+
+//########################################################################
+//# DocumentType
+//########################################################################
+
+/**
+ * Objects that implement the DocumentType interface:
+ *
+ * Objects that implement the DocumentType interface have all
+ * properties and functions of the Node interface as well as
+ * the properties and functions defined below.
+ * Properties of objects that implement the DocumentType interface:
+ *
+ *
+ * name
+ * This read-only property is a String.
+ * entities
+ * This read-only property is an object that implements
+ * the NamedNodeMap interface.
+ * notations
+ * This read-only property is an object that implements
+ * the NamedNodeMap interface.
+ * publicId
+ * This read-only property is a String.
+ * systemId
+ * This read-only property is a String.
+ * internalSubset
+ * This read-only property is a String.
+ */
+
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS DocumentType
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+//########################################################################
+//# Notation
+//########################################################################
+
+/**
+ * Objects that implement the Notation interface:
+ *
+ * Objects that implement the Notation interface have all
+ * properties and functions of the Node interface as well as
+ * the properties and functions defined below.
+ * Properties of objects that implement the Notation interface:
+ *
+ *
+ * publicId
+ * This read-only property is a String.
+ * systemId
+ * This read-only property is a String.
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS Notation
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+
+//########################################################################
+//# Entity
+//########################################################################
+
+/**
+ * Objects that implement the Entity interface:
+ *
+ * Objects that implement the Entity interface have all properties
+ * and functions of the Node interface as well as the properties
+ * and functions defined below.
+ * Properties of objects that implement the Entity interface:
+ *
+ *
+ * publicId
+ * This read-only property is a String.
+ * systemId
+ * This read-only property is a String.
+ * notationName
+ * This read-only property is a String.
+ * inputEncoding
+ * This read-only property is a String.
+ * xmlEncoding
+ * This read-only property is a String.
+ * xmlVersion
+ * This read-only property is a String.
+ */
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS Entity
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+
+//########################################################################
+//# EntityReference
+//########################################################################
+
+/**
+ * Objects that implement the EntityReference interface:
+ *
+ * Objects that implement the EntityReference interface have all
+ * properties and functions of the Node interface.
+ *
+ */
+
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS EntityReference
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+//########################################################################
+//# ProcessingInstruction
+//########################################################################
+
+/**
+ * Objects that implement the ProcessingInstruction interface:
+ *
+ * Objects that implement the ProcessingInstruction interface
+ * have all properties and functions of the Node interface
+ * as well as the properties and functions defined below.
+ * Properties of objects that implement the ProcessingInstruction
+ * interface:
+ *
+ * target
+ * This read-only property is a String.
+ * data
+ * This property is a String and can raise an object
+ * that implements the DOMException interface on setting.
+ *
+ */
+
+
+#undef CURRENT_CLASS
+#define CURRENT_CLASS ProcessingInstruction
+
+class CLASS_NAME(CURRENT_CLASS) : public Wrapper
+{
+public:
+
+ CLASS_NAME(CURRENT_CLASS)(JSContext*cx, JSObject *obj)
+ : Wrapper(cx, obj)
+ {}
+
+ ~CLASS_NAME(CURRENT_CLASS)()
+ {}
+
+ JSBool init(uintN argc, jsval *argv)
+ {
+ return JS_TRUE;
+ }
+
+ JSBool getProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ JSBool setProperty(jsval id, jsval *vp)
+ {
+ return JS_FALSE;
+ }
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementation)
+ {
+ return JS_FALSE;
+ }
+
+
+ /**
+ *
+ */
+ METHOD(getDOMImplementationList)
+ {
+ return JS_FALSE;
+ }
+
+ enum
+ {
+ prop_code
+ };
+
+};
+
+
+
+
+JSPropertySpec PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSPropertySpec STATIC_PROPERTY_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+JSFunctionSpec STATIC_METHOD_TABLE(CURRENT_CLASS)[] =
+{
+ { 0 }
+};
+
+
+CONSTRUCTOR ( CURRENT_CLASS )
+
+
+
+
+
+
+/**
+ * Note: In addition of having DOMConfiguration parameters
+ * exposed to the application using the setParameter
+ * and getParameter, those parameters are also exposed
+ * as ECMAScript properties on the DOMConfiguration object.
+ * The name of the parameter is converted into a property name
+ * using a camel-case convention:
+ * the character '-' (HYPHEN-MINUS) is removed
+ * and the following character is
+ * being replaced by its uppercase equivalent.
+ */
+
+
+
+
+
+//########################################################################
+//# M A I N B I N D I N G
+//########################################################################
+
+bool JavascriptDOMBinder::createClasses()
+{
+ void *savedContext = JS_GetContextPrivate(cx);
+ JS_SetContextPrivate(cx, (void *)this);
+
+ proto_Node =
+ CREATE_PROTO(Node, cx, globalObj, NULL);
+ proto_CharacterData =
+ CREATE_PROTO(CharacterData, cx, globalObj, proto_Node);
+ proto_Text =
+ CREATE_PROTO(Text, cx, globalObj, proto_CharacterData);
+ proto_CDATASection =
+ CREATE_PROTO(CDATASection, cx, globalObj, proto_Text);
+ proto_Document =
+ CREATE_PROTO(Document, cx, globalObj, proto_CDATASection);
+
+ JS_SetContextPrivate(cx, savedContext);
+ return true;
+}
+
+
+JSObject *JavascriptDOMBinder::wrapDocument(const Document *doc)
+{
+ if (!doc)
+ {
+ error("wrapDocument: null document parameter");
+ return NULL;
+ }
+
+ JSObject *jsdoc = JS_NewObject(cx, &wrapperClassDef,
+ proto_Document, NULL);
+
+ //Wrap around the document... done!
+ CLASS_NAME(Document) *docWrap = new CLASS_NAME(Document)(cx, globalObj);
+ docWrap->doc = doc;
+ JS_SetPrivate(cx, jsdoc, (void *)docWrap);
+
+ return jsdoc;
+}
+
+
+
+
+} // namespace dom
+} // namespace w3c
+} // namespace org
+
+//########################################################################
+//# E N D O F F I L E
+//########################################################################
+
diff --git a/src/dom/jsdombind.h b/src/dom/jsdombind.h
--- /dev/null
+++ b/src/dom/jsdombind.h
@@ -0,0 +1,156 @@
+#ifndef __JSDOMBIND_H__
+#define __JSDOMBIND_H__
+/**
+ * Phoebe DOM Implementation.
+ *
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "jsengine.h"
+
+
+namespace org
+{
+namespace w3c
+{
+namespace dom
+{
+
+
+/**
+ * Wrap the W3C DOM Core classes around a JavascriptEngine.
+ */
+class JavascriptDOMBinder
+{
+public:
+
+ /**
+ * Constructor
+ */
+ JavascriptDOMBinder(JavascriptEngine &someEngine)
+ : engine(someEngine)
+ { init(); }
+
+
+ /**
+ * Destructor
+ */
+ virtual ~JavascriptDOMBinder()
+ { }
+
+
+ JSObject *wrapDocument(const Document *doc);
+
+ /**
+ * Bind with the basic DOM classes
+ */
+ bool createClasses();
+
+ JSObject *proto_Attr;
+ JSObject *proto_CDATASection;
+ JSObject *proto_CharacterData;
+ JSObject *proto_Comment;
+ JSObject *proto_Document;
+ JSObject *proto_DocumentFragment;
+ JSObject *proto_DocumentType;
+ JSObject *proto_DOMConfiguration;
+ JSObject *proto_DOMError;
+ JSObject *proto_DOMException;
+ JSObject *proto_DOMImplementation;
+ JSObject *proto_DOMImplementationList;
+ JSObject *proto_DOMImplementationRegistry;
+ JSObject *proto_DOMImplementationSource;
+ JSObject *proto_DOMLocator;
+ JSObject *proto_DOMStringList;
+ JSObject *proto_Element;
+ JSObject *proto_Entity;
+ JSObject *proto_EntityReference;
+ JSObject *proto_NamedNodeMap;
+ JSObject *proto_NameList;
+ JSObject *proto_Node;
+ JSObject *proto_NodeList;
+ JSObject *proto_Notation;
+ JSObject *proto_ProcessingInstruction;
+ JSObject *proto_Text;
+ JSObject *proto_TypeInfo;
+ JSObject *proto_UserDataHandler;
+
+private:
+
+ void init()
+ {
+ rt = engine.getRuntime();
+ cx = engine.getContext();
+ globalObj = engine.getGlobalObject();
+ }
+
+ /**
+ * Assignment operator. Let's keep this private for now,
+ * as we want one Spidermonkey runtime per c++ shell
+ */
+ JavascriptDOMBinder &operator=(const JavascriptDOMBinder &other)
+ { assign(other); return *this; }
+
+ void assign(const JavascriptDOMBinder &other)
+ {
+ rt = other.rt;
+ cx = other.cx;
+ globalObj = other.globalObj;
+ }
+
+
+ /**
+ * Ouput a printf-formatted error message
+ */
+ void error(char *fmt, ...);
+
+ /**
+ * Ouput a printf-formatted error message
+ */
+ void trace(char *fmt, ...);
+
+ JSRuntime *rt;
+
+ JSContext *cx;
+
+ JSObject *globalObj;
+
+
+
+ JavascriptEngine &engine;
+};
+
+
+
+} // namespace dom
+} // namespace w3c
+} // namespace org
+
+
+#endif /* __JSDOMBIND_H__ */
+
+
diff --git a/src/dom/jsengine.cpp b/src/dom/jsengine.cpp
index c3c017dc6954518a18201abaccebb2657626f93b..38b856c3c83aa30fb89dd23dfd47cfcd73d6749b 100644 (file)
--- a/src/dom/jsengine.cpp
+++ b/src/dom/jsengine.cpp
#include "jsengine.h"
+#include "jsdombind.h"
#include <stdio.h>
#include <stdarg.h>
return true;
}
+/**
+ * Bind with the basic DOM classes
+ */
+bool JavascriptEngine::createClasses()
+{
+ JavascriptDOMBinder binder(*this);
+ binder.createClasses();
+ return true;
+}
diff --git a/src/dom/jsengine.h b/src/dom/jsengine.h
index aa7297f9cd6d8aa9484d056d945c50188cb9a9d2..abcbb23e91457bd29d36b3db6d00d1ac672b9731 100644 (file)
--- a/src/dom/jsengine.h
+++ b/src/dom/jsengine.h
bool evaluateFile(const DOMString &script);
- JSObject *wrapDocument(const Document *doc);
-
- JSObject *new_Attr(Attr *obj);
- JSObject *new_CDATASection(CDATASection *obj);
- JSObject *new_CharacterData(CharacterData *obj);
- JSObject *new_Comment(Comment *obj);
- JSObject *new_Document(Document *obj);
- JSObject *new_DocumentFragment(DocumentFragment *obj);
- JSObject *new_DocumentType(DocumentType *obj);
- JSObject *new_DOMConfiguration(DOMConfiguration *obj);
- JSObject *new_DOMError(DOMError *obj);
- JSObject *new_DOMException(DOMException *obj);
- JSObject *new_DOMImplementation(DOMImplementation *obj);
- JSObject *new_DOMImplementationList(DOMImplementationList *obj);
- JSObject *new_DOMImplementationRegistry(DOMImplementationSource *obj);
- JSObject *new_DOMImplementationSource(DOMImplementationSource *obj);
- JSObject *new_DOMLocator(DOMLocator *obj);
- JSObject *new_DOMStringList(DOMStringList *obj);
- JSObject *new_Element(Element *obj);
- JSObject *new_Entity(Entity *obj);
- JSObject *new_EntityReference(EntityReference *obj);
- JSObject *new_NamedNodeMap(NamedNodeMap *obj);
- JSObject *new_NameList(NameList *obj);
- JSObject *new_Node(Node *obj);
- JSObject *new_NodeList(NodeList *obj);
- JSObject *new_Notation(Notation *obj);
- JSObject *new_ProcessingInstruction(ProcessingInstruction *obj);
- JSObject *new_Text(Text *obj);
- JSObject *new_TypeInfo(TypeInfo *obj);
- JSObject *new_UserDataHandler(UserDataHandler *obj);
+ /**
+ * Return the runtime of the wrapped JS engine
+ */
+ JSRuntime *getRuntime()
+ { return rt; }
+
+ /**
+ * Return the current context of the wrapped JS engine
+ */
+ JSContext *getContext()
+ { return cx; }
+
+ /**
+ * Return the current global object of the wrapped JS engine
+ */
+ JSObject *getGlobalObject()
+ { return globalObj; }
+
private:
engine->error((char *)message);
}
- JSObject *proto_Attr;
- JSObject *proto_CDATASection;
- JSObject *proto_CharacterData;
- JSObject *proto_Comment;
- JSObject *proto_Document;
- JSObject *proto_DocumentFragment;
- JSObject *proto_DocumentType;
- JSObject *proto_DOMConfiguration;
- JSObject *proto_DOMError;
- JSObject *proto_DOMException;
- JSObject *proto_DOMImplementation;
- JSObject *proto_DOMImplementationList;
- JSObject *proto_DOMImplementationRegistry;
- JSObject *proto_DOMImplementationSource;
- JSObject *proto_DOMLocator;
- JSObject *proto_DOMStringList;
- JSObject *proto_Element;
- JSObject *proto_Entity;
- JSObject *proto_EntityReference;
- JSObject *proto_NamedNodeMap;
- JSObject *proto_NameList;
- JSObject *proto_Node;
- JSObject *proto_NodeList;
- JSObject *proto_Notation;
- JSObject *proto_ProcessingInstruction;
- JSObject *proto_Text;
- JSObject *proto_TypeInfo;
- JSObject *proto_UserDataHandler;
diff --git a/src/dom/ls.h b/src/dom/ls.h
index b6f98bf8bcd4c5ec84e97500b98e1946a555a17d..db009e234c15e47bbbf4d59c8fcf7cf3d137ab18 100644 (file)
--- a/src/dom/ls.h
+++ b/src/dom/ls.h
typedef dom::DOMString DOMString;
typedef dom::DOMConfiguration DOMConfiguration;
typedef dom::Node Node;
+typedef dom::NodePtr NodePtr;
typedef dom::Document Document;
+typedef dom::DocumentPtr DocumentPtr;
typedef dom::Element Element;
+typedef dom::ElementPtr ElementPtr;
//forward declarations
/**
*
*/
- virtual unsigned short startElement(const Element *elementArg) =0;
+ virtual unsigned short startElement(const ElementPtr elementArg) =0;
/**
*
*/
- virtual unsigned short acceptNode(const Node *nodeArg) =0;
+ virtual unsigned short acceptNode(const NodePtr nodeArg) =0;
/**
*
/**
*
*/
- virtual Document *parse(const LSInput &input)
- throw(dom::DOMException, LSException)
+ virtual DocumentPtr parse(const LSInput &input)
+ throw(dom::DOMException, LSException)
{ return NULL; }
/**
*
*/
- virtual Document *parseURI(const DOMString &uri)
- throw(dom::DOMException, LSException)
+ virtual DocumentPtr parseURI(const DOMString &uri)
+ throw(dom::DOMException, LSException)
{ return NULL; }
typedef enum
/**
*
*/
- virtual Node *parseWithContext(const LSInput &input,
- const Node *contextArg,
- unsigned short action)
- throw(dom::DOMException, LSException)
+ virtual NodePtr parseWithContext(const LSInput &input,
+ const NodePtr contextArg,
+ unsigned short action)
+ throw(dom::DOMException, LSException)
{ return NULL; }
/**
/**
*
*/
- virtual bool write(const Node *nodeArg,
+ virtual bool write(const NodePtr nodeArg,
const LSOutput &destination)
throw (LSException)
{ return false; }
/**
*
*/
- virtual bool writeToURI(const Node *nodeArg,
+ virtual bool writeToURI(const NodePtr nodeArg,
const DOMString &uri)
throw(LSException)
{ return false; }
/**
*
*/
- virtual DOMString writeToString(const Node *nodeArg)
+ virtual DOMString writeToString(const NodePtr nodeArg)
throw(dom::DOMException, LSException)
{
DOMString str;
/**
*
*/
- virtual Document *getNewDocument()
+ virtual DocumentPtr getNewDocument()
{ return newDocument; }
/**
/**
*
*/
- LSLoadEvent(const LSInput &inputArg, const Document *docArg)
+ LSLoadEvent(const LSInput &inputArg,
+ const DocumentPtr docArg)
: input((LSInput &)inputArg)
- { newDocument = (Document *)docArg; }
+ { newDocument = docArg; }
/**
*
*/
- LSLoadEvent(const LSLoadEvent &other) : events::Event(other) , input(other.input)
+ LSLoadEvent(const LSLoadEvent &other)
+ : events::Event(other) , input(other.input)
{
newDocument = other.newDocument;
}
protected:
- Document *newDocument;
+ DocumentPtr newDocument;
LSInput &input;
diff --git a/src/dom/lsimpl.cpp b/src/dom/lsimpl.cpp
index 65807cc459ea4ca088fc2bea6e65d863d94e45ba..8848a42e4250e7aceab6af9a17b1a6a71486c99f 100644 (file)
--- a/src/dom/lsimpl.cpp
+++ b/src/dom/lsimpl.cpp
/**
*
*/
-Document *LSParserImpl::parse(const LSInput &input)
- throw(dom::DOMException, LSException)
+DocumentPtr LSParserImpl::parse(const LSInput &input)
+ throw(dom::DOMException, LSException)
{
//#### Check the various inputs of 'input' in order, according
buf.push_back((XMLCh)ch);
}
XmlReader reader;
- Document *doc = reader.parse(buf);
+ DocumentPtr doc = reader.parse(buf);
return doc;
}
buf.push_back((XMLCh)ch);
}
XmlReader reader;
- Document *doc = reader.parse(buf);
+ DocumentPtr doc = reader.parse(buf);
return doc;
}
DOMString stringData = input.getStringData();
if (stringData.size() > 0)
{
- XmlReader reader;
- Document *doc = reader.parse(stringData);
+ XmlReader reader;
+ DocumentPtr doc = reader.parse(stringData);
return doc;
}
/**
*
*/
-Document *LSParserImpl::parseURI(const DOMString &uri)
- throw(dom::DOMException, LSException)
+DocumentPtr LSParserImpl::parseURI(const DOMString &uri)
+ throw(dom::DOMException, LSException)
{
return NULL;
}
/**
*
*/
-Node *LSParserImpl::parseWithContext(const LSInput &input,
- const Node *contextArg,
- unsigned short action)
- throw(dom::DOMException, LSException)
+NodePtr LSParserImpl::parseWithContext(const LSInput &input,
+ const NodePtr contextArg,
+ unsigned short action)
+ throw(dom::DOMException, LSException)
{
return NULL;
}
*
*/
bool LSSerializerImpl::write(
- const Node *nodeArg,
+ const NodePtr nodeArg,
const LSOutput &destination)
throw (LSException)
{
/**
*
*/
-bool LSSerializerImpl::writeToURI(const Node *nodeArg,
+bool LSSerializerImpl::writeToURI(const NodePtr nodeArg,
const DOMString &uriArg)
throw(LSException)
{
/**
*
*/
-DOMString LSSerializerImpl::writeToString(const Node *nodeArg)
+DOMString LSSerializerImpl::writeToString(const NodePtr nodeArg)
throw(dom::DOMException, LSException)
{
outbuf = "";
/**
*
*/
-void LSSerializerImpl::writeNode(const Node *nodeArg)
+void LSSerializerImpl::writeNode(const NodePtr nodeArg)
{
- Node *node = (Node *)nodeArg;
+ NodePtr node = nodeArg;
int type = node->getNodeType();
//#############
case Node::DOCUMENT_NODE:
{
- Document *doc = dynamic_cast<Document *>(node);
+ DocumentPtr doc = dynamic_cast<Document *>(node.get());
writeNode(doc->getDocumentElement());
}
break;
//### Attributes
for (int i=0 ; i<nrAttrs ; i++)
{
- Node *attr = attributes.item(i);
+ NodePtr attr = attributes.item(i);
spaces();
pos(attr->getNodeName());
po("=\"");
pos(node->getNodeValue());
//### Children
- for (Node *child = node->getFirstChild() ;
- child ;
+ for (NodePtr child = node->getFirstChild() ;
+ child.get() ;
child=child->getNextSibling())
{
writeNode(child);
diff --git a/src/dom/lsimpl.h b/src/dom/lsimpl.h
index ee63601431c31e116ce64345a6304ff13f9e74c5..0f0088684d4828de8b774c54668a6f929339ad5c 100644 (file)
--- a/src/dom/lsimpl.h
+++ b/src/dom/lsimpl.h
/**
*
*/
- virtual Document *parse(const LSInput &input)
- throw(dom::DOMException, LSException);
+ virtual DocumentPtr parse(const LSInput &input)
+ throw(dom::DOMException, LSException);
/**
*
*/
- virtual Document *parseURI(const DOMString &uri)
- throw(dom::DOMException, LSException);
+ virtual DocumentPtr parseURI(const DOMString &uri)
+ throw(dom::DOMException, LSException);
/**
*
*/
- virtual Node *parseWithContext(const LSInput &input,
- const Node *contextArg,
- unsigned short action)
- throw(dom::DOMException, LSException);
+ virtual NodePtr parseWithContext(const LSInput &input,
+ const NodePtr contextArg,
+ unsigned short action)
+ throw(dom::DOMException, LSException);
//##################
/**
*
*/
- virtual unsigned short startElement(const Element *elementArg)
+ virtual unsigned short startElement(const ElementPtr elementArg)
{ return 0; }
/**
*
*/
- virtual unsigned short acceptNode(const Node *nodeArg)
+ virtual unsigned short acceptNode(const NodePtr nodeArg)
{ return 0; }
/**
/**
*
*/
- virtual bool write(const Node *nodeArg,
+ virtual bool write(const NodePtr nodeArg,
const LSOutput &destination)
throw (LSException);
/**
*
*/
- virtual bool writeToURI(const Node *nodeArg,
+ virtual bool writeToURI(const NodePtr nodeArg,
const DOMString &uri)
throw(LSException);
/**
*
*/
- virtual DOMString writeToString(const Node *nodeArg)
+ virtual DOMString writeToString(const NodePtr nodeArg)
throw(dom::DOMException, LSException);
//##################
/**
*
*/
- void writeNode(const Node *nodeArg);
+ void writeNode(const NodePtr nodeArg);
private:
diff --git a/src/dom/mingwenv.bat b/src/dom/mingwenv.bat
index 996566e7b3d37f7d2fc23ee07618ee56221c9470..f9ec1e7c51b33d0cdd22e5970560d3d56cb733b3 100644 (file)
--- a/src/dom/mingwenv.bat
+++ b/src/dom/mingwenv.bat
-set PATH=c:\mingw\bin;%PATH%\r
+set PATH=c:\mingw4\bin;%PATH%\r
set RM=del\r
diff --git a/src/dom/stylesheets.h b/src/dom/stylesheets.h
index b0d3f0c71c8c5365e5f2fa7fa8567619d76a5ba4..e41b6775d5034f5f4568352ed6e4be22537d5f39 100644 (file)
--- a/src/dom/stylesheets.h
+++ b/src/dom/stylesheets.h
/**
*
*/
- virtual Node *getOwnerNode()
+ virtual NodePtr getOwnerNode()
{
return ownerNode;
}
bool disabled;
- Node *ownerNode;
+ NodePtr ownerNode;
StyleSheet *parentStylesheet;
diff --git a/src/dom/svg/svg.h b/src/dom/svg/svg.h
index 0bf44b8171c82f6c6050583df4d43feb93c4f78f..c5f3309b5452a752986742e25fefb36387573a6f 100644 (file)
--- a/src/dom/svg/svg.h
+++ b/src/dom/svg/svg.h
typedef dom::DOMString DOMString;
typedef dom::DOMException DOMException;
typedef dom::Element Element;
+typedef dom::ElementPtr ElementPtr;
typedef dom::Document Document;
+typedef dom::DocumentPtr DocumentPtr;
typedef dom::NodeList NodeList;
-class SVGSVGElement;
+class SVGElement;
+typedef Ptr<SVGElement> SVGElementPtr;
+class SVGSVGElement;
+typedef Ptr<SVGSVGElement> SVGSVGElementPtr;
+class SVGDocument;
+typedef Ptr<SVGDocument> SVGDocumentPtr;
/*#########################################################################
/**
*
*/
- virtual SVGSVGElement *getOwnerSVGElement() = 0;
+ virtual SVGSVGElementPtr getOwnerSVGElement() = 0;
/**
*
*/
- virtual SVGElement *getViewportElement() = 0;
+ virtual SVGElementPtr getViewportElement() = 0;
//##################
/**
*
*/
- virtual SVGSVGElement *getRootElement() =0;
+ virtual SVGSVGElementPtr getRootElement() =0;
//##################
/**
*
*/
- virtual NodeList getIntersectionList (const SVGRect &rect,
- const SVGElement *referenceElement ) =0;
+ virtual NodeList getIntersectionList(const SVGRect &rect,
+ const SVGElementPtr referenceElement ) =0;
/**
*
*/
virtual NodeList getEnclosureList (const SVGRect &rect,
- const SVGElement *referenceElement ) =0;
+ const SVGElementPtr referenceElement ) =0;
/**
*
*/
- virtual bool checkIntersection (const SVGElement *element, const SVGRect &rect ) =0;
+ virtual bool checkIntersection (const SVGElementPtr element, const SVGRect &rect ) =0;
/**
*
*/
- virtual bool checkEnclosure (const SVGElement *element, const SVGRect &rect ) =0;
+ virtual bool checkEnclosure (const SVGElementPtr element, const SVGRect &rect ) =0;
/**
*
/**
*
*/
- virtual Element *getElementById (const DOMString& elementId ) =0;
+ virtual ElementPtr getElementById (const DOMString& elementId ) =0;
/**
*
*/
- virtual SVGDocument *getSVGDocument ( )
+ virtual SVGDocumentPtr getSVGDocument ( )
throw( DOMException ) =0;
//##################
/**
*
*/
- virtual SVGElement *getTargetElement() =0;
+ virtual SVGElementPtr getTargetElement() =0;
/**
index 25406b4fd4fe4c754f47afcb163341af70320cc0..03d42e5159ae3f8823a8f3ad1c4df0059ec14716 100644 (file)
--- a/src/dom/svg/svgimpl.cpp
+++ b/src/dom/svg/svgimpl.cpp
/**
*
*/
-Element *SVGDocumentImpl::createElement(const DOMString& tagName)
+ElementPtr SVGDocumentImpl::createElement(const DOMString& tagName)
throw(DOMException)
{
- SVGElementImpl *impl = new SVGElementImpl(this, tagName);
- return impl;
+ SVGElementPtr elem = new SVGElementImpl(this, tagName);
+ return elem;
}
/**
*
*/
-Element *SVGDocumentImpl::createElementNS(const DOMString& namespaceURI,
+ElementPtr SVGDocumentImpl::createElementNS(const DOMString& namespaceURI,
const DOMString& qualifiedName)
throw(DOMException)
{
- SVGElementImpl *elem = new SVGElementImpl(this, namespaceURI, qualifiedName);
+ SVGElementPtr elem = new SVGElementImpl(this, namespaceURI, qualifiedName);
return elem;
}
*
*/
NodeList SVGSVGElementImpl::getIntersectionList(const SVGRect &rect,
- const SVGElement *referenceElement )
+ const SVGElementPtr referenceElement )
{
NodeList list;
return list;
*
*/
NodeList SVGSVGElementImpl::getEnclosureList(const SVGRect &rect,
- const SVGElement *referenceElement )
+ const SVGElementPtr referenceElement )
{
NodeList list;
return list;
/**
*
*/
-bool SVGSVGElementImpl::checkIntersection(const SVGElement *element,
+bool SVGSVGElementImpl::checkIntersection(const SVGElementPtr element,
const SVGRect &rect )
{
return false;
/**
*
*/
-bool SVGSVGElementImpl::checkEnclosure(const SVGElement *element,
+bool SVGSVGElementImpl::checkEnclosure(const SVGElementPtr element,
const SVGRect &rect )
{
return false;
/**
*
*/
-Element *SVGSVGElementImpl::getElementById(const DOMString& elementId )
+ElementPtr SVGSVGElementImpl::getElementById(const DOMString& elementId )
{
return NULL;
}
/**
*
*/
-SVGDocument *GetSVGDocumentImpl::getSVGDocument( )
+SVGDocumentPtr GetSVGDocumentImpl::getSVGDocument( )
throw ( DOMException )
{
return NULL;
diff --git a/src/dom/svg/svgimpl.h b/src/dom/svg/svgimpl.h
index a9f6ace9bb0f3774954159ba6220949063a07c07..5c2e78f1b9494343383bc7361935a6175bb74cbe 100644 (file)
--- a/src/dom/svg/svgimpl.h
+++ b/src/dom/svg/svgimpl.h
class SVGSVGElementImpl;
+typedef Ptr<SVGSVGElementImpl> SVGSVGElementImplPtr;
+class SVGElementImpl;
+typedef Ptr<SVGElementImpl> SVGElementImplPtr;
+class SVGDocumentImpl;
+typedef Ptr<SVGDocumentImpl> SVGDocumentImplPtr;
/*#########################################################################
## SVGDocumentImpl
/**
*
*/
- virtual SVGSVGElement *getRootElement()
+ virtual SVGSVGElementPtr getRootElement()
{ return rootElement; }
/**
*
*/
- virtual Element *createElement(const DOMString& tagName)
+ virtual ElementPtr createElement(const DOMString& tagName)
throw(DOMException);
/**
*
*/
- virtual Element *createElementNS(const DOMString& namespaceURI,
- const DOMString& qualifiedName)
- throw(DOMException);
+ virtual ElementPtr createElementNS(const DOMString& namespaceURI,
+ const DOMString& qualifiedName)
+ throw(DOMException);
//##################
//# Non-API methods
//##################
SVGDocumentImpl(const DOMImplementation *domImpl,
- const DOMString &namespaceURI,
- const DOMString &qualifiedName,
- const DocumentType *doctype)
+ const DOMString &namespaceURI,
+ const DOMString &qualifiedName,
+ const DocumentTypePtr doctype)
: DocumentImpl(domImpl, namespaceURI,
qualifiedName, doctype)
{
*/
virtual ~SVGDocumentImpl()
{
- if (rootElement)
- delete rootElement;
}
protected:
DOMString referrer;
DOMString domain;
DOMString url;
- SVGSVGElement *rootElement;
+ SVGSVGElementPtr rootElement;
};
/**
*
*/
- virtual SVGSVGElement *getOwnerSVGElement()
+ virtual SVGSVGElementPtr getOwnerSVGElement()
{ return ownerSvgElement; }
/**
*
*/
- virtual SVGElement *getViewportElement()
+ virtual SVGElementPtr getViewportElement()
{ return viewportElement; }
/**
*
*/
- SVGElementImpl(SVGDocumentImpl *owner, const DOMString &tagName)
+ SVGElementImpl(SVGDocumentImplPtr owner, const DOMString &tagName)
: ElementImpl(owner, tagName)
{ init(); }
/**
*
*/
- SVGElementImpl(SVGDocumentImpl *owner,
+ SVGElementImpl(SVGDocumentImplPtr owner,
const DOMString &namespaceURI,
const DOMString &tagName)
: ElementImpl(owner, namespaceURI, tagName)
viewportElement = NULL;
}
- DOMString id;
- DOMString xmlBase;
- SVGSVGElement *ownerSvgElement;
- SVGElement *viewportElement;
+ DOMString id;
+ DOMString xmlBase;
+ SVGSVGElementPtr ownerSvgElement;
+ SVGElementPtr viewportElement;
};
*
*/
virtual NodeList getIntersectionList (const SVGRect &rect,
- const SVGElement *referenceElement );
+ const SVGElementPtr referenceElement );
/**
*
*/
virtual NodeList getEnclosureList (const SVGRect &rect,
- const SVGElement *referenceElement );
+ const SVGElementPtr referenceElement );
/**
*
*/
- virtual bool checkIntersection (const SVGElement *element, const SVGRect &rect );
+ virtual bool checkIntersection (const SVGElementPtr element, const SVGRect &rect );
/**
*
*/
- virtual bool checkEnclosure (const SVGElement *element, const SVGRect &rect );
+ virtual bool checkEnclosure (const SVGElementPtr element, const SVGRect &rect );
/**
*
/**
*
*/
- virtual Element *getElementById (const DOMString& elementId );
+ virtual ElementPtr getElementById (const DOMString& elementId );
/**
*
*/
- virtual SVGDocument *getSVGDocument ( )
+ virtual SVGDocumentPtr getSVGDocument ( )
throw( DOMException );
//##################
/**
*
*/
- virtual long getNumberOfChars ( );
+ virtual long getNumberOfChars( );
/**
*
*/
- virtual double getComputedTextLength ( );
+ virtual double getComputedTextLength( );
/**
*
*/
- virtual double getSubStringLength (unsigned long charnum, unsigned long nchars )
- throw( DOMException );
+ virtual double getSubStringLength(unsigned long charnum,
+ unsigned long nchars )
+ throw( DOMException );
/**
*
*/
- virtual SVGPoint getStartPositionOfChar (unsigned long charnum )
- throw( DOMException );
+ virtual SVGPoint getStartPositionOfChar(unsigned long charnum )
+ throw( DOMException );
/**
*
*/
- virtual SVGPoint getEndPositionOfChar (unsigned long charnum )
- throw( DOMException );
+ virtual SVGPoint getEndPositionOfChar(unsigned long charnum )
+ throw( DOMException );
/**
*
*/
- virtual SVGRect getExtentOfChar (unsigned long charnum )
- throw( DOMException );
+ virtual SVGRect getExtentOfChar(unsigned long charnum )
+ throw( DOMException );
/**
*
*/
- virtual double getRotationOfChar (unsigned long charnum )
+ virtual double getRotationOfChar(unsigned long charnum )
throw( DOMException );
/**
*
*/
- virtual long getCharNumAtPosition (const SVGPoint &point );
+ virtual long getCharNumAtPosition(const SVGPoint &point );
/**
*
*/
- virtual void selectSubString (unsigned long charnum, unsigned long nchars )
- throw( DOMException );
+ virtual void selectSubString(unsigned long charnum, unsigned long nchars )
+ throw( DOMException );
/**
*
*/
- virtual SVGElement *getTargetElement()
+ virtual SVGElementPtr getTargetElement()
{ return targetElement; }
protected:
- SVGElement *targetElement;
+ SVGElementPtr targetElement;
double startTime, currentTime, simpleDuration;
};
index 0a0dd3f133b9f08efde17c455a3195b7cb270d8e..a6e0171104c4c4e53c29d7e40e31138038aaf773 100644 (file)
/**
*
*/
-bool SvgParser::parseElement(ElementImpl *parent, ElementImpl *sourceElem)
+bool SvgParser::parseElement(SVGElementImplPtr parent,
+ ElementImplPtr sourceElem)
{
if (!parent || !sourceElem)
{
DOMString tagName = sourceElem->getTagName();
printf("tag name:%s\n", tagName.c_str());
- ElementImpl *newElement = NULL;
+ ElementImplPtr newElement = NULL;
if (namespaceURI != SVG_NAMESPACE)
{
newElement = new SVGSVGElementImpl();
int nodeCount = children.getLength();
for (int i=0 ; i<nodeCount ; i++)
{
- Node *child = children.item(i);
+ NodePtr child = children.item(i);
int typ = child->getNodeType();
if (typ == Node::TEXT_NODE)
{
- Node *newNode = doc->createTextNode(child->getNodeValue());
+ NodePtr newNode = doc->createTextNode(child->getNodeValue());
parent->appendChild(newNode);
}
else if (typ == Node::CDATA_SECTION_NODE)
{
- Node *newNode = doc->createCDATASection(child->getNodeValue());
+ NodePtr newNode = doc->createCDATASection(child->getNodeValue());
parent->appendChild(newNode);
}
- else if (newElement && typ == Node::ELEMENT_NODE)
+ else if (newElement.get() && typ == Node::ELEMENT_NODE)
{
- ElementImpl *childElement = dynamic_cast<ElementImpl *>(child);
- parseElement(newElement, childElement);
+ //ElementImplPtr childElement = dynamic_cast<ElementImpl *>(child.get());
+ //parseElement(newElement, childElement);
}
}
return true;
/**
*
*/
-Document *SvgParser::parse(const Document *sourceDoc)
+SVGDocumentPtr SvgParser::parse(const DocumentPtr src)
{
- if (!sourceDoc)
+ if (!src)
{
error("NULL source document");
return NULL;
}
- Document *src = (Document *)sourceDoc;
DOMImplementationImpl impl;
doc = new SVGDocumentImpl(&impl, SVG_NAMESPACE, "svg" , NULL);
- ElementImpl *destElem = dynamic_cast<ElementImpl *>(doc->getDocumentElement());
- ElementImpl *srcElem = dynamic_cast<ElementImpl *>(src->getDocumentElement());
+ SVGElementImplPtr destElem = dynamic_cast<SVGElementImpl *>(doc->getRootElement().get());
+ ElementImplPtr srcElem = dynamic_cast<ElementImpl *>(src->getDocumentElement().get());
if (!parseElement(destElem, srcElem))
{
- delete doc;
return NULL;
}
index 1b2b704da952c2fb2e9013feb9a248c44044a991..9305a553a24b61119f5635d6c7dc05e6485d1e66 100644 (file)
--- a/src/dom/svg/svgparser.h
+++ b/src/dom/svg/svgparser.h
/**
*
*/
- Document *parse(const Document *sourceDoc);
+ SVGDocumentPtr parse(const DocumentPtr sourceDoc);
/**
*
*/
- bool parseElement(ElementImpl *destElem, ElementImpl *sourceElem);
+ bool parseElement(SVGElementImplPtr destElem,
+ ElementImplPtr sourceElem);
/**
int parselen;
int lastPosition;
- SVGDocumentImpl *doc;
+ SVGDocumentImplPtr doc;
};
diff --git a/src/dom/views.h b/src/dom/views.h
index 1d300d5d7d292e80a7dab3613db3d342deebd956..0b89b75551bd5c21f7e358d9de587e81f5a65ea8 100644 (file)
--- a/src/dom/views.h
+++ b/src/dom/views.h
/**
*
*/
- virtual Node *getNodeArg()
+ virtual NodePtr getNodeArg()
{ return nodeArg; }
protected:
DOMString name;
- Node *nodeArg;
+ NodePtr nodeArg;
unsigned long offset;
/**
*
*/
- virtual Node *getNodeArg()
+ virtual NodePtr getNodeArg()
{ return nodeArg; }
/**
protected:
- Node *nodeArg;
+ NodePtr nodeArg;
std::vector<Match> matches;
/**
*
*/
- virtual Node *getNodeArg()
+ virtual NodePtr getNodeArg()
{ return nodeArg; }
/**
protected:
- Node *nodeArg;
+ NodePtr nodeArg;
long offset;
virtual MatchContent createMatchContent(unsigned short test,
const DOMString &name,
unsigned long offset,
- const Node *nodeArg)
+ const NodePtr nodeArg)
{
MatchContent ret;
return ret;
/**
*
*/
- virtual void select(const Node *boundary,
+ virtual void select(const NodePtr boundary,
unsigned long offset,
bool extend,
bool add)
/**
*
*/
- virtual Node *getContentPropertyNode(const DOMString &name)
+ virtual NodePtr getContentPropertyNode(const DOMString &name)
throw(dom::DOMException)
{
- Node *val = NULL;
+ NodePtr val = NULL;
return val;
}
/**
*
*/
- virtual Node *getMatchNode()
+ virtual NodePtr getMatchNode()
{ return matchNode; }
/**
*
*/
- virtual void setMatchNode(const Node *val)
- { matchNode = (Node *)val; }
+ virtual void setMatchNode(const NodePtr val)
+ { matchNode = (NodePtr )val; }
/**
*
/**
*
*/
- virtual Node *getMatchNodeR()
+ virtual NodePtr getMatchNodeR()
{ return matchNodeR; }
/**
*
*/
- virtual void setMatchNodeR(const Node *val)
- { matchNodeR = (Node *)val; }
+ virtual void setMatchNodeR(const NodePtr val)
+ { matchNodeR = (NodePtr )val; }
/**
*
/**
*
*/
- virtual Node *getStartNode()
+ virtual NodePtr getStartNode()
{ return startNode; }
/**
/**
*
*/
- virtual Node *getEndNode()
+ virtual NodePtr getEndNode()
{ return endNode; }
/**
long matchYR;
bool matchContent;
bool matchRange;
- Node * matchNode;
+ NodePtr matchNode;
unsigned long matchOffset;
- Node * matchNodeR;
+ NodePtr matchNodeR;
unsigned long matchOffsetR;
bool matchContainsSelected;
bool matchContainsVisible;
bool exists;
- Node * startNode;
+ NodePtr startNode;
unsigned long startOffset;
- Node * endNode;
+ NodePtr endNode;
unsigned long endOffset;
long topOffset;
long bottomOffset;
/**
*
*/
- virtual void select(const Node *boundary,
+ virtual void select(const NodePtr boundary,
unsigned long offset,
bool extend,
bool add)
index d3e8d99f3a27bf6e8022d04745741b71a78670c8..bd6cf6bfbf7d80b4d0bcd03cd36a2c8602b9b7a2 100644 (file)
--- a/src/dom/work/testdom.cpp
+++ b/src/dom/work/testdom.cpp
input.setStringData(buf);
printf("######## PARSE ######################################\n");
- Document *doc = parser.parse(input);
+ DocumentPtr doc = parser.parse(input);
if (!doc)
{
printf("Nodes:%d\n", nodeCount);
for (int i=0; i<nodeCount ; i++)
{
- Node *node = list.item(i);
+ NodePtr node = list.item(i);
serializer.write(node, output);
}
-
-
- delete doc;
return 1;
}
index 7532da423a23635ae650ca124f0587f613404f6d..aba4ce97c94c7c98a302986954b604793c823197 100644 (file)
--- a/src/dom/work/testjs.cpp
+++ b/src/dom/work/testjs.cpp
input.setStringData(buf);
printf("######## PARSE ######################################\n");
- Document *doc = parser.parse(input);
+ DocumentPtr doc = parser.parse(input);
if (!doc)
{
printf("Nodes:%d\n", nodeCount);
for (int i=0; i<nodeCount ; i++)
{
- Node *node = list.item(i);
+ NodePtr node = list.item(i);
serializer.write(node, output);
}
- delete doc;
return true;
}
index f3ab46a642cb8eeb13c5ea626ebb8dd4461eaa51..b347d2415f2b280f98b50a2fc33603d326e2f263 100644 (file)
--- a/src/dom/work/testsvg.cpp
+++ b/src/dom/work/testsvg.cpp
input.setStringData(buf);
printf("######## PARSE ######################################\n");
- Document *doc = parser.parse(input);
+ DocumentPtr doc = parser.parse(input);
if (!doc)
{
serializer.write(doc, output);
- delete doc;
return 1;
}
index 380dc77e1f08627527a8f419afacb121d9a83932..626176920c521767d8beb29ff32f86ed688354bd 100644 (file)
#include <stdio.h>
-typedef org::w3c::dom::Node Node;
-typedef org::w3c::dom::NodeList NodeList;
-typedef org::w3c::dom::DOMString DOMString;
-typedef org::w3c::dom::Document Document;
+typedef org::w3c::dom::Node Node;
+typedef org::w3c::dom::NodePtr NodePtr;
+typedef org::w3c::dom::NodeList NodeList;
+typedef org::w3c::dom::DOMString DOMString;
+typedef org::w3c::dom::Document Document;
+typedef org::w3c::dom::DocumentPtr DocumentPtr;
typedef org::w3c::dom::io::StdWriter StdWriter;
typedef org::w3c::dom::ls::DOMImplementationLSImpl DOMImplementationLSImpl;
typedef org::w3c::dom::ls::LSSerializer LSSerializer;
-typedef org::w3c::dom::ls::LSOutput LSOutput;
-typedef org::w3c::dom::ls::LSInput LSInput;
-typedef org::w3c::dom::ls::LSParser LSParser;
+typedef org::w3c::dom::ls::LSOutput LSOutput;
+typedef org::w3c::dom::ls::LSInput LSInput;
+typedef org::w3c::dom::ls::LSParser LSParser;
typedef org::w3c::dom::xpath::XPathParser XPathParser;
return true;
}
-void dumpDoc(Document *doc)
+bool dumpDoc(DocumentPtr doc)
{
DOMImplementationLSImpl domImpl;
LSSerializer &serializer = domImpl.createLSSerializer();
StdWriter writer;
output.setCharacterStream(&writer);
serializer.write(doc, output);
+
+ return true;
}
LSInput input = domImpl.createLSInput();
LSParser &parser = domImpl.createLSParser(0, "");
input.setStringData(xpt->xml);
- Document *doc = parser.parse(input);
+ DocumentPtr doc = parser.parse(input);
//### XPATH
XPathParser xp;
NodeList list = xp.evaluate(doc, xpathStr);
for (unsigned int i=0 ; i<list.getLength() ; i++)
{
- Node *n = list.item(i);
+ NodePtr n = list.item(i);
printf("@@ node: %s\n", n->getNodeName().c_str());
}
//dumpDoc(doc);
- delete doc;
return true;
}
diff --git a/src/dom/xmlreader.cpp b/src/dom/xmlreader.cpp
index fbacf48f411aa54481098a3d8576679709940401..5e8184e4d243dd98b92b3f7243166d0c8e646b44 100644 (file)
--- a/src/dom/xmlreader.cpp
+++ b/src/dom/xmlreader.cpp
#include "xmlreader.h"
#include "charclass.h"
#include "domimpl.h"
-#include "svg/svgimpl.h"
#include <stdio.h>
#include <stdarg.h>
colNr += 5;
bool quickCloseDummy;
- Node *node = new NodeImpl();
+ NodePtr node = new NodeImpl();
int p2 = parseAttributes(p, node, &quickCloseDummy);
if (p2 < p)
{
- delete node;
+ //smart ptr!!do not delete node;
return p0;
}
p = p2;
//get the attributes that we need
NamedNodeMap attributes = node->getAttributes();
- Node *attr = attributes.getNamedItem("version");
- if (attr)
+ NodePtr attr = attributes.getNamedItem("version");
+ if (attr.get())
document->setXmlVersion(attr->getNodeValue());
attr = attributes.getNamedItem("encoding");
- if (attr)
+ if (attr.get())
{ /*document->setXmlEncoding(attr->getNodeValue());*/ }
attr = attributes.getNamedItem("standalone");
- if (attr)
+ if (attr.get())
document->setXmlStandalone((attr->getNodeValue() == "yes"));
- delete node;
//#now we should be pointing at '?>'
if (!match(p, "?>"))
p += 9;
colNr += 9;
- DocumentType *doctype = document->getDoctype();
+ DocumentTypePtr doctype = document->getDoctype();
if (!doctype)
return p0;
/**
* Expects '<' on startup, ends on char after '>'
*/
-int XmlReader::parseComment(int p0, Comment *comment)
+int XmlReader::parseComment(int p0, CommentPtr comment)
{
int p = p0;
/**
*
*/
-int XmlReader::parseCDATA(int p0, CDATASection *cdata)
+int XmlReader::parseCDATA(int p0, CDATASectionPtr cdata)
{
int p = p0;
/**
*
*/
-int XmlReader::parseText(int p0, Text *text)
+int XmlReader::parseText(int p0, TextPtr text)
{
int p = p0;
* Parses attributes of a node. Should end pointing at either the
* '?' of a version or doctype tag, or a '>' of a normal tag
*/
-int XmlReader::parseAttributes(int p0, Node *node, bool *quickClose)
+int XmlReader::parseAttributes(int p0, NodePtr node, bool *quickClose)
{
*quickClose = false;
namespaceURI = XMLNSNAME;
//## Now let us make the attribute and give it to the node
- Attr *attr = document->createAttributeNS(namespaceURI, qualifiedName);
+ AttrPtr attr = document->createAttributeNS(namespaceURI, qualifiedName);
attr->setValue(attrValue);
node->getAttributes().setNamedItemNS(attr);
* Parse as a document, preserving the original structure as much as
* possible
*/
-int XmlReader::parseNode(int p0, Node *node, int depth)
+int XmlReader::parseNode(int p0, NodePtr node, int depth)
{
int p = p0;
//### COMMENT
if (match(p, "<!--"))
{
- Comment *comment = document->createComment("");
+ CommentPtr comment = document->createComment("");
p2 = parseComment(p, comment);
if (p2 <= p)
return p0;
p = p2;
if (parseAsData)
{ //throw away
- delete comment;
+ //delete comment;
}
else
{
//### CDATA
else if (match(p, "<![CDATA["))
{
- CDATASection *cdata = document->createCDATASection("");
+ CDATASectionPtr cdata = document->createCDATASection("");
p2 = parseCDATA(p, cdata);
if (p2 <= p)
return p0;
if (parseAsData)
{
nodeValue += cdata->getNodeValue();
- delete cdata;
+ //delete cdata;
}
else
{
else
{
/*Add element to tree*/
- Element *elem = document->createElement(""); //fill in name later
+ ElementPtr elem = document->createElement(""); //fill in name later
node->appendChild(elem);
p2 = parseNode(p, elem, depth+1);
if (p2 <= p)
//### TEXT
else
{
- Text *text = document->createTextNode("");
+ TextPtr text = document->createTextNode("");
p2 = parseText(p, text);
if (p2 <= p)
return p0;
if (parseAsData)
{
nodeValue += text->getNodeValue();
- delete text;
+ //delete text;
}
else
{
/**
*
*/
-org::w3c::dom::Document *
+org::w3c::dom::DocumentPtr
XmlReader::parse(const DOMString &buf, int bufferOffset, int parseLen)
{
len = parseLen;
parsebuf = buf;
+ keepGoing = true;
+
DOMImplementationSourceImpl source;
DOMImplementation *domImpl = source.getDOMImplementation("");
- keepGoing = true;
-
document = domImpl->createDocument("", "", NULL);
//document = new svg::SVGDocumentImpl(domImpl, "", "", NULL);
//### COMMENT
if (match(p, "<!--"))
{
- Comment *comment = document->createComment("");
+ CommentPtr comment = document->createComment("");
p2 = parseComment(p, comment);
if (p2 <= p)
return document;
p = p2;
if (parseAsData)
{ //throw away
- delete comment;
+ //delete comment;
}
else
{
/**
*
*/
-org::w3c::dom::Document *
+org::w3c::dom::DocumentPtr
XmlReader::parse(const DOMString &str)
{
- Document *doc = parse(str, 0, str.size());
+ DocumentPtr doc = parse(str, 0, str.size());
doc->normalizeDocument();
return doc;
/**
*
*/
-org::w3c::dom::Document *
+org::w3c::dom::DocumentPtr
XmlReader::parseFile(char *fileName)
{
DOMString buf = loadFile(fileName);
- Document *doc = parse(buf, 0, buf.size());
+ DocumentPtr doc = parse(buf, 0, buf.size());
return doc;
}
diff --git a/src/dom/xmlreader.h b/src/dom/xmlreader.h
index 4b80081e2d0ce0d2ddcf137c4e55b3705e39e4bb..1060555c738d0d92ae249fe9e379be8f227dcd67 100644 (file)
--- a/src/dom/xmlreader.h
+++ b/src/dom/xmlreader.h
/**
*
*/
- org::w3c::dom::Document *parse(const DOMString &buf,
+ org::w3c::dom::DocumentPtr parse(const DOMString &buf,
int offset, int length);
/**
*
*/
- org::w3c::dom::Document *parse(const DOMString &buf);
+ org::w3c::dom::DocumentPtr parse(const DOMString &buf);
/**
*
*/
- org::w3c::dom::Document *parseFile(char *fileName);
+ org::w3c::dom::DocumentPtr parseFile(char *fileName);
protected:
int parseVersion(int pos);
int parseDoctype(int pos);
- int parseCDATA (int pos, CDATASection *cdata);
- int parseComment(int pos, Comment *comment);
- int parseText(int pos, Text *test);
+ int parseCDATA (int pos, CDATASectionPtr cdata);
+ int parseComment(int pos, CommentPtr comment);
+ int parseText(int pos, TextPtr text);
int parseEntity(int pos, DOMString &buf);
- int parseAttributes(int p0, Node *node, bool *quickClose);
+ int parseAttributes(int p0, NodePtr node, bool *quickClose);
- int parseNode(int p0, Node *node, int depth);
+ int parseNode(int p0, NodePtr node, int depth);
bool keepGoing;
bool parseAsData;
int lineNr;
int colNr;
- Document *document;
+ DocumentPtr document;
};
index abbbb090060da6ec5506b4810b13e7ce6f3838dd..d299973f9bc7e576bfaa323eaa911f096634a4b3 100644 (file)
--- a/src/dom/xpathparser.cpp
+++ b/src/dom/xpathparser.cpp
* This wraps the two-step call to parse(), then execute() to get a NodeList
* of matching DOM nodes
*/
-NodeList XPathParser::evaluate(const Node *root,
+NodeList XPathParser::evaluate(const NodePtr root,
const DOMString &xpathString)
{
NodeList list;
diff --git a/src/dom/xpathparser.h b/src/dom/xpathparser.h
index 70ad2f6c67f07cc66f552e0c2c33075bed17cdca..ce565622807996d4e48f7033ea09520e2ef1402b 100644 (file)
--- a/src/dom/xpathparser.h
+++ b/src/dom/xpathparser.h
* This is the big one. Called by the xpath-dom api to fetch
* nodes from a DOM tree.
*/
- NodeList evaluate(const Node *root, const DOMString &str);
+ NodeList evaluate(const NodePtr root, const DOMString &str);
diff --git a/src/dom/xpathtoken.cpp b/src/dom/xpathtoken.cpp
index fa81e2863a6eb13a723435251d5c80b93842b3db..ac0ead535c86b1e5ec6468e3811e018303ef30b7 100644 (file)
--- a/src/dom/xpathtoken.cpp
+++ b/src/dom/xpathtoken.cpp
*/
int TokenExecutor::execute(std::vector<Token> &tokens,
int position,
- const Node *node,
+ const NodePtr node,
NodeList &result)
{
Stack stack(*this);
//Do rest of tokens with the nodes we have found so far
for (unsigned int i = 0 ; i<contextNodes.getLength() ; i++)
{
- Node *contextNode = contextNodes.item(i);
+ NodePtr contextNode = contextNodes.item(i);
pos2 = execute(tokens, position, contextNode, result);
if (pos2 < 0)
{
* Execute the tokens in a TokenList upon a given node
*/
bool TokenExecutor::execute(TokenList &tokenList,
- const Node *node,
+ const NodePtr node,
NodeList &result)
{
diff --git a/src/dom/xpathtoken.h b/src/dom/xpathtoken.h
index 71e096d46c0b7b58d9784586993779505429ff7b..9039006278981536bb9302f0627bb10a091cef8d 100644 (file)
--- a/src/dom/xpathtoken.h
+++ b/src/dom/xpathtoken.h
*/
int execute(std::vector<Token> &tokens,
int position,
- const Node *node,
+ const NodePtr node,
NodeList &nodeList);
/**
* Execute a token list on the stack
*/
bool execute(TokenList &list,
- const Node *node,
+ const NodePtr node,
NodeList &result);
private: