axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r523959 - in /webservices/axis2/trunk/c/axiom: include/axiom_children_with_specific_attribute_iterator.h src/om/om_children_with_specific_attribute_iterator.c
Date Fri, 30 Mar 2007 06:36:05 GMT
Author: samisa
Date: Thu Mar 29 23:36:05 2007
New Revision: 523959

URL: http://svn.apache.org/viewvc?view=rev&rev=523959
Log:
Removed ops

Modified:
    webservices/axis2/trunk/c/axiom/include/axiom_children_with_specific_attribute_iterator.h
    webservices/axis2/trunk/c/axiom/src/om/om_children_with_specific_attribute_iterator.c

Modified: webservices/axis2/trunk/c/axiom/include/axiom_children_with_specific_attribute_iterator.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/include/axiom_children_with_specific_attribute_iterator.h?view=diff&rev=523959&r1=523958&r2=523959
==============================================================================
--- webservices/axis2/trunk/c/axiom/include/axiom_children_with_specific_attribute_iterator.h
(original)
+++ webservices/axis2/trunk/c/axiom/include/axiom_children_with_specific_attribute_iterator.h
Thu Mar 29 23:36:05 2007
@@ -33,9 +33,6 @@
 {
 #endif
 
-    typedef struct axiom_children_with_specific_attribute_iterator_ops
-                axiom_children_with_specific_attribute_iterator_ops_t;
-
     typedef struct axiom_children_with_specific_attribute_iterator
                 axiom_children_with_specific_attribute_iterator_t;
 
@@ -46,56 +43,40 @@
      */
 
     /**
-     * \brief axiom_children_with_specific_attribute_iterator ops
-     * Encapsulator struct for ops of axiom_iterator
-     */
-    struct axiom_children_with_specific_attribute_iterator_ops
-    {
-        /**
-        * Free function free the om_children_with_specific_attribute_iterator struct
-        */
-        void (AXIS2_CALL *
-                free_fn)(axiom_children_with_specific_attribute_iterator_t *iterator,
-                        const axis2_env_t *env);
-
-        /**
-        * Removes from the underlying collection the last element returned by the
-        * iterator (optional op).  This method can be called only once per
-        * call to <tt>next</tt>.  The behavior of an iterator is unspecified
if
-        * the underlying collection is modified while the iteration is in
-        * progress in any way other than by calling this method.
-        */
-        axis2_status_t(AXIS2_CALL *
-                remove)(axiom_children_with_specific_attribute_iterator_t *iterator,
-                            const axis2_env_t *env);
-
-        /**
-         * Returns true< if the iteration has more elements. (In other
-         * words, returns true if next would return an axiom_node_t struct
-         * rather than NULL with error code set in environment
-         */
-
-        axis2_bool_t(AXIS2_CALL *
-                has_next)(axiom_children_with_specific_attribute_iterator_t *iterator,
-                        const axis2_env_t *env);
-
-        /**
-         * Returns the next element in the iteration. returns null if there is no 
-        * more elements in the iteration
-         */
-        axiom_node_t*(AXIS2_CALL *
-                next)(axiom_children_with_specific_attribute_iterator_t *iterator,
-                        const axis2_env_t *env);
+    * Free function free the om_children_with_specific_attribute_iterator struct
+    */
+    AXIS2_EXTERN void AXIS2_CALL
+    axiom_children_with_specific_attribute_iterator_free(axiom_children_with_specific_attribute_iterator_t
*iterator,
+        const axis2_env_t *env);
+
+    /**
+    * Removes from the underlying collection the last element returned by the
+    * iterator (optional op).  This method can be called only once per
+    * call to <tt>next</tt>.  The behavior of an iterator is unspecified if
+    * the underlying collection is modified while the iteration is in
+    * progress in any way other than by calling this method.
+    */
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axiom_children_with_specific_attribute_iterator_remove(axiom_children_with_specific_attribute_iterator_t
*iterator,
+        const axis2_env_t *env);
 
+    /**
+     * Returns true< if the iteration has more elements. (In other
+     * words, returns true if next would return an axiom_node_t struct
+     * rather than NULL with error code set in environment
+     */
 
+    AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+    axiom_children_with_specific_attribute_iterator_has_next(axiom_children_with_specific_attribute_iterator_t
*iterator,
+        const axis2_env_t *env);
 
-    };
-
-
-    struct axiom_children_with_specific_attribute_iterator
-    {
-        axiom_children_with_specific_attribute_iterator_ops_t *ops;
-    };
+    /**
+     * Returns the next element in the iteration. returns null if there is no 
+    * more elements in the iteration
+     */
+    AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+    axiom_children_with_specific_attribute_iterator_next(axiom_children_with_specific_attribute_iterator_t
*iterator,
+        const axis2_env_t *env);
 
     /**
      * @param current child
@@ -112,16 +93,16 @@
         axis2_bool_t detach);
 
 #define AXIOM_CHILDREN_WITH_SPECIFIC_ATTRIBUTE_ITERATOR_FREE(iterator, env) \
-        ((iterator)->ops->free_fn(iterator, env))
+        axiom_children_with_specific_attribute_iterator_free(iterator, env)
 
 #define AXIOM_CHILDREN_WITH_SPECIFIC_ATTRIBUTE_ITERATOR_REMOVE(iterator, env) \
-        ((iterator)->ops->remove(iterator, env))
+        axiom_children_with_specific_attribute_iterator_remove(iterator, env)
 
 #define AXIOM_CHILDREN_WITH_SPECIFIC_ATTRIBUTE_ITERATOR_HAS_NEXT(iterator, env) \
-        ((iterator)->ops->has_next(iterator, env))
+        axiom_children_with_specific_attribute_iterator_has_next(iterator, env)
 
 #define AXIOM_CHILDREN_WITH_SPECIFIC_ATTRIBUTE_ITERATOR_NEXT(iterator, env) \
-        ((iterator)->ops->next(iterator, env))
+        axiom_children_with_specific_attribute_iterator_next(iterator, env)
 
 
     /** @} */

Modified: webservices/axis2/trunk/c/axiom/src/om/om_children_with_specific_attribute_iterator.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/om/om_children_with_specific_attribute_iterator.c?view=diff&rev=523959&r1=523958&r2=523959
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/om/om_children_with_specific_attribute_iterator.c
(original)
+++ webservices/axis2/trunk/c/axiom/src/om/om_children_with_specific_attribute_iterator.c
Thu Mar 29 23:36:05 2007
@@ -19,32 +19,8 @@
 #include <axiom_attribute.h>
 #include <axiom_element.h>
 
-void AXIS2_CALL
-axiom_children_with_specific_attribute_iterator_free(
-    axiom_children_with_specific_attribute_iterator_t *iterator,
-    const axis2_env_t *env);
-
-axis2_status_t AXIS2_CALL
-axiom_children_with_specific_attribute_iterator_remove(
-    axiom_children_with_specific_attribute_iterator_t *iterator,
-    const axis2_env_t *env);
-
-
-axis2_bool_t AXIS2_CALL
-axiom_children_with_specific_attribute_iterator_has_next(
-    axiom_children_with_specific_attribute_iterator_t *iterator,
-    const axis2_env_t *env);
-
-axiom_node_t* AXIS2_CALL
-axiom_children_with_specific_attribute_iterator_next(
-    axiom_children_with_specific_attribute_iterator_t *iterator,
-    const axis2_env_t *env);
-
-/*************** end function prototypes **********************************/
-
-typedef struct axiom_children_with_specific_attribute_iterator_impl_t
+struct axiom_children_with_specific_attribute_iterator
 {
-    axiom_children_with_specific_attribute_iterator_t iterator;
     axiom_node_t *current_child;
     axiom_node_t *last_child;
     axis2_bool_t next_called;
@@ -52,18 +28,9 @@
     axis2_qname_t *attr_qname;
     axis2_char_t *attr_value;
     axis2_bool_t detach;
-}
-axiom_children_with_specific_attribute_iterator_impl_t;
-
-/***************** end impl struct ****************************************/
+};
 
