You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ro...@apache.org on 2004/08/03 12:23:27 UTC
cvs commit: ws-axis/c/src/soap CharacterElement.h ComplexElement.h ComplexElement.cpp
roshan 2004/08/03 03:23:27
Modified: c/include/axis/server BasicNode.h
c/src/soap CharacterElement.h ComplexElement.h
ComplexElement.cpp
Log:
added getXXX methods to traverse the SOAP Header Attributes
Revision Changes Path
1.18 +25 -0 ws-axis/c/include/axis/server/BasicNode.h
Index: BasicNode.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/server/BasicNode.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- BasicNode.h 2 Aug 2004 14:15:26 -0000 1.17
+++ BasicNode.h 3 Aug 2004 10:23:26 -0000 1.18
@@ -76,6 +76,31 @@
{
public:
+ /**
+ * Returns the first Attribute of this node. The operation
+ * behavior depends on the TYPE of the node.
+ */
+ virtual IAttribute* getFirstAttribute() = 0;
+
+ /**
+ * Returns the last Attribute of this node. The operation
+ * behavior depends on the TYPE of the node.
+ */
+ virtual IAttribute* getLastAttribute() = 0;
+
+ /**
+ * Returns the next Attribute of this node. The operation
+ * behavior depends on the TYPE of the node.
+ */
+ virtual IAttribute* getNextAttribute() = 0;
+
+ /**
+ * Returns the current Attribute of this node. The operation
+ * behavior depends on the TYPE of the node.
+ */
+ virtual IAttribute* getCurrentAttribute() = 0;
+
+
/**
* Creates an Attribute and adds it to this Basic Node.
*
1.10 +28 -0 ws-axis/c/src/soap/CharacterElement.h
Index: CharacterElement.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/CharacterElement.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- CharacterElement.h 2 Aug 2004 14:15:27 -0000 1.9
+++ CharacterElement.h 3 Aug 2004 10:23:26 -0000 1.10
@@ -50,6 +50,34 @@
{
public:
+ /**
+ * This method is overridden to always return NULL because this is a CharacterElement.
+ * A user of a CharacterElement should not use this method
+ */
+ virtual IAttribute* getFirstAttribute()
+ { return NULL; }
+
+ /**
+ * This method is overridden to always return NULL because this is a CharacterElement.
+ * A user of a CharacterElement should not use this method
+ */
+ virtual IAttribute* getLastAttribute()
+ { return NULL; }
+
+ /**
+ * This method is overridden to always return NULL because this is a CharacterElement.
+ * A user of a CharacterElement should not use this method
+ */
+ virtual IAttribute* getNextAttribute()
+ { return NULL; }
+
+ /**
+ * This method is overridden to always return NULL because this is a CharacterElement.
+ * A user of a CharacterElement should not use this method
+ */
+ virtual IAttribute* getCurrentAttribute()
+ { return NULL; }
+
/**
* This method is overridden to always return NULL because this is a CharacterElement.
* A user of a CharacterElement should not use this method
1.15 +32 -0 ws-axis/c/src/soap/ComplexElement.h
Index: ComplexElement.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/ComplexElement.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ComplexElement.h 2 Aug 2004 14:15:27 -0000 1.14
+++ ComplexElement.h 3 Aug 2004 10:23:26 -0000 1.15
@@ -67,6 +67,32 @@
public:
ComplexElement(AxisChar* pachLocalName, AxisChar* pachPrefix, AxisChar* pachUri);
+ /**
+ * Returns the first Attribute of this node. NOTE: When traversing the
+ * attributes this has to be called first, before calling the
+ * getNextAttribute() mthod.
+ */
+ IAttribute* getFirstAttribute();
+
+ /**
+ * Returns the last Attribute of this node.
+ */
+ IAttribute* getLastAttribute();
+
+ /**
+ * Returns the next Attribute of this node. NOTE: When traversing the
+ * attributes getFirstAttribute() has to be called first, before calling this
+ * mthod, otherwise the behavior is undefined.
+ */
+ IAttribute* getNextAttribute();
+
+ /**
+ * Returns the current Attribute of this node. NOTE: When traversing the
+ * attributes getFirstAttribute() has to be called first, before calling this
+ * mthod, otherwise the behavior is undefined.
+ */
+ IAttribute* getCurrentAttribute();
+
/**
* Creates an Attribute and adds it to this Complex Element.
*
@@ -223,6 +249,12 @@
AxisChar* m_pachPrefix;
AxisChar* m_pachLocalName;
AxisChar* m_pachURI;
+
+ /**
+ * Attributes iterator
+ */
+ list <Attribute *>::iterator m_viCurrentAttribute;
+
};
#endif
1.21 +53 -0 ws-axis/c/src/soap/ComplexElement.cpp
Index: ComplexElement.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/ComplexElement.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- ComplexElement.cpp 2 Aug 2004 14:15:27 -0000 1.20
+++ ComplexElement.cpp 3 Aug 2004 10:23:26 -0000 1.21
@@ -448,3 +448,56 @@
const AxisChar* ComplexElement::getLocalName() {
return m_pachLocalName;
}
+
+IAttribute* ComplexElement::getFirstAttribute()
+{
+ m_viCurrentAttribute = m_attributes.begin();
+ if ( m_viCurrentAttribute == m_attributes.end())
+ return NULL;
+ else
+ return ((IAttribute*)*m_viCurrentAttribute);
+}
+
+IAttribute* ComplexElement::getLastAttribute()
+{
+ /*To do : check the logic
+ */
+/* m_viCurrentAttribute = m_attributes.end();
+ if ( m_viCurrentAttribute == m_attributes.end())
+ return NULL;
+ else
+ return ((IAttribute*)*m_viCurrentAttribute);
+*/
+
+ list <Attribute*>::reverse_iterator iAttributeReverseIte = m_attributes.rbegin();
+ if (iAttributeReverseIte == m_attributes.rend()) {
+ m_viCurrentAttribute = m_attributes.end();
+ return NULL;
+ } else {
+ m_viCurrentAttribute = m_attributes.end();
+ return ((IAttribute*)*iAttributeReverseIte);
+ }
+}
+
+IAttribute* ComplexElement::getNextAttribute()
+{
+ //already at the end?
+ if (m_viCurrentAttribute == m_attributes.end())
+ return NULL;
+
+ m_viCurrentAttribute++;
+ if ( m_viCurrentAttribute == m_attributes.end())
+ return NULL;
+ else
+ return ((IAttribute*)*m_viCurrentAttribute);
+}
+
+IAttribute* ComplexElement::getCurrentAttribute()
+{
+ //already at the end?
+ if ( m_viCurrentAttribute == m_attributes.end())
+ return NULL;
+ else
+ return ((IAttribute*)*m_viCurrentAttribute);
+}
+