dbertoni 2003/02/05 15:23:17
Modified: c/src/XalanSourceTree XalanSourceTreeDocument.cpp
XalanSourceTreeDocument.hpp
XalanSourceTreeElement.cpp
XalanSourceTreeElement.hpp
Added: c/src/XalanSourceTree XalanSourceTreeElementA.cpp
XalanSourceTreeElementA.hpp
XalanSourceTreeElementAAllocator.cpp
XalanSourceTreeElementAAllocator.hpp
XalanSourceTreeElementANS.cpp
XalanSourceTreeElementANS.hpp
XalanSourceTreeElementANSAllocator.cpp
XalanSourceTreeElementANSAllocator.hpp
XalanSourceTreeElementNA.cpp
XalanSourceTreeElementNA.hpp
XalanSourceTreeElementNAAllocator.cpp
XalanSourceTreeElementNAAllocator.hpp
XalanSourceTreeElementNANS.cpp
XalanSourceTreeElementNANS.hpp
XalanSourceTreeElementNANSAllocator.cpp
XalanSourceTreeElementNANSAllocator.hpp
Log:
New implementation to save memory for elements which have no attributes.
Revision Changes Path
1.35 +116 -44
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeDocument.cpp
Index: XalanSourceTreeDocument.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XalanSourceTree/XalanSourceTreeDocument.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- XalanSourceTreeDocument.cpp 15 Jan 2003 00:03:39 -0000 1.34
+++ XalanSourceTreeDocument.cpp 5 Feb 2003 23:23:16 -0000 1.35
@@ -102,8 +102,10 @@
m_attributeAllocator(eDefaultAttributeAllocatorBlockSize),
m_attributeNSAllocator(eDefaultAttributeNSAllocatorBlockSize),
m_commentAllocator(eDefaultCommentAllocatorBlockSize),
- m_elementAllocator(eDefaultElementAllocatorBlockSize),
- m_elementNSAllocator(eDefaultElementNSAllocatorBlockSize),
+ m_elementAAllocator(eDefaultElementAllocatorBlockSize),
+ m_elementANSAllocator(eDefaultElementNSAllocatorBlockSize),
+ m_elementNAAllocator(eDefaultElementAllocatorBlockSize),
+ m_elementNANSAllocator(eDefaultElementNSAllocatorBlockSize),
m_piAllocator(eDefaultPIAllocatorBlockSize),
m_textAllocator(eDefaultTextAllocatorBlockSize),
m_textIWSAllocator(eDefaultTextIWSAllocatorBlockSize),
@@ -137,8 +139,10 @@
m_attributeAllocator(theAttributeBlockSize),
m_attributeNSAllocator(theAttributeNSBlockSize),
m_commentAllocator(theCommentBlockSize),
- m_elementAllocator(theElementBlockSize),
- m_elementNSAllocator(theElementNSBlockSize),
+ m_elementAAllocator(theElementBlockSize),
+ m_elementANSAllocator(theElementNSBlockSize),
+ m_elementNAAllocator(theElementBlockSize),
+ m_elementNANSAllocator(theElementNSBlockSize),
m_piAllocator(thePIBlockSize),
m_textAllocator(theTextBlockSize),
m_textIWSAllocator(theTextIWSBlockSize),
@@ -700,11 +704,24 @@
}
}
- XalanSourceTreeAttr** const theAttributeVector =
- theAttributeCount == 0 ? 0 :
m_attributesVector.allocate(theAttributeCount);
+ XalanSourceTreeAttr** theAttributeVector = 0;
+ XalanSourceTreeElement* theNewElement = 0;
- XalanSourceTreeElement* const theNewElement =
- m_elementAllocator.create(
+ if (theAttributeCount == 0)
+ {
+ theNewElement = m_elementNAAllocator.create(
+ m_namesStringPool.get(name),
+ this,
+ theParentNode,
+ thePreviousSibling,
+ theNextSibling,
+ m_nextIndexValue++);
+ }
+ else
+ {
+ theAttributeVector =
m_attributesVector.allocate(theAttributeCount);
+
+ theNewElement = m_elementAAllocator.create(
m_namesStringPool.get(name),
this,
theAttributeVector,
@@ -713,6 +730,7 @@
thePreviousSibling,
theNextSibling,
m_nextIndexValue++);
+ }
assert(theNewElement != 0);
size_t theIndex = 0;
@@ -873,8 +891,6 @@
{
return theStringPool->get(qname, theColonIndex);
}
-
-
}
@@ -909,14 +925,32 @@
}
}
- XalanSourceTreeAttr** const theAttributeVector =
- theAttributeCount == 0 ? 0 :
m_attributesVector.allocate(theAttributeCount);
+ XalanSourceTreeAttr** theAttributeVector = 0;
+ XalanSourceTreeElement* theNewElement = 0;
const XalanDOMString::size_type theColonIndex = indexOf(qname,
XalanUnicode::charColon);
const XalanDOMString::size_type theLength = length(qname);
- XalanSourceTreeElement* const theNewElement =
- m_elementNSAllocator.create(
+ if (theAttributeCount == 0)
+ {
+
+ theNewElement = m_elementNANSAllocator.create(
+ m_namesStringPool.get(qname),
+ m_namesStringPool.get(localname),
+ m_namesStringPool.get(uri),
+ // This is the prefix...
+ getElementNodePrefix(qname, &m_namesStringPool,
theLength, theColonIndex),
+ this,
+ theParentNode,
+ thePreviousSibling,
+ theNextSibling,
+ m_nextIndexValue++);
+ }
+ else
+ {
+ theAttributeVector =
m_attributesVector.allocate(theAttributeCount);
+
+ theNewElement = m_elementANSAllocator.create(
m_namesStringPool.get(qname),
m_namesStringPool.get(localname),
m_namesStringPool.get(uri),
@@ -930,8 +964,6 @@
theNextSibling,
m_nextIndexValue++);
- if (theAttributeCount != 0)
- {
createAttributes(attrs, theAttributeVector, theNewElement,
fAddXMLNamespaceAttribute);
}
@@ -949,6 +981,8 @@
XalanNode* theNextSibling,
bool
fAddXMLNamespaceAttribute)
{
+ assert(indexOf(name, XalanUnicode::charColon) == length(name));
+
// We might have typedef'ed this to something smaller than unsigned int.
AttributesCountType theAttributeCount =
AttributesCountType(attrs.getLength());
@@ -967,13 +1001,24 @@
}
}
- XalanSourceTreeAttr** const theAttributeVector =
- theAttributeCount == 0 ? 0 :
m_attributesVector.allocate(theAttributeCount);
+ XalanSourceTreeAttr** theAttributeVector = 0;
+ XalanSourceTreeElement* theNewElement = 0;
- assert(indexOf(name, XalanUnicode::charColon) == length(name));
+ if (theAttributeCount == 0)
+ {
+ theNewElement = m_elementNAAllocator.create(
+ m_namesStringPool.get(name),
+ this,
+ theParentNode,
+ thePreviousSibling,
+ theNextSibling,
+ m_nextIndexValue++);
+ }
+ else
+ {
+ theAttributeVector =
m_attributesVector.allocate(theAttributeCount);
- XalanSourceTreeElement* const theNewElement =
- m_elementAllocator.create(
+ theNewElement = m_elementAAllocator.create(
m_namesStringPool.get(name),
this,
theAttributeVector,
@@ -983,8 +1028,6 @@
theNextSibling,
m_nextIndexValue++);
- if (theAttributeCount != 0)
- {
createAttributes(attrs, theAttributeVector, theNewElement,
fAddXMLNamespaceAttribute);
}
@@ -1258,15 +1301,28 @@
// the prefix was returned by getNamespaceForPrefix()...
assert(length(m_stringBuffer) == 0);
- return m_elementAllocator.create(
- m_namesStringPool.get(theTagName),
- this,
- theAttributeVector,
- theAttributeCount,
- theParentNode,
- thePreviousSibling,
- theNextSibling,
- m_nextIndexValue++);
+ if (theAttributeCount == 0)
+ {
+ return m_elementNAAllocator.create(
+ m_namesStringPool.get(theTagName),
+ this,
+ theParentNode,
+ thePreviousSibling,
+ theNextSibling,
+ m_nextIndexValue++);
+ }
+ else
+ {
+ return m_elementAAllocator.create(
+ m_namesStringPool.get(theTagName),
+ this,
+ theAttributeVector,
+ theAttributeCount,
+ theParentNode,
+ thePreviousSibling,
+ theNextSibling,
+ m_nextIndexValue++);
+ }
}
else
{
@@ -1293,18 +1349,34 @@
// next sibling
// index
//
- return m_elementNSAllocator.create(
- m_namesStringPool.get(theTagName),
- m_namesStringPool.get(theLocalName),
- m_namesStringPool.get(*theNamespace),
- m_namesStringPool.get(m_stringBuffer),
- this,
- theAttributeVector,
- theAttributeCount,
- theParentNode,
- thePreviousSibling,
- theNextSibling,
- m_nextIndexValue++);
+ if (theAttributeCount == 0)
+ {
+ return m_elementNANSAllocator.create(
+ m_namesStringPool.get(theTagName),
+ m_namesStringPool.get(theLocalName),
+ m_namesStringPool.get(*theNamespace),
+ m_namesStringPool.get(m_stringBuffer),
+ this,
+ theParentNode,
+ thePreviousSibling,
+ theNextSibling,
+ m_nextIndexValue++);
+ }
+ else
+ {
+ return m_elementANSAllocator.create(
+ m_namesStringPool.get(theTagName),
+ m_namesStringPool.get(theLocalName),
+ m_namesStringPool.get(*theNamespace),
+ m_namesStringPool.get(m_stringBuffer),
+ this,
+ theAttributeVector,
+ theAttributeCount,
+ theParentNode,
+ thePreviousSibling,
+ theNextSibling,
+ m_nextIndexValue++);
+ }
}
}
1.22 +12 -6
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeDocument.hpp
Index: XalanSourceTreeDocument.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XalanSourceTree/XalanSourceTreeDocument.hpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- XalanSourceTreeDocument.hpp 15 Jan 2003 00:03:40 -0000 1.21
+++ XalanSourceTreeDocument.hpp 5 Feb 2003 23:23:16 -0000 1.22
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -84,8 +84,10 @@
#include <XalanSourceTree/XalanSourceTreeAttributeAllocator.hpp>
#include <XalanSourceTree/XalanSourceTreeAttributeNSAllocator.hpp>
#include <XalanSourceTree/XalanSourceTreeCommentAllocator.hpp>
-#include <XalanSourceTree/XalanSourceTreeElementAllocator.hpp>
-#include <XalanSourceTree/XalanSourceTreeElementNSAllocator.hpp>
+#include <XalanSourceTree/XalanSourceTreeElementAAllocator.hpp>
+#include <XalanSourceTree/XalanSourceTreeElementANSAllocator.hpp>
+#include <XalanSourceTree/XalanSourceTreeElementNAAllocator.hpp>
+#include <XalanSourceTree/XalanSourceTreeElementNANSAllocator.hpp>
#include <XalanSourceTree/XalanSourceTreeProcessingInstructionAllocator.hpp>
#include <XalanSourceTree/XalanSourceTreeTextAllocator.hpp>
#include <XalanSourceTree/XalanSourceTreeTextIWSAllocator.hpp>
@@ -115,7 +117,7 @@
{
public:
- typedef XalanSourceTreeElement::AttributesCountType
AttributesCountType;
+ typedef XalanSourceTreeElementA::AttributesCountType
AttributesCountType;
typedef XalanArrayAllocator<XalanSourceTreeAttr*>
AttributesArrayAllocatorType;
#if defined(XALAN_NO_STD_NAMESPACE)
@@ -554,9 +556,13 @@
XalanSourceTreeCommentAllocator
m_commentAllocator;
- XalanSourceTreeElementAllocator
m_elementAllocator;
+ XalanSourceTreeElementAAllocator
m_elementAAllocator;
- XalanSourceTreeElementNSAllocator
m_elementNSAllocator;
+ XalanSourceTreeElementANSAllocator
m_elementANSAllocator;
+
+ XalanSourceTreeElementNAAllocator
m_elementNAAllocator;
+
+ XalanSourceTreeElementNANSAllocator
m_elementNANSAllocator;
XalanSourceTreeProcessingInstructionAllocator m_piAllocator;
1.9 +5 -196
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElement.cpp
Index: XalanSourceTreeElement.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElement.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XalanSourceTreeElement.cpp 22 Nov 2002 02:18:32 -0000 1.8
+++ XalanSourceTreeElement.cpp 5 Feb 2003 23:23:16 -0000 1.9
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -80,15 +80,13 @@
-static const XalanDOMString s_emptyString;
+const XalanDOMString XalanSourceTreeElement::s_emptyString;
XalanSourceTreeElement::XalanSourceTreeElement(
const XalanDOMString& theTagName,
XalanSourceTreeDocument* theOwnerDocument,
- XalanSourceTreeAttr** theAttributes,
- AttributesCountType
theAttributeCount,
XalanNode*
theParentNode,
XalanNode*
thePreviousSibling,
XalanNode*
theNextSibling,
@@ -100,9 +98,7 @@
m_previousSibling(thePreviousSibling),
m_nextSibling(theNextSibling),
m_firstChild(0),
- m_index(theIndex),
- m_attributes(theAttributes),
- m_attributeCount(theAttributeCount)
+ m_index(theIndex)
{
}
@@ -116,7 +112,7 @@
XalanSourceTreeElement::XalanSourceTreeElement(
const XalanSourceTreeElement& theSource,
- bool
deep) :
+ bool
deep) :
XalanElement(theSource),
m_tagName(theSource.m_tagName),
m_ownerDocument(theSource.m_ownerDocument),
@@ -124,9 +120,7 @@
m_previousSibling(0),
m_nextSibling(0),
m_firstChild(theSource.m_firstChild == 0 ? 0 :
theSource.m_firstChild->cloneNode(deep)),
- m_index(0),
- m_attributes(theSource.m_attributes),
- m_attributeCount(theSource.m_attributeCount)
+ m_index(0)
{
}
@@ -214,14 +208,6 @@
-const XalanNamedNodeMap*
-XalanSourceTreeElement::getAttributes() const
-{
- return this;
-}
-
-
-
XalanDocument*
XalanSourceTreeElement::getOwnerDocument() const
{
@@ -230,18 +216,6 @@
-#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
-XalanNode*
-#else
-XalanSourceTreeElement*
-#endif
-XalanSourceTreeElement::cloneNode(bool deep) const
-{
- return clone(deep);
-}
-
-
-
XalanNode*
XalanSourceTreeElement::insertBefore(
XalanNode* /* newChild */,
@@ -324,30 +298,6 @@
-const XalanDOMString&
-XalanSourceTreeElement::getNamespaceURI() const
-{
- return s_emptyString;
-}
-
-
-
-const XalanDOMString&
-XalanSourceTreeElement::getPrefix() const
-{
- return s_emptyString;
-}
-
-
-
-const XalanDOMString&
-XalanSourceTreeElement::getLocalName() const
-{
- return s_emptyString;
-}
-
-
-
void
XalanSourceTreeElement::setPrefix(const XalanDOMString& /* prefix */)
{
@@ -380,34 +330,6 @@
-const XalanDOMString&
-XalanSourceTreeElement::getAttribute(const XalanDOMString& name)
const
-{
- XalanAttr* const theAttr = getAttributeNode(name);
-
- return theAttr == 0 ? s_emptyString : theAttr->getValue();
-}
-
-
-
-XalanAttr*
-XalanSourceTreeElement::getAttributeNode(const XalanDOMString&
name) const
-{
- for(unsigned int i = 0; i < m_attributeCount; ++i)
- {
- assert(m_attributes[i] != 0);
-
- if (equals(m_attributes[i]->getNodeName(), name) == true)
- {
- return m_attributes[i];
- }
- }
-
- return 0;
-}
-
-
-
XalanNodeList*
XalanSourceTreeElement::getElementsByTagName(const XalanDOMString& /* name
*/) const
{
@@ -456,18 +378,6 @@
-const XalanDOMString&
-XalanSourceTreeElement::getAttributeNS(
- const XalanDOMString& namespaceURI,
- const XalanDOMString& localName) const
-{
- XalanAttr* const theAttr = getAttributeNodeNS(namespaceURI,
localName);
-
- return theAttr == 0 ? s_emptyString : theAttr->getValue();
-}
-
-
-
void
XalanSourceTreeElement::setAttributeNS(
const XalanDOMString& /* namespaceURI */,
@@ -490,27 +400,6 @@
XalanAttr*
-XalanSourceTreeElement::getAttributeNodeNS(
- const XalanDOMString& namespaceURI,
- const XalanDOMString& localName) const
-{
- for(unsigned int i = 0; i < m_attributeCount; ++i)
- {
- assert(m_attributes[i] != 0);
-
- if (equals(m_attributes[i]->getLocalName(), localName) == true
&&
- equals(m_attributes[i]->getNamespaceURI(),
namespaceURI) == true)
- {
- return m_attributes[i];
- }
- }
-
- return 0;
-}
-
-
-
-XalanAttr*
XalanSourceTreeElement::setAttributeNodeNS(XalanAttr* /* newAttr */)
{
throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
@@ -631,86 +520,6 @@
XalanSourceTreeElement::appendChildNode(XalanSourceTreeText* theChild)
{
XalanSourceTreeHelper::appendSiblingToChild(this, m_firstChild,
theChild);
-}
-
-
-
-XalanNode*
-XalanSourceTreeElement::setNamedItem(XalanNode* /* arg */)
-{
- throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
-
- // Dummy return value...
- return 0;
-}
-
-
-
-XalanNode*
-XalanSourceTreeElement::item(unsigned int index) const
-{
- return index < m_attributeCount ? m_attributes[index] : 0;
-}
-
-
-
-XalanNode*
-XalanSourceTreeElement::getNamedItem(const XalanDOMString& name) const
-{
- return getAttributeNode(name);
-}
-
-
-
-unsigned int
-XalanSourceTreeElement::getLength() const
-{
- return m_attributeCount;
-}
-
-
-
-XalanNode*
-XalanSourceTreeElement::removeNamedItem(const XalanDOMString& /* name
*/)
-{
- throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
-
- // Dummy return value...
- return 0;
-}
-
-
-
-XalanNode*
-XalanSourceTreeElement::getNamedItemNS(
- const XalanDOMString& namespaceURI,
- const XalanDOMString& localName) const
-{
- return getAttributeNodeNS(namespaceURI, localName);
-}
-
-
-
-XalanNode*
-XalanSourceTreeElement::setNamedItemNS(XalanNode* /* arg */)
-{
- throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
-
- // Dummy return value...
- return 0;
-}
-
-
-
-XalanNode*
-XalanSourceTreeElement::removeNamedItemNS(
- const XalanDOMString& /* namespaceURI */,
- const XalanDOMString& /* localName */)
-{
- throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
-
- // Dummy return value...
- return 0;
}
1.9 +13 -69
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElement.hpp
Index: XalanSourceTreeElement.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElement.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XalanSourceTreeElement.hpp 22 Nov 2002 02:18:32 -0000 1.8
+++ XalanSourceTreeElement.hpp 5 Feb 2003 23:23:16 -0000 1.9
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -82,12 +82,10 @@
-class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElement : public
XalanElement, private XalanNamedNodeMap
+class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElement : public
XalanElement
{
public:
- typedef unsigned long AttributesCountType;
-
/**
* Constructor.
*
@@ -103,8 +101,6 @@
XalanSourceTreeElement(
const XalanDOMString& theTagName,
XalanSourceTreeDocument* theOwnerDocument,
- XalanSourceTreeAttr** theAttributes,
- AttributesCountType
theAttributeCount,
XalanNode*
theParentNode = 0,
XalanNode*
thePreviousSibling = 0,
XalanNode*
theNextSibling = 0,
@@ -113,7 +109,6 @@
virtual
~XalanSourceTreeElement();
-
/**
* Gets the name of this node.
*/
@@ -197,7 +192,7 @@
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
- getAttributes() const;
+ getAttributes() const = 0;
/**
* Gets the <code>DOM_Document</code> object associated with this node.
@@ -238,7 +233,7 @@
#else
virtual XalanSourceTreeElement*
#endif
- cloneNode(bool deep) const;
+ cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
@@ -398,14 +393,14 @@
* interface, this is always <CODE>null</CODE>.
*/
virtual const XalanDOMString&
- getNamespaceURI() const;
+ getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual const XalanDOMString&
- getPrefix() const;
+ getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
@@ -415,7 +410,7 @@
* it is null.
*/
virtual const XalanDOMString&
- getLocalName() const;
+ getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
@@ -478,7 +473,7 @@
* that attribute does not have a specified or default value.
*/
virtual const XalanDOMString&
- getAttribute(const XalanDOMString& name) const;
+ getAttribute(const XalanDOMString& name) const = 0;
/**
* Retrieves an <code>DOM_Attr</code> node by name.
@@ -488,7 +483,7 @@
* <code>null</code> if there is no such attribute.
*/
virtual XalanAttr*
- getAttributeNode(const XalanDOMString& name) const;
+ getAttributeNode(const XalanDOMString& name) const = 0;
/**
* Returns a <code>NodeList</code> of all descendant elements with a
given
@@ -609,7 +604,7 @@
virtual const XalanDOMString&
getAttributeNS(
const XalanDOMString& namespaceURI,
- const XalanDOMString& localName) const;
+ const XalanDOMString& localName) const = 0;
/**
* Adds a new attribute. If the given
@@ -689,7 +684,7 @@
virtual XalanAttr*
getAttributeNodeNS(
const XalanDOMString& namespaceURI,
- const XalanDOMString& localName) const;
+ const XalanDOMString& localName) const = 0;
/**
* Adds a new attribute.
@@ -795,18 +790,6 @@
m_index = theIndex;
}
- AttributesCountType
- getAttributeCount() const
- {
- return m_attributeCount;
- }
-
- XalanSourceTreeAttr*
- getAttributeByIndex(AttributesCountType index) const
- {
- return index < m_attributeCount ? m_attributes[index] : 0;
- }
-
/**
* Removes all of the children. Since the owner document controls the
* lifetime of all nodes in the document, this just sets the first
child
@@ -818,50 +801,15 @@
m_firstChild = 0;
}
- XalanSourceTreeElement*
- clone(bool deep) const
- {
- return new XalanSourceTreeElement(*this, deep);
- }
-
protected:
XalanSourceTreeElement(
const XalanSourceTreeElement& theSource,
bool
deep = false);
-private:
-
- // These are from XalanNamedNodeMap...
-
- virtual XalanNode*
- setNamedItem(XalanNode* arg);
-
- virtual XalanNode*
- item(unsigned int index) const;
-
- virtual XalanNode*
- getNamedItem(const XalanDOMString& name) const;
-
- virtual unsigned int
- getLength() const;
-
- virtual XalanNode*
- removeNamedItem(const XalanDOMString& name);
-
- virtual XalanNode*
- getNamedItemNS(
- const XalanDOMString& namespaceURI,
- const XalanDOMString& localName) const;
-
- virtual XalanNode*
- setNamedItemNS(XalanNode* arg);
-
- virtual XalanNode*
- removeNamedItemNS(
- const XalanDOMString& namespaceURI,
- const XalanDOMString& localName);
+ static const XalanDOMString s_emptyString;
+private:
// Not implemented...
XalanSourceTreeElement&
@@ -885,10 +833,6 @@
XalanNode* m_firstChild;
unsigned long m_index;
-
- XalanSourceTreeAttr* const * m_attributes;
-
- const AttributesCountType m_attributeCount;
};
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementA.cpp
Index: XalanSourceTreeElementA.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanSourceTreeElementA.hpp"
#include <XalanDOM/XalanDOMException.hpp>
#include "XalanSourceTreeAttr.hpp"
XALAN_CPP_NAMESPACE_BEGIN
static const XalanDOMString s_emptyString;
XalanSourceTreeElementA::XalanSourceTreeElementA(
const XalanDOMString& theTagName,
XalanSourceTreeDocument* theOwnerDocument,
XalanSourceTreeAttr** theAttributes,
AttributesCountType
theAttributeCount,
XalanNode*
theParentNode,
XalanNode*
thePreviousSibling,
XalanNode*
theNextSibling,
unsigned int theIndex) :
XalanSourceTreeElement(
theTagName,
theOwnerDocument,
theParentNode,
thePreviousSibling,
theNextSibling,
theIndex),
m_attributes(theAttributes),
m_attributeCount(theAttributeCount)
{
}
XalanSourceTreeElementA::~XalanSourceTreeElementA()
{
}
XalanSourceTreeElementA::XalanSourceTreeElementA(
const XalanSourceTreeElementA& theSource,
bool
deep) :
XalanSourceTreeElement(theSource, deep),
m_attributes(theSource.m_attributes),
m_attributeCount(theSource.m_attributeCount)
{
}
const XalanNamedNodeMap*
XalanSourceTreeElementA::getAttributes() const
{
return this;
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
XalanNode*
#else
XalanSourceTreeElementA*
#endif
XalanSourceTreeElementA::cloneNode(bool deep) const
{
return clone(deep);
}
const XalanDOMString&
XalanSourceTreeElementA::getNamespaceURI() const
{
return s_emptyString;
}
const XalanDOMString&
XalanSourceTreeElementA::getPrefix() const
{
return s_emptyString;
}
const XalanDOMString&
XalanSourceTreeElementA::getLocalName() const
{
return s_emptyString;
}
const XalanDOMString&
XalanSourceTreeElementA::getAttribute(const XalanDOMString& name)
const
{
XalanAttr* const theAttr = getAttributeNode(name);
return theAttr == 0 ? s_emptyString : theAttr->getValue();
}
XalanAttr*
XalanSourceTreeElementA::getAttributeNode(const XalanDOMString&
name) const
{
for(unsigned int i = 0; i < m_attributeCount; ++i)
{
assert(m_attributes[i] != 0);
if (m_attributes[i]->getNodeName() == name)
{
return m_attributes[i];
}
}
return 0;
}
const XalanDOMString&
XalanSourceTreeElementA::getAttributeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const
{
XalanAttr* const theAttr = getAttributeNodeNS(namespaceURI,
localName);
return theAttr == 0 ? s_emptyString : theAttr->getValue();
}
XalanAttr*
XalanSourceTreeElementA::getAttributeNodeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const
{
for(unsigned int i = 0; i < m_attributeCount; ++i)
{
assert(m_attributes[i] != 0);
if (m_attributes[i]->getLocalName() == localName &&
m_attributes[i]->getNamespaceURI() == namespaceURI)
{
return m_attributes[i];
}
}
return 0;
}
XalanNode*
XalanSourceTreeElementA::setNamedItem(XalanNode* /* arg */)
{
throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
// Dummy return value...
return 0;
}
XalanNode*
XalanSourceTreeElementA::item(unsigned int index) const
{
return index < m_attributeCount ? m_attributes[index] : 0;
}
XalanNode*
XalanSourceTreeElementA::getNamedItem(const XalanDOMString& name) const
{
return getAttributeNode(name);
}
unsigned int
XalanSourceTreeElementA::getLength() const
{
return m_attributeCount;
}
XalanNode*
XalanSourceTreeElementA::removeNamedItem(const XalanDOMString& /* name
*/)
{
throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
// Dummy return value...
return 0;
}
XalanNode*
XalanSourceTreeElementA::getNamedItemNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const
{
return getAttributeNodeNS(namespaceURI, localName);
}
XalanNode*
XalanSourceTreeElementA::setNamedItemNS(XalanNode* /* arg */)
{
throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
// Dummy return value...
return 0;
}
XalanNode*
XalanSourceTreeElementA::removeNamedItemNS(
const XalanDOMString& /* namespaceURI */,
const XalanDOMString& /* localName */)
{
throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
// Dummy return value...
return 0;
}
XALAN_CPP_NAMESPACE_END
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementA.hpp
Index: XalanSourceTreeElementA.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANSOURCETREEELEMENTA_HEADER_GUARD_1357924680)
#define XALANSOURCETREEELEMENTA_HEADER_GUARD_1357924680
#include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
#include <XalanDOM/XalanNamedNodeMap.hpp>
#include <XalanSourceTree/XalanSourceTreeElement.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElementA : public
XalanSourceTreeElement, private XalanNamedNodeMap
{
public:
typedef unsigned long AttributesCountType;
/**
* Constructor.
*
* @param theTagName The tag name of the element
* @param theOwnerDocument The document that owns the instance
* @param theAttributes An array of pointers to the attribute instances
for the element
* @param theAttributeCount The number of attributes.
* @param theParentNode The parent node, if any.
* @param thePreviousSibling The previous sibling, if any.
* @param theNextSibling The next sibling, if any.
* @param theIndex The document-order index of the node.
*/
XalanSourceTreeElementA(
const XalanDOMString& theTagName,
XalanSourceTreeDocument* theOwnerDocument,
XalanSourceTreeAttr** theAttributes,
AttributesCountType
theAttributeCount,
XalanNode*
theParentNode = 0,
XalanNode*
thePreviousSibling = 0,
XalanNode*
theNextSibling = 0,
unsigned int theIndex = 0);
virtual
~XalanSourceTreeElementA();
virtual const XalanNamedNodeMap*
getAttributes() const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XalanNode*
#else
virtual XalanSourceTreeElementA*
#endif
cloneNode(bool deep) const;
virtual const XalanDOMString&
getNamespaceURI() const;
virtual const XalanDOMString&
getPrefix() const;
virtual const XalanDOMString&
getLocalName() const;
virtual const XalanDOMString&
getAttribute(const XalanDOMString& name) const;
virtual XalanAttr*
getAttributeNode(const XalanDOMString& name) const;
virtual const XalanDOMString&
getAttributeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const;
virtual XalanAttr*
getAttributeNodeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const;
// public interfaces not inherited from XalanElement...
AttributesCountType
getAttributeCount() const
{
return m_attributeCount;
}
XalanSourceTreeAttr*
getAttributeByIndex(AttributesCountType index) const
{
return index < m_attributeCount ? m_attributes[index] : 0;
}
XalanSourceTreeElementA*
clone(bool deep) const
{
return new XalanSourceTreeElementA(*this, deep);
}
protected:
XalanSourceTreeElementA(
const XalanSourceTreeElementA& theSource,
bool
deep = false);
private:
// These are from XalanNamedNodeMap...
virtual XalanNode*
setNamedItem(XalanNode* arg);
virtual XalanNode*
item(unsigned int index) const;
virtual XalanNode*
getNamedItem(const XalanDOMString& name) const;
virtual unsigned int
getLength() const;
virtual XalanNode*
removeNamedItem(const XalanDOMString& name);
virtual XalanNode*
getNamedItemNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const;
virtual XalanNode*
setNamedItemNS(XalanNode* arg);
virtual XalanNode*
removeNamedItemNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName);
// Not implemented...
XalanSourceTreeElementA&
operator=(const XalanSourceTreeElementA& theSource);
bool
operator==(const XalanSourceTreeElementA& theRHS) const;
// Data members...
XalanSourceTreeAttr* const * m_attributes;
const AttributesCountType m_attributeCount;
};
XALAN_CPP_NAMESPACE_END
#endif // !defined(XALANSOURCETREEELEMENTA_HEADER_GUARD_1357924680)
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementAAllocator.cpp
Index: XalanSourceTreeElementAAllocator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
// Class header file.
#include "XalanSourceTreeElementAAllocator.hpp"
XALAN_CPP_NAMESPACE_BEGIN
XalanSourceTreeElementAAllocator::XalanSourceTreeElementAAllocator(size_type
theBlockCount) :
m_allocator(theBlockCount)
{
}
XalanSourceTreeElementAAllocator::~XalanSourceTreeElementAAllocator()
{
}
XalanSourceTreeElementAAllocator::ObjectType*
XalanSourceTreeElementAAllocator::create(
const XalanDOMString& theTagName,
XalanSourceTreeDocument* theOwnerDocument,
XalanSourceTreeAttr** theAttributes,
AttributesCountType
theAttributeCount,
XalanNode*
theParentNode,
XalanNode*
thePreviousSibling,
XalanNode*
theNextSibling,
unsigned int theIndex)
{
ObjectType* const theBlock = m_allocator.allocateBlock();
assert(theBlock != 0);
new(theBlock) ObjectType(
theTagName,
theOwnerDocument,
theAttributes,
theAttributeCount,
theParentNode,
thePreviousSibling,
theNextSibling,
theIndex);
m_allocator.commitAllocation(theBlock);
return theBlock;
}
void
XalanSourceTreeElementAAllocator::reset()
{
m_allocator.reset();
}
XALAN_CPP_NAMESPACE_END
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementAAllocator.hpp
Index: XalanSourceTreeElementAAllocator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANSOURCETREEELEMENTAALLOCATOR_INCLUDE_GUARD_12455133)
#define XALANSOURCETREEELEMENTAALLOCATOR_INCLUDE_GUARD_12455133
#include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
#include <PlatformSupport/ArenaAllocator.hpp>
#include <XalanSourceTree/XalanSourceTreeElementA.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElementAAllocator
{
public:
typedef XalanSourceTreeElementA
ObjectType;
typedef ObjectType::AttributesCountType
AttributesCountType;
#if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
typedef ArenaBlock<ObjectType>
ArenaBlockType;
typedef ArenaAllocator<ObjectType,
ArenaBlockType>
ArenaAllocatorType;
#else
typedef ArenaAllocator<ObjectType>
ArenaAllocatorType;
#endif
typedef ArenaAllocatorType::size_type size_type;
/**
* Construct an instance that will allocate blocks of the specified
size.
*
* @param theBlockSize The block size.
*/
XalanSourceTreeElementAAllocator(size_type theBlockCount);
~XalanSourceTreeElementAAllocator();
/**
* Create an instance.
*
* @param theTagName The tag name of the element
* @param theOwnerDocument The document that owns the instance
* @param theAttributes An array of pointers to the attribute instances
for the element
* @param theAttributeCount The number of attributes.
* @param theParentNode The parent node, if any.
* @param thePreviousSibling The previous sibling, if any.
* @param theNextSibling The next sibling, if any.
* @param theIndex The document-order index of the node.
*
* @return pointer to the instance
*/
ObjectType*
create(
const XalanDOMString& theTagName,
XalanSourceTreeDocument* theOwnerDocument,
XalanSourceTreeAttr** theAttributes,
AttributesCountType
theAttributeCount,
XalanNode*
theParentNode = 0,
XalanNode*
thePreviousSibling = 0,
XalanNode*
theNextSibling = 0,
unsigned int theIndex = 0);
/**
* Delete all objects from allocator.
*/
void
reset();
/**
* Get size of an ArenaBlock, that is, the number
* of objects in each block.
*
* @return The size of the block
*/
size_type
getBlockCount() const
{
return m_allocator.getBlockCount();
}
/**
* Get the number of ArenaBlocks currently allocated.
*
* @return The number of blocks.
*/
size_type
getBlockSize() const
{
return m_allocator.getBlockSize();
}
private:
// Not implemented...
XalanSourceTreeElementAAllocator(const
XalanSourceTreeElementAAllocator&);
XalanSourceTreeElementAAllocator&
operator=(const XalanSourceTreeElementAAllocator&);
// Data members...
ArenaAllocatorType m_allocator;
};
XALAN_CPP_NAMESPACE_END
#endif // XALANSOURCETREEELEMENTAALLOCATOR_INCLUDE_GUARD_12455133
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementANS.cpp
Index: XalanSourceTreeElementANS.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanSourceTreeElementANS.hpp"
XALAN_CPP_NAMESPACE_BEGIN
XalanSourceTreeElementANS::XalanSourceTreeElementANS(
const XalanDOMString& theTagName,
const XalanDOMString& theLocalName,
const XalanDOMString& theNamespaceURI,
const XalanDOMString& thePrefix,
XalanSourceTreeDocument* theOwnerDocument,
XalanSourceTreeAttr** theAttributes,
AttributesCountType
theAttributeCount,
XalanNode*
theParentNode,
XalanNode*
thePreviousSibling,
XalanNode*
theNextSibling,
unsigned int theIndex) :
XalanSourceTreeElementA(
theTagName,
theOwnerDocument,
theAttributes,
theAttributeCount,
theParentNode,
thePreviousSibling,
theNextSibling,
theIndex),
m_localName(theLocalName),
m_prefix(thePrefix),
m_namespaceURI(theNamespaceURI)
{
}
XalanSourceTreeElementANS::~XalanSourceTreeElementANS()
{
}
XalanSourceTreeElementANS::XalanSourceTreeElementANS(
const XalanSourceTreeElementANS& theSource,
bool
deep) :
XalanSourceTreeElementA(theSource, deep),
m_localName(theSource.m_localName),
m_prefix(theSource.m_prefix),
m_namespaceURI(theSource.m_namespaceURI)
{
}
XalanSourceTreeElementANS::XalanSourceTreeElementANS(
const XalanSourceTreeElementA& theSource,
bool
deep) :
XalanSourceTreeElementA(theSource, deep),
m_localName(theSource.getLocalName()),
m_prefix(theSource.getPrefix()),
m_namespaceURI(theSource.getNamespaceURI())
{
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
XalanNode*
#else
XalanSourceTreeElementANS*
#endif
XalanSourceTreeElementANS::cloneNode(bool deep) const
{
return new XalanSourceTreeElementANS(*this, deep);
}
const XalanDOMString&
XalanSourceTreeElementANS::getNamespaceURI() const
{
return m_namespaceURI;
}
const XalanDOMString&
XalanSourceTreeElementANS::getPrefix() const
{
return m_prefix;
}
const XalanDOMString&
XalanSourceTreeElementANS::getLocalName() const
{
return m_localName;
}
XALAN_CPP_NAMESPACE_END
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementANS.hpp
Index: XalanSourceTreeElementANS.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANSOURCETREEELEMENTANS_HEADER_GUARD_1357924680)
#define XALANSOURCETREEELEMENTANS_HEADER_GUARD_1357924680
#include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
#include <XalanSourceTree/XalanSourceTreeElementA.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElementANS : public
XalanSourceTreeElementA
{
public:
/**
* Constructor.
*
* @param theTagName The tag name of the element
* @param theLocalName The local name of the attribute
* @param theNamespaceURI The namespace URI of the attribute
* @param thePrefix The namespace prefix of the attribute
* @param theOwnerDocument The document that owns the instance
* @param theAttributes An array of pointers to the attribute instances
for the element
* @param theAttributeCount The number of attributes.
* @param theParentNode The parent node, if any.
* @param thePreviousSibling The previous sibling, if any.
* @param theNextSibling The next sibling, if any.
* @param theIndex The document-order index of the node.
*/
XalanSourceTreeElementANS(
const XalanDOMString& theTagName,
const XalanDOMString& theLocalName,
const XalanDOMString& theNamespaceURI,
const XalanDOMString& thePrefix,
XalanSourceTreeDocument* theOwnerDocument,
XalanSourceTreeAttr** theAttributes,
AttributesCountType
theAttributeCount,
XalanNode*
theParentNode = 0,
XalanNode*
thePreviousSibling = 0,
XalanNode*
theNextSibling = 0,
unsigned int theIndex = 0);
virtual
~XalanSourceTreeElementANS();
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XalanNode*
#else
virtual XalanSourceTreeElementANS*
#endif
cloneNode(bool deep) const;
virtual const XalanDOMString&
getNamespaceURI() const;
virtual const XalanDOMString&
getPrefix() const;
virtual const XalanDOMString&
getLocalName() const;
protected:
XalanSourceTreeElementANS(
const XalanSourceTreeElementANS& theSource,
bool
deep);
XalanSourceTreeElementANS(
const XalanSourceTreeElementA& theSource,
bool
deep);
private:
// Not implemented...
XalanSourceTreeElementANS&
operator=(const XalanSourceTreeElementANS& theSource);
bool
operator==(const XalanSourceTreeElementANS& theRHS) const;
// Data members...
const XalanDOMString& m_localName;
const XalanDOMString& m_prefix;
const XalanDOMString& m_namespaceURI;
};
XALAN_CPP_NAMESPACE_END
#endif // !defined(XALANSOURCETREEELEMENTANS_HEADER_GUARD_1357924680)
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementANSAllocator.cpp
Index: XalanSourceTreeElementANSAllocator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
// Class header file.
#include "XalanSourceTreeElementANSAllocator.hpp"
XALAN_CPP_NAMESPACE_BEGIN
XalanSourceTreeElementANSAllocator::XalanSourceTreeElementANSAllocator(size_type
theBlockCount) :
m_allocator(theBlockCount)
{
}
XalanSourceTreeElementANSAllocator::~XalanSourceTreeElementANSAllocator()
{
}
XalanSourceTreeElementANSAllocator::ObjectType*
XalanSourceTreeElementANSAllocator::create(
const XalanDOMString& theTagName,
const XalanDOMString& theLocalName,
const XalanDOMString& theNamespaceURI,
const XalanDOMString& thePrefix,
XalanSourceTreeDocument* theOwnerDocument,
XalanSourceTreeAttr** theAttributes,
AttributesCountType
theAttributeCount,
XalanNode*
theParentNode,
XalanNode*
thePreviousSibling,
XalanNode*
theNextSibling,
unsigned int theIndex)
{
ObjectType* const theBlock = m_allocator.allocateBlock();
assert(theBlock != 0);
new(theBlock) ObjectType(
theTagName,
theLocalName,
theNamespaceURI,
thePrefix,
theOwnerDocument,
theAttributes,
theAttributeCount,
theParentNode,
thePreviousSibling,
theNextSibling,
theIndex);
m_allocator.commitAllocation(theBlock);
return theBlock;
}
void
XalanSourceTreeElementANSAllocator::reset()
{
m_allocator.reset();
}
XALAN_CPP_NAMESPACE_END
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementANSAllocator.hpp
Index: XalanSourceTreeElementANSAllocator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANSOURCETREEELEMENTANSALLOCATOR_INCLUDE_GUARD_12455133)
#define XALANSOURCETREEELEMENTANSALLOCATOR_INCLUDE_GUARD_12455133
#include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
#include <PlatformSupport/ArenaAllocator.hpp>
#include <XalanSourceTree/XalanSourceTreeElementANS.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElementANSAllocator
{
public:
typedef XalanSourceTreeElementANS
ObjectType;
typedef ObjectType::AttributesCountType
AttributesCountType;
#if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
typedef ArenaBlock<ObjectType>
ArenaBlockType;
typedef ArenaAllocator<ObjectType,
ArenaBlockType>
ArenaAllocatorType;
#else
typedef ArenaAllocator<ObjectType>
ArenaAllocatorType;
#endif
typedef ArenaAllocatorType::size_type size_type;
/**
* Construct an instance that will allocate blocks of the specified
size.
*
* @param theBlockSize The block size.
*/
XalanSourceTreeElementANSAllocator(size_type theBlockCount);
~XalanSourceTreeElementANSAllocator();
/**
* Create an instance.
*
* @param theTagName The tag name of the element
* @param theLocalName The local name of the attribute
* @param theNamespaceURI The namespace URI of the attribute
* @param thePrefix The namespace prefix of the attribute
* @param theOwnerDocument The document that owns the instance
* @param theAttributes An array of pointers to the attribute instances
for the element
* @param theAttributeCount The number of attributes.
* @param theParentNode The parent node, if any.
* @param thePreviousSibling The previous sibling, if any.
* @param theNextSibling The next sibling, if any.
* @param theIndex The document-order index of the node.
*
* @return pointer to the instance
*/
ObjectType*
create(
const XalanDOMString& theTagName,
const XalanDOMString& theLocalName,
const XalanDOMString& theNamespaceURI,
const XalanDOMString& thePrefix,
XalanSourceTreeDocument* theOwnerDocument,
XalanSourceTreeAttr** theAttributes,
AttributesCountType
theAttributeCount,
XalanNode*
theParentNode = 0,
XalanNode*
thePreviousSibling = 0,
XalanNode*
theNextSibling = 0,
unsigned int theIndex = 0);
/**
* Delete all objects from allocator.
*/
void
reset();
/**
* Get size of an ArenaBlock, that is, the number
* of objects in each block.
*
* @return The size of the block
*/
size_type
getBlockCount() const
{
return m_allocator.getBlockCount();
}
/**
* Get the number of ArenaBlocks currently allocated.
*
* @return The number of blocks.
*/
size_type
getBlockSize() const
{
return m_allocator.getBlockSize();
}
private:
// Not implemented...
XalanSourceTreeElementANSAllocator(const
XalanSourceTreeElementANSAllocator&);
XalanSourceTreeElementANSAllocator&
operator=(const XalanSourceTreeElementANSAllocator&);
// Data members...
ArenaAllocatorType m_allocator;
};
XALAN_CPP_NAMESPACE_END
#endif // XALANSOURCETREEELEMENTANSALLOCATOR_INCLUDE_GUARD_12455133
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementNA.cpp
Index: XalanSourceTreeElementNA.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanSourceTreeElementNA.hpp"
#include <XalanDOM/XalanDOMException.hpp>
XALAN_CPP_NAMESPACE_BEGIN
const XalanEmptyNamedNodeMap XalanSourceTreeElementNA::s_emptyAttributes;
XalanSourceTreeElementNA::XalanSourceTreeElementNA(
const XalanDOMString& theTagName,
XalanSourceTreeDocument* theOwnerDocument,
XalanNode*
theParentNode,
XalanNode*
thePreviousSibling,
XalanNode*
theNextSibling,
unsigned int theIndex) :
XalanSourceTreeElement(
theTagName,
theOwnerDocument,
theParentNode,
thePreviousSibling,
theNextSibling,
theIndex)
{
}
XalanSourceTreeElementNA::~XalanSourceTreeElementNA()
{
}
XalanSourceTreeElementNA::XalanSourceTreeElementNA(
const XalanSourceTreeElementNA& theSource,
bool
deep) :
XalanSourceTreeElement(theSource, deep)
{
}
const XalanNamedNodeMap*
XalanSourceTreeElementNA::getAttributes() const
{
return &s_emptyAttributes;
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
XalanNode*
#else
XalanSourceTreeElementNA*
#endif
XalanSourceTreeElementNA::cloneNode(bool deep) const
{
return clone(deep);
}
const XalanDOMString&
XalanSourceTreeElementNA::getNamespaceURI() const
{
return s_emptyString;
}
const XalanDOMString&
XalanSourceTreeElementNA::getPrefix() const
{
return s_emptyString;
}
const XalanDOMString&
XalanSourceTreeElementNA::getLocalName() const
{
return s_emptyString;
}
const XalanDOMString&
XalanSourceTreeElementNA::getAttribute(const XalanDOMString& /* name */)
const
{
return s_emptyString;
}
XalanAttr*
XalanSourceTreeElementNA::getAttributeNode(const XalanDOMString& /* name
*/) const
{
return 0;
}
const XalanDOMString&
XalanSourceTreeElementNA::getAttributeNS(
const XalanDOMString& /* namespaceURI */,
const XalanDOMString& /* localName */) const
{
return s_emptyString;
}
XalanAttr*
XalanSourceTreeElementNA::getAttributeNodeNS(
const XalanDOMString& /* namespaceURI */,
const XalanDOMString& /* localName */) const
{
return 0;
}
XALAN_CPP_NAMESPACE_END
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementNA.hpp
Index: XalanSourceTreeElementNA.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANSOURCETREEELEMENTNA_HEADER_GUARD_1357924680)
#define XALANSOURCETREEELEMENTNA_HEADER_GUARD_1357924680
#include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
#include <XalanDOM/XalanEmptyNamedNodeMap.hpp>
#include <XalanSourceTree/XalanSourceTreeElement.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElementNA : public
XalanSourceTreeElement
{
public:
/**
* Constructor.
*
* @param theTagName The tag name of the element
* @param theOwnerDocument The document that owns the instance
* @param theParentNode The parent node, if any.
* @param thePreviousSibling The previous sibling, if any.
* @param theNextSibling The next sibling, if any.
* @param theIndex The document-order index of the node.
*/
XalanSourceTreeElementNA(
const XalanDOMString& theTagName,
XalanSourceTreeDocument* theOwnerDocument,
XalanNode*
theParentNode = 0,
XalanNode*
thePreviousSibling = 0,
XalanNode*
theNextSibling = 0,
unsigned int theIndex = 0);
virtual
~XalanSourceTreeElementNA();
virtual const XalanNamedNodeMap*
getAttributes() const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XalanNode*
#else
virtual XalanSourceTreeElementNA*
#endif
cloneNode(bool deep) const;
virtual const XalanDOMString&
getNamespaceURI() const;
virtual const XalanDOMString&
getPrefix() const;
virtual const XalanDOMString&
getLocalName() const;
virtual const XalanDOMString&
getAttribute(const XalanDOMString& name) const;
virtual XalanAttr*
getAttributeNode(const XalanDOMString& name) const;
virtual const XalanDOMString&
getAttributeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const;
virtual XalanAttr*
getAttributeNodeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const;
// public interfaces not inherited from XalanElement...
XalanSourceTreeElementNA*
clone(bool deep) const
{
return new XalanSourceTreeElementNA(*this, deep);
}
protected:
XalanSourceTreeElementNA(
const XalanSourceTreeElementNA& theSource,
bool
deep = false);
static const XalanEmptyNamedNodeMap s_emptyAttributes;
private:
// Not implemented...
XalanSourceTreeElementNA&
operator=(const XalanSourceTreeElementNA& theSource);
bool
operator==(const XalanSourceTreeElementNA& theRHS) const;
};
XALAN_CPP_NAMESPACE_END
#endif // !defined(XALANSOURCETREEELEMENTNA_HEADER_GUARD_1357924680)
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementNAAllocator.cpp
Index: XalanSourceTreeElementNAAllocator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
// Class header file.
#include "XalanSourceTreeElementNAAllocator.hpp"
XALAN_CPP_NAMESPACE_BEGIN
XalanSourceTreeElementNAAllocator::XalanSourceTreeElementNAAllocator(size_type
theBlockCount) :
m_allocator(theBlockCount)
{
}
XalanSourceTreeElementNAAllocator::~XalanSourceTreeElementNAAllocator()
{
}
XalanSourceTreeElementNAAllocator::ObjectType*
XalanSourceTreeElementNAAllocator::create(
const XalanDOMString& theTagName,
XalanSourceTreeDocument* theOwnerDocument,
XalanNode*
theParentNode,
XalanNode*
thePreviousSibling,
XalanNode*
theNextSibling,
unsigned int theIndex)
{
ObjectType* const theBlock = m_allocator.allocateBlock();
assert(theBlock != 0);
new(theBlock) ObjectType(
theTagName,
theOwnerDocument,
theParentNode,
thePreviousSibling,
theNextSibling,
theIndex);
m_allocator.commitAllocation(theBlock);
return theBlock;
}
void
XalanSourceTreeElementNAAllocator::reset()
{
m_allocator.reset();
}
XALAN_CPP_NAMESPACE_END
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementNAAllocator.hpp
Index: XalanSourceTreeElementNAAllocator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANSOURCETREEELEMENTNAALLOCATOR_INCLUDE_GUARD_12455133)
#define XALANSOURCETREEELEMENTNAALLOCATOR_INCLUDE_GUARD_12455133
#include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
#include <PlatformSupport/ArenaAllocator.hpp>
#include <XalanSourceTree/XalanSourceTreeElementNA.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElementNAAllocator
{
public:
typedef XalanSourceTreeElementNA
ObjectType;
#if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
typedef ArenaBlock<ObjectType>
ArenaBlockType;
typedef ArenaAllocator<ObjectType,
ArenaBlockType>
ArenaAllocatorType;
#else
typedef ArenaAllocator<ObjectType>
ArenaAllocatorType;
#endif
typedef ArenaAllocatorType::size_type size_type;
/**
* Construct an instance that will allocate blocks of the specified
size.
*
* @param theBlockSize The block size.
*/
XalanSourceTreeElementNAAllocator(size_type theBlockCount);
~XalanSourceTreeElementNAAllocator();
/**
* Create an instance.
*
* @param theTagName The tag name of the element
* @param theOwnerDocument The document that owns the instance
* @param theParentNode The parent node, if any.
* @param thePreviousSibling The previous sibling, if any.
* @param theNextSibling The next sibling, if any.
* @param theIndex The document-order index of the node.
*
* @return pointer to the instance
*/
ObjectType*
create(
const XalanDOMString& theTagName,
XalanSourceTreeDocument* theOwnerDocument,
XalanNode*
theParentNode = 0,
XalanNode*
thePreviousSibling = 0,
XalanNode*
theNextSibling = 0,
unsigned int theIndex = 0);
/**
* Delete all objects from allocator.
*/
void
reset();
/**
* Get size of an ArenaBlock, that is, the number
* of objects in each block.
*
* @return The size of the block
*/
size_type
getBlockCount() const
{
return m_allocator.getBlockCount();
}
/**
* Get the number of ArenaBlocks currently allocated.
*
* @return The number of blocks.
*/
size_type
getBlockSize() const
{
return m_allocator.getBlockSize();
}
private:
// Not implemented...
XalanSourceTreeElementNAAllocator(const
XalanSourceTreeElementNAAllocator&);
XalanSourceTreeElementNAAllocator&
operator=(const XalanSourceTreeElementNAAllocator&);
// Data members...
ArenaAllocatorType m_allocator;
};
XALAN_CPP_NAMESPACE_END
#endif // XALANSOURCETREEELEMENTNAALLOCATOR_INCLUDE_GUARD_12455133
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementNANS.cpp
Index: XalanSourceTreeElementNANS.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanSourceTreeElementNANS.hpp"
XALAN_CPP_NAMESPACE_BEGIN
XalanSourceTreeElementNANS::XalanSourceTreeElementNANS(
const XalanDOMString& theTagName,
const XalanDOMString& theLocalName,
const XalanDOMString& theNamespaceURI,
const XalanDOMString& thePrefix,
XalanSourceTreeDocument* theOwnerDocument,
XalanNode*
theParentNode,
XalanNode*
thePreviousSibling,
XalanNode*
theNextSibling,
unsigned int theIndex) :
XalanSourceTreeElementNA(
theTagName,
theOwnerDocument,
theParentNode,
thePreviousSibling,
theNextSibling,
theIndex),
m_localName(theLocalName),
m_prefix(thePrefix),
m_namespaceURI(theNamespaceURI)
{
}
XalanSourceTreeElementNANS::~XalanSourceTreeElementNANS()
{
}
XalanSourceTreeElementNANS::XalanSourceTreeElementNANS(
const XalanSourceTreeElementNANS& theSource,
bool
deep) :
XalanSourceTreeElementNA(theSource, deep),
m_localName(theSource.m_localName),
m_prefix(theSource.m_prefix),
m_namespaceURI(theSource.m_namespaceURI)
{
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
XalanNode*
#else
XalanSourceTreeElementNANS*
#endif
XalanSourceTreeElementNANS::cloneNode(bool deep) const
{
return clone(deep);
}
const XalanDOMString&
XalanSourceTreeElementNANS::getNamespaceURI() const
{
return m_namespaceURI;
}
const XalanDOMString&
XalanSourceTreeElementNANS::getPrefix() const
{
return m_prefix;
}
const XalanDOMString&
XalanSourceTreeElementNANS::getLocalName() const
{
return m_localName;
}
XALAN_CPP_NAMESPACE_END
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementNANS.hpp
Index: XalanSourceTreeElementNANS.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANSOURCETREEELEMENTNANS_HEADER_GUARD_1357924680)
#define XALANSOURCETREEELEMENTNANS_HEADER_GUARD_1357924680
#include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
#include <XalanSourceTree/XalanSourceTreeElementNA.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElementNANS : public
XalanSourceTreeElementNA
{
public:
/**
* Constructor.
*
* @param theTagName The tag name of the element
* @param theLocalName The local name of the attribute
* @param theNamespaceURI The namespace URI of the attribute
* @param thePrefix The namespace prefix of the attribute
* @param theOwnerDocument The document that owns the instance
* @param theParentNode The parent node, if any.
* @param thePreviousSibling The previous sibling, if any.
* @param theNextSibling The next sibling, if any.
* @param theIndex The document-order index of the node.
*/
XalanSourceTreeElementNANS(
const XalanDOMString& theTagName,
const XalanDOMString& theLocalName,
const XalanDOMString& theNamespaceURI,
const XalanDOMString& thePrefix,
XalanSourceTreeDocument* theOwnerDocument,
XalanNode*
theParentNode = 0,
XalanNode*
thePreviousSibling = 0,
XalanNode*
theNextSibling = 0,
unsigned int theIndex = 0);
virtual
~XalanSourceTreeElementNANS();
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XalanNode*
#else
virtual XalanSourceTreeElementNANS*
#endif
cloneNode(bool deep) const;
virtual const XalanDOMString&
getNamespaceURI() const;
virtual const XalanDOMString&
getPrefix() const;
virtual const XalanDOMString&
getLocalName() const;
// public interfaces not inherited from XalanElement...
XalanSourceTreeElementNANS*
clone(bool deep) const
{
return new XalanSourceTreeElementNANS(*this, deep);
}
protected:
XalanSourceTreeElementNANS(
const XalanSourceTreeElementNANS&
theSource,
bool
deep = false);
private:
// Not implemented...
XalanSourceTreeElementNANS&
operator=(const XalanSourceTreeElementNANS& theSource);
bool
operator==(const XalanSourceTreeElementNANS& theRHS) const;
// Data members...
const XalanDOMString& m_localName;
const XalanDOMString& m_prefix;
const XalanDOMString& m_namespaceURI;
};
XALAN_CPP_NAMESPACE_END
#endif // !defined(XALANSOURCETREEELEMENTNANS_HEADER_GUARD_1357924680)
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementNANSAllocator.cpp
Index: XalanSourceTreeElementNANSAllocator.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
// Class header file.
#include "XalanSourceTreeElementNANSAllocator.hpp"
XALAN_CPP_NAMESPACE_BEGIN
XalanSourceTreeElementNANSAllocator::XalanSourceTreeElementNANSAllocator(size_type
theBlockCount) :
m_allocator(theBlockCount)
{
}
XalanSourceTreeElementNANSAllocator::~XalanSourceTreeElementNANSAllocator()
{
}
XalanSourceTreeElementNANSAllocator::ObjectType*
XalanSourceTreeElementNANSAllocator::create(
const XalanDOMString& theTagName,
const XalanDOMString& theLocalName,
const XalanDOMString& theNamespaceURI,
const XalanDOMString& thePrefix,
XalanSourceTreeDocument* theOwnerDocument,
XalanNode*
theParentNode,
XalanNode*
thePreviousSibling,
XalanNode*
theNextSibling,
unsigned int theIndex)
{
ObjectType* const theBlock = m_allocator.allocateBlock();
assert(theBlock != 0);
new(theBlock) ObjectType(
theTagName,
theLocalName,
theNamespaceURI,
thePrefix,
theOwnerDocument,
theParentNode,
thePreviousSibling,
theNextSibling,
theIndex);
m_allocator.commitAllocation(theBlock);
return theBlock;
}
void
XalanSourceTreeElementNANSAllocator::reset()
{
m_allocator.reset();
}
XALAN_CPP_NAMESPACE_END
1.1
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementNANSAllocator.hpp
Index: XalanSourceTreeElementNANSAllocator.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANSOURCETREEELEMENTNANSALLOCATOR_INCLUDE_GUARD_12455133)
#define XALANSOURCETREEELEMENTNANSALLOCATOR_INCLUDE_GUARD_12455133
#include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
#include <PlatformSupport/ArenaAllocator.hpp>
#include <XalanSourceTree/XalanSourceTreeElementNANS.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElementNANSAllocator
{
public:
typedef XalanSourceTreeElementNANS
ObjectType;
#if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
typedef ArenaBlock<ObjectType>
ArenaBlockType;
typedef ArenaAllocator<ObjectType,
ArenaBlockType>
ArenaAllocatorType;
#else
typedef ArenaAllocator<ObjectType>
ArenaAllocatorType;
#endif
typedef ArenaAllocatorType::size_type size_type;
/**
* Construct an instance that will allocate blocks of the specified
size.
*
* @param theBlockSize The block size.
*/
XalanSourceTreeElementNANSAllocator(size_type theBlockCount);
~XalanSourceTreeElementNANSAllocator();
/**
* Create an instance.
*
* @param theTagName The tag name of the element
* @param theLocalName The local name of the attribute
* @param theNamespaceURI The namespace URI of the attribute
* @param thePrefix The namespace prefix of the attribute
* @param theOwnerDocument The document that owns the instance
* @param theAttributes An array of pointers to the attribute instances
for the element
* @param theAttributeCount The number of attributes.
* @param theParentNode The parent node, if any.
* @param thePreviousSibling The previous sibling, if any.
* @param theNextSibling The next sibling, if any.
* @param theIndex The document-order index of the node.
*
* @return pointer to the instance
*/
ObjectType*
create(
const XalanDOMString& theTagName,
const XalanDOMString& theLocalName,
const XalanDOMString& theNamespaceURI,
const XalanDOMString& thePrefix,
XalanSourceTreeDocument* theOwnerDocument,
XalanNode*
theParentNode = 0,
XalanNode*
thePreviousSibling = 0,
XalanNode*
theNextSibling = 0,
unsigned int theIndex = 0);
/**
* Delete all objects from allocator.
*/
void
reset();
/**
* Get size of an ArenaBlock, that is, the number
* of objects in each block.
*
* @return The size of the block
*/
size_type
getBlockCount() const
{
return m_allocator.getBlockCount();
}
/**
* Get the number of ArenaBlocks currently allocated.
*
* @return The number of blocks.
*/
size_type
getBlockSize() const
{
return m_allocator.getBlockSize();
}
private:
// Not implemented...
XalanSourceTreeElementNANSAllocator(const
XalanSourceTreeElementNANSAllocator&);
XalanSourceTreeElementNANSAllocator&
operator=(const XalanSourceTreeElementNANSAllocator&);
// Data members...
ArenaAllocatorType m_allocator;
};
XALAN_CPP_NAMESPACE_END
#endif // XALANSOURCETREEELEMENTANSALLOCATOR_INCLUDE_GUARD_12455133
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]