-#define AXIS2_INTF_TO_IMPL(iterator) \
-        ((axiom_children_with_specific_attribute_iterator_impl_t *)iterator)
-
-/**************** end macro ***********************************************/
-
-
-AXIS2_EXTERN  axiom_children_with_specific_attribute_iterator_t * AXIS2_CALL
+AXIS2_EXTERN axiom_children_with_specific_attribute_iterator_t * AXIS2_CALL
 axiom_children_with_specific_attribute_iterator_create(
     const axis2_env_t *env,
     axiom_node_t *current_child,
@@ -71,107 +38,74 @@
     axis2_char_t *attr_value,
     axis2_bool_t detach)
 {
-    axiom_children_with_specific_attribute_iterator_impl_t *iterator_impl = NULL;
+    axiom_children_with_specific_attribute_iterator_t *iterator = NULL;
 
     AXIS2_PARAM_CHECK(env->error, current_child, NULL);
     AXIS2_PARAM_CHECK(env->error, attr_qname, NULL);
     AXIS2_PARAM_CHECK(env->error, attr_value, NULL);
-    iterator_impl = (axiom_children_with_specific_attribute_iterator_impl_t *)
+    iterator = (axiom_children_with_specific_attribute_iterator_t *)
             AXIS2_MALLOC(env->allocator,
-                    sizeof(axiom_children_with_specific_attribute_iterator_impl_t));
+                    sizeof(axiom_children_with_specific_attribute_iterator_t));
 
