You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2005/10/24 06:29:44 UTC
svn commit: r327958 - in /webservices/axis2/trunk/c: include/axis2_om_node.h
modules/xml/om/src/axis2_om_node.c
Author: samisa
Date: Sun Oct 23 21:29:32 2005
New Revision: 327958
URL: http://svn.apache.org/viewcvs?rev=327958&view=rev
Log:
Added doc comments and also eliminated warnings
Modified:
webservices/axis2/trunk/c/include/axis2_om_node.h
webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_node.c
Modified: webservices/axis2/trunk/c/include/axis2_om_node.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_om_node.h?rev=327958&r1=327957&r2=327958&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_om_node.h (original)
+++ webservices/axis2/trunk/c/include/axis2_om_node.h Sun Oct 23 21:29:32 2005
@@ -45,135 +45,147 @@
* @{
*/
-/**
- * Types used in OM
- */
+ /**
+ * @brief OM types
+ */
typedef enum axis2_om_types_t
{
+ /** Invalid node type */
AXIS2_OM_INVALID = 0,
+ /** OM document type */
AXIS2_OM_DOCUMENT,
+ /** OM element type */
AXIS2_OM_ELEMENT,
+ /** OM doctype type */
AXIS2_OM_DOCTYPE,
+ /** OM comment type */
AXIS2_OM_COMMENT,
+ /** OM attribute type */
AXIS2_OM_ATTRIBUTE,
+ /** OM namespace type */
AXIS2_OM_NAMESPACE,
+ /** OM processing instruction type */
AXIS2_OM_PROCESSING_INSTRUCTION,
+ /** OM text type */
AXIS2_OM_TEXT
} axis2_om_types_t;
-
/**
* @brief OM Node operations struct
- * Encapsulator struct for operations of axis2_om_node_t
+ * Encapsulator struct for operations of axis2_om_node
*/
-
typedef struct axis2_om_node_ops
{
- /**
- * Free an om node and its all children
- * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
- * @return status code
- */
- axis2_status_t (*axis2_om_node_ops_free) (axis2_environment_t *
+ /**
+ * Frees an om node and all of its children
+ * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
+ * @param om_node node to be freed.
+ * @return satus of the operation. AXIS2_SUCCESS on success else AXIS2_FAILURE
+ */
+ AXIS2_DECLARE_DATA axis2_status_t (AXIS2_CALL *axis2_om_node_ops_free) (axis2_environment_t *
environment,
struct axis2_om_node *
om_node);
- /**
- * Add child node as child to parent
- * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
- * @param parent
- * @param child
- * @return status code
- */
- axis2_status_t (*axis2_om_node_ops_add_child) (axis2_environment_t *
+ /**
+ * Adds given node as child to parent
+ * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
+ * @param parent parent node. Mandatory, cannot be NULL.
+ * @param child child node. Mandatory, cannot be NULL.
+ * @return satus of the operation. AXIS2_SUCCESS on success else AXIS2_FAILURE
+ */
+ AXIS2_DECLARE_DATA axis2_status_t (AXIS2_CALL *axis2_om_node_ops_add_child) (axis2_environment_t *
environment,
struct axis2_om_node *
parent,
struct axis2_om_node *
child);
- /**
- * detach this node from the node and reset the links
- * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
- * @return a pointer to detached node
- */
- struct axis2_om_node *(*axis2_om_node_ops_detach) (axis2_environment_t
+ /**
+ * Detaches given node from the parent and reset the links
+ * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
+ * @param om_node node to be detached. Mandatory, cannot be NULL.
+ * @return a pointer to detached node, NULL on error.
+ */
+ AXIS2_DECLARE_DATA struct axis2_om_node *(AXIS2_CALL *axis2_om_node_ops_detach) (axis2_environment_t
* environment,
struct
axis2_om_node *
om_node);
- /**
- * Inserts a sibling node after the current node
- * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
- * @param current_node
- * @param node_to_insert the node that will be inserted
- * @return return status code
- */
- axis2_status_t (*axis2_om_node_ops_insert_sibling_after)
+ /**
+ * Inserts a sibling node after the given current node
+ * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
+ * @param current_node node to whom the sibling to be inserted. Mandatory, cannot be NULL.
+ * @param node_to_insert the node to be inserted. Mandatory, cannot be NULL.
+ * @return satus of the operation. AXIS2_SUCCESS on success else AXIS2_FAILURE
+ */
+ AXIS2_DECLARE_DATA axis2_status_t (AXIS2_CALL *axis2_om_node_ops_insert_sibling_after)
(axis2_environment_t * environment,
struct axis2_om_node * current_node,
struct axis2_om_node * node_to_insert);
- /**
- * Inserts a sibling node after the current node
- * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
- * @param current_node
- * @param node_to_insert the node that will be inserted
- * @return status code
- */
-
- axis2_status_t (*axis2_om_node_ops_insert_sibling_before)
+ /**
+ * Inserts a sibling node before the given current node
+ * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
+ * @param current_node node to whom the sibling to be inserted. Mandatory, cannot be NULL.
+ * @param node_to_insert the node to be inserted. Mandatory, cannot be NULL.
+ * @return satus of the operation. AXIS2_SUCCESS on success else AXIS2_FAILURE
+ */
+ AXIS2_DECLARE_DATA axis2_status_t (AXIS2_CALL *axis2_om_node_ops_insert_sibling_before)
(axis2_environment_t * environment,
struct axis2_om_node * current_node,
struct axis2_om_node * node_to_insert);
- /**
- * set a parent node to a given node
- * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
- * @param child_node
- * @param parent the node that will be set as parent
- * @return status code
- */
-
- axis2_status_t (*axis2_om_node_ops_set_parent) (axis2_environment_t
+ /**
+ * Sets a parent node to a given node
+ * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
+ * @param child_node child node to whom a parent to be added. Mandatory, cannot be NULL.
+ * @param parent the node that will be set as parent. Mandatory, cannot be NULL.
+ * @return satus of the operation. AXIS2_SUCCESS on success else AXIS2_FAILURE
+ */
+ AXIS2_DECLARE_DATA axis2_status_t (AXIS2_CALL *axis2_om_node_ops_set_parent) (axis2_environment_t
* environment,
struct axis2_om_node
* child_node,
struct axis2_om_node
* parent_node);
- /** get the first child of a node
- * returns the first child node of this node
- * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
- * @param
- * @return returns a pointer to first child if there is no child returns null
- */
- struct axis2_om_node
- *(*axis2_om_node_ops_get_first_child) (axis2_environment_t *
+ /**
+ * gets the first child of a given node
+ * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
+ * @param parent_node node whose first child is to be returnd.
+ * @return a pointer to first child if there is one, else returns NULL.
+ * On error sets the error and returns NULL
+ */
+ AXIS2_DECLARE_DATA struct axis2_om_node
+ *(AXIS2_CALL *axis2_om_node_ops_get_first_child) (axis2_environment_t *
environment,
struct axis2_om_node *
parent_node);
- /**
- * get the next child of this node
- * This function should only be called after a call to get_first_child function
- * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
- * @param parent_node
- * @return pointer to next child , if there isn't next child returns null
- */
- struct axis2_om_node
- *(*axis2_om_node_ops_get_next_child) (axis2_environment_t *
+
+ /**
+ * Gets the next child of the given node.
+ * This function should only be called after a call to get_first_child function
+ * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
+ * @param parent_node node whose next child is to be returned.
+ * @return a pointer to next child if there is one, else returns NULL.
+ * On error sets the error and returns NULL
+ */
+ AXIS2_DECLARE_DATA struct axis2_om_node
+ *(AXIS2_CALL *axis2_om_node_ops_get_next_child) (axis2_environment_t *
environment,
struct axis2_om_node *
parent_node);
- /**
- * serialize operation of node
- * @param environment Environment .MUST NOT be NULL, if NULL behaviour is undefined.
- * @returns status code
- */
-
- axis2_status_t (*axis2_om_node_ops_serialize) (axis2_environment_t *
+ /**
+ * Serializes the given node. This operation makes the node go through its children and
+ * serialize them in order.
+ * @param environment Environment .MUST NOT be NULL, if NULL behaviour is undefined.
+ * @param node node to be serialized. Mandatory cannot be NULL.
+ * @param om_output OM output handler to be used in serializing
+ * @return satus of the operation. AXIS2_SUCCESS on success else AXIS2_FAILURE
+ */
+ AXIS2_DECLARE_DATA axis2_status_t (AXIS2_CALL *axis2_om_node_ops_serialize) (axis2_environment_t *
environment,
struct axis2_om_node
* om_node,
@@ -199,43 +211,54 @@
typedef struct axis2_om_node
{
- /** operations of this struct */
+ /** operations of node struct */
axis2_om_node_ops_t *ops;
- /** links that maintain the tree */
+ /* links that maintain the tree */
+ /** parent node */
struct axis2_om_node *parent;
+ /** previous sibling */
struct axis2_om_node *prev_sibling;
+ /** next sibling */
struct axis2_om_node *next_sibling;
+ /** first child */
struct axis2_om_node *first_child;
+ /** current child */
struct axis2_om_node *current_child;
+ /** last child */
struct axis2_om_node *last_child;
-
- /** indicate the type stored in data_element */
+ /** node type, indicates the type stored in data_element */
axis2_om_types_t node_type;
- /** done true means that this node is completely built , false otherwise */
+ /** done true means that this node is completely built , false otherwise */
int done;
-
- /** instances of om struct types will be stored here */
+ /** instances of an om struct, whose type is defined by node type */
void *data_element;
} axis2_om_node_t;
-/**
- * Create a node struct.
- * @param environment Environment .MUST NOT be NULL, if NULL behaviour is undefined.
- * @return a pointer to node struct instance null otherwise
- */
-
- axis2_om_node_t *axis2_om_node_create (axis2_environment_t * environment);
+ /**
+ * Creates a node struct.
+ * @param environment Environment. MUST NOT be NULL, if NULL behaviour is undefined.
+ * @return a pointer to newly created node struct. NULL on error.
+ */
+ AXIS2_DECLARE(axis2_om_node_t *) axis2_om_node_create (axis2_environment_t * environment);
+/** frees given node */
#define axis2_om_node_free(environment,om_node) ((om_node)->ops->axis2_om_node_ops_free(environment,om_node))
+/** adds given child to the given parent */
#define axis2_om_node_add_child(environment,parent,child) ((parent)->ops->axis2_om_node_ops_add_child(environment,parent,child))
+/** detaches the given node from its parent */
#define axis2_om_node_detach(environment,om_node) ((om_node)->ops->axis2_om_node_ops_detach(environment,om_node))
+/** inserts a sibling after the given node */
#define axis2_om_node_insert_sibling_after(environment,current_node,node_to_insert) \
((current_node)->ops->axis2_om_node_ops_insert_sibling_after(environment,current_node,node_to_insert))
-
+/** inserts a sibling before the given node */
#define axis2_om_node_insert_sibling_before(environment,current_node,node_to_insert) ((current_node)->ops->axis2_om_node_ops_insert_sibling_before(environment,current_node,node_to_insert))
+/** sets the parent of the given node */
#define axis2_om_node_set_parent(environment,child_node,parent_node) ((child_node)->ops->axis2_om_node_ops_set_parent(environment, child_node,parent_node))
+/** gets the first child of the given node */
#define axis2_om_node_get_first_child(environment, om_node) ((om_node)->ops->axis2_om_node_ops_get_first_child(environment, om_node))
+/** gets the next child of the given node */
#define axis2_om_node_get_next_child(environment, om_node) ((om_node)->ops->axis2_om_node_ops_get_next_child(environment, om_node))
+/** serializes the given node */
#define axis2_om_node_serialize(environment, om_node, om_output) ((om_node)->ops->axis2_om_node_ops_serialize(environment, om_node, om_output))
/** @} */
@@ -243,6 +266,5 @@
#ifdef __cplusplus
}
#endif
-
#endif /* AXIS2_OM_NODE_H */
Modified: webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_node.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_node.c?rev=327958&r1=327957&r2=327958&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_node.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/axis2_om_node.c Sun Oct 23 21:29:32 2005
@@ -18,39 +18,39 @@
#include <axis2_om_element.h>
#include <axis2_om_text.h>
-axis2_status_t axis2_om_node_impl_free (axis2_environment_t * environment,
+axis2_status_t AXIS2_CALL axis2_om_node_impl_free (axis2_environment_t * environment,
axis2_om_node_t * node);
-axis2_status_t axis2_om_node_impl_add_child (axis2_environment_t *
+axis2_status_t AXIS2_CALL axis2_om_node_impl_add_child (axis2_environment_t *
environment,
axis2_om_node_t * parent,
axis2_om_node_t * child);
-axis2_om_node_t *axis2_om_node_impl_detach (axis2_environment_t * environment,
+axis2_om_node_t * AXIS2_CALL axis2_om_node_impl_detach (axis2_environment_t * environment,
axis2_om_node_t * node_to_detach);
-axis2_status_t axis2_om_node_impl_set_parent (axis2_environment_t *
+axis2_status_t AXIS2_CALL axis2_om_node_impl_set_parent (axis2_environment_t *
environment,
axis2_om_node_t * node,
axis2_om_node_t * parent);
-axis2_status_t axis2_om_node_impl_insert_sibling_after (axis2_environment_t *
+axis2_status_t AXIS2_CALL axis2_om_node_impl_insert_sibling_after (axis2_environment_t *
environment,
axis2_om_node_t *
node,
axis2_om_node_t *
node_to_insert);
-axis2_status_t axis2_om_node_impl_insert_sibling_before (axis2_environment_t *
+axis2_status_t AXIS2_CALL axis2_om_node_impl_insert_sibling_before (axis2_environment_t *
environment,
axis2_om_node_t *
node,
axis2_om_node_t *
node_to_insert);
-axis2_om_node_t *axis2_om_node_impl_get_first_child (axis2_environment_t *
+axis2_om_node_t * AXIS2_CALL axis2_om_node_impl_get_first_child (axis2_environment_t *
environment,
axis2_om_node_t *
parent_node);
-axis2_om_node_t *axis2_om_node_impl_get_next_child (axis2_environment_t *
+axis2_om_node_t * AXIS2_CALL axis2_om_node_impl_get_next_child (axis2_environment_t *
environment,
axis2_om_node_t *
parent_node);
-axis2_status_t axis2_om_node_impl_serialize (axis2_environment_t *
+axis2_status_t AXIS2_CALL axis2_om_node_impl_serialize (axis2_environment_t *
environment,
axis2_om_node_t * om_node,
axis2_om_output_t * om_output);
@@ -377,6 +377,20 @@
data_element, om_output);
return status;
break;
+ case AXIS2_OM_INVALID:
+ break;
+ case AXIS2_OM_DOCUMENT:
+ break;
+ case AXIS2_OM_DOCTYPE:
+ break;
+ case AXIS2_OM_COMMENT:
+ break;
+ case AXIS2_OM_ATTRIBUTE:
+ break;
+ case AXIS2_OM_NAMESPACE:
+ break;
+ case AXIS2_OM_PROCESSING_INSTRUCTION:
+ break;
}
@@ -400,6 +414,22 @@
om_output);
if (status != AXIS2_SUCCESS)
return status;
+ break;
+ case AXIS2_OM_TEXT:
+ break;
+ case AXIS2_OM_INVALID:
+ break;
+ case AXIS2_OM_DOCUMENT:
+ break;
+ case AXIS2_OM_DOCTYPE:
+ break;
+ case AXIS2_OM_COMMENT:
+ break;
+ case AXIS2_OM_ATTRIBUTE:
+ break;
+ case AXIS2_OM_NAMESPACE:
+ break;
+ case AXIS2_OM_PROCESSING_INSTRUCTION:
break;
}