-    if (!iterator_impl)
+    if (!iterator)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
 
-    iterator_impl->current_child = NULL;
-    iterator_impl->last_child    = NULL;
-
-    iterator_impl->next_called = AXIS2_FALSE;
-    iterator_impl->remove_called = AXIS2_FALSE;
+    iterator->current_child = NULL;
+    iterator->last_child    = NULL;
 
-    iterator_impl->attr_qname = axis2_qname_clone(attr_qname, env);
-    iterator_impl->attr_value = attr_value;
-    iterator_impl->detach = detach;
+    iterator->next_called = AXIS2_FALSE;
+    iterator->remove_called = AXIS2_FALSE;
 
+    iterator->attr_qname = axis2_qname_clone(attr_qname, env);
+    iterator->attr_value = attr_value;
+    iterator->detach = detach;
 
-    iterator_impl->iterator.ops = NULL;
-    iterator_impl->iterator.ops =
-        (axiom_children_with_specific_attribute_iterator_ops_t*)
-        AXIS2_MALLOC(env->allocator,
-                sizeof(axiom_children_with_specific_attribute_iterator_ops_t));
-
-    if (!(iterator_impl->iterator.ops))
-    {
-        AXIOM_CHILDREN_WITH_SPECIFIC_ATTRIBUTE_ITERATOR_FREE(&(iterator_impl->iterator),
env);
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        return NULL;
-    }
-
-    iterator_impl->current_child = current_child;
-    iterator_impl->iterator.ops->free_fn =
-        axiom_children_with_specific_attribute_iterator_free;
-    iterator_impl->iterator.ops->remove =
-        axiom_children_with_specific_attribute_iterator_remove;
-    iterator_impl->iterator.ops->has_next =
-        axiom_children_with_specific_attribute_iterator_has_next;
-    iterator_impl->iterator.ops->next =
-        axiom_children_with_specific_attribute_iterator_next;
-    return &(iterator_impl->iterator);
+    return iterator;
 }
 
 
-void AXIS2_CALL
+AXIS2_EXTERN void AXIS2_CALL
 axiom_children_with_specific_attribute_iterator_free(
     axiom_children_with_specific_attribute_iterator_t *iterator,
     const axis2_env_t *env)
 {
-    axiom_children_with_specific_attribute_iterator_impl_t *qname_iter_impl = NULL;
     AXIS2_ENV_CHECK(env, void);
-    qname_iter_impl = AXIS2_INTF_TO_IMPL(iterator);
-    if (qname_iter_impl->attr_qname)
-    {
-        axis2_qname_free(qname_iter_impl->attr_qname, env);
-        qname_iter_impl->attr_qname = NULL;
-    }
-    if (iterator->ops)
+    if (iterator->attr_qname)
     {
-        AXIS2_FREE(env->allocator, iterator->ops);
-        iterator->ops = NULL;
+        axis2_qname_free(iterator->attr_qname, env);
     }
-    AXIS2_FREE(env->allocator, qname_iter_impl);
+    AXIS2_FREE(env->allocator, iterator);
     return;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axiom_children_with_specific_attribute_iterator_remove(
     axiom_children_with_specific_attribute_iterator_t *iterator,
     const axis2_env_t *env)
 {
-    axiom_children_with_specific_attribute_iterator_impl_t *iterator_impl = NULL;
     axiom_node_t *last_child = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    iterator_impl = AXIS2_INTF_TO_IMPL(iterator);
 
-    if (!(iterator_impl->next_called))
+    if (!(iterator->next_called))
     {
         AXIS2_ERROR_SET(env->error,
                 AXIS2_ERROR_ITERATOR_NEXT_METHOD_HAS_NOT_YET_BEEN_CALLED, AXIS2_FAILURE);
         return AXIS2_FAILURE;
     }
-    if (iterator_impl->remove_called)
+    if (iterator->remove_called)
     {
         AXIS2_ERROR_SET(env->error,
                 AXIS2_ERROR_ITERATOR_REMOVE_HAS_ALREADY_BEING_CALLED, AXIS2_FAILURE);
         return AXIS2_FAILURE;
     }
-    iterator_impl->remove_called = AXIS2_TRUE;
+    iterator->remove_called = AXIS2_TRUE;
 
-    if (!(iterator_impl->last_child))
+    if (!(iterator->last_child))
         return AXIS2_FAILURE;
-    last_child = AXIOM_NODE_DETACH(iterator_impl->last_child, env);
+    last_child = AXIOM_NODE_DETACH(iterator->last_child, env);
     if (last_child)
     {
         AXIOM_NODE_FREE_TREE(last_child, env);
@@ -180,84 +114,79 @@
     return AXIS2_SUCCESS;
 }
 
-axis2_bool_t AXIS2_CALL
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
 axiom_children_with_specific_attribute_iterator_has_next(
     axiom_children_with_specific_attribute_iterator_t *iterator,
     const axis2_env_t *env)
 {
     axis2_bool_t matching_node_found = AXIS2_FALSE;
     axis2_bool_t need_to_move_forward = AXIS2_TRUE;
-
-
-    axiom_children_with_specific_attribute_iterator_impl_t *iterator_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    iterator_impl = AXIS2_INTF_TO_IMPL(iterator);
-    if (!(iterator_impl->current_child))
+
+    if (!(iterator->current_child))
     {
         return AXIS2_FALSE;
     }
     while (need_to_move_forward)
     {
-        if (AXIOM_NODE_GET_NODE_TYPE(iterator_impl->current_child, env)
+        if (AXIOM_NODE_GET_NODE_TYPE(iterator->current_child, env)
                 == AXIOM_ELEMENT)
         {
             axiom_attribute_t *om_attr = NULL;
             axiom_element_t *om_ele = NULL;
             om_ele = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(
-                        iterator_impl->current_child, env);
+                        iterator->current_child, env);
             om_attr = axiom_element_get_attribute(om_ele, env,
-                    iterator_impl->attr_qname);
+                    iterator->attr_qname);
             break;
             if (om_attr &&
                     (axis2_strcmp(axiom_attribute_get_value(om_attr, env),
-                            iterator_impl->attr_value) == 0))
+                            iterator->attr_value) == 0))
             {
                 matching_node_found = AXIS2_TRUE;
                 need_to_move_forward = AXIS2_FALSE;
             }
             else
             {
-                iterator_impl->current_child =
+                iterator->current_child =
                     AXIOM_NODE_GET_NEXT_SIBLING(
-                        iterator_impl->current_child, env);
-                need_to_move_forward = (iterator_impl->current_child != NULL);
+                        iterator->current_child, env);
+                need_to_move_forward = (iterator->current_child != NULL);
 
             }
         }
         else
         {
 
-            iterator_impl->current_child =
+            iterator->current_child =
                 AXIOM_NODE_GET_NEXT_SIBLING(
-                    iterator_impl->current_child, env);
-            need_to_move_forward = (iterator_impl->current_child != NULL);
+                    iterator->current_child, env);
+            need_to_move_forward = (iterator->current_child != NULL);
         }
 
     }
     return matching_node_found;
 }
 
-axiom_node_t* AXIS2_CALL
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
 axiom_children_with_specific_attribute_iterator_next(
     axiom_children_with_specific_attribute_iterator_t *iterator,
     const axis2_env_t *env)
 {
-    axiom_children_with_specific_attribute_iterator_impl_t *iterator_impl = NULL;
     axiom_node_t *last_child = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    iterator_impl = AXIS2_INTF_TO_IMPL(iterator);
 
-    iterator_impl->next_called = AXIS2_TRUE;
-    iterator_impl->remove_called = AXIS2_FALSE;
-    iterator_impl->last_child = iterator_impl->current_child;
-    iterator_impl->current_child = AXIOM_NODE_GET_NEXT_SIBLING(
-                iterator_impl->current_child, env);
-    if (iterator_impl->last_child && iterator_impl->detach
-            && (AXIOM_NODE_GET_PARENT(iterator_impl->last_child, env)))
+    iterator->next_called = AXIS2_TRUE;
+    iterator->remove_called = AXIS2_FALSE;
+    iterator->last_child = iterator->current_child;
+    iterator->current_child = AXIOM_NODE_GET_NEXT_SIBLING(
+                iterator->current_child, env);
+    if (iterator->last_child && iterator->detach
+            && (AXIOM_NODE_GET_PARENT(iterator->last_child, env)))
     {
-        last_child = AXIOM_NODE_DETACH(iterator_impl->last_child, env);
+        last_child = AXIOM_NODE_DETACH(iterator->last_child, env);
         if (last_child)
             AXIOM_NODE_FREE_TREE(last_child, env);
     }
-    return iterator_impl->last_child;
+    return iterator->last_child;
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message