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 na...@apache.org on 2006/03/22 07:13:03 UTC

svn commit: r387749 - in /webservices/axis2/trunk/c: include/axis2_om_attribute.h include/axis2_om_namespace.h modules/xml/om/om_attribute.c modules/xml/om/om_namespace.c

Author: nandika
Date: Tue Mar 21 22:13:00 2006
New Revision: 387749

URL: http://svn.apache.org/viewcvs?rev=387749&view=rev
Log:
clone function added to om_namespace and om_attribute

Modified:
    webservices/axis2/trunk/c/include/axis2_om_attribute.h
    webservices/axis2/trunk/c/include/axis2_om_namespace.h
    webservices/axis2/trunk/c/modules/xml/om/om_attribute.c
    webservices/axis2/trunk/c/modules/xml/om/om_namespace.c

Modified: webservices/axis2/trunk/c/include/axis2_om_attribute.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_om_attribute.h?rev=387749&r1=387748&r2=387749&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_om_attribute.h (original)
+++ webservices/axis2/trunk/c/include/axis2_om_attribute.h Tue Mar 21 22:13:00 2006
@@ -145,6 +145,18 @@
                        axis2_env_t **env,
                        axis2_om_namespace_t *om_namespace);
 
+        /**
+         * clones an om attribute
+         * @param om_attibute 
+         * @param env environment
+         * @returns pointer to cloned om attribute struct on success
+         * NULL otherwise
+         */            
+        struct axis2_om_attribute* (AXIS2_CALL *
+        clone)(struct axis2_om_attribute *om_attribute,
+               axis2_env_t **env);
+
+
     } axis2_om_attribute_ops_t;
 
   /**
@@ -206,6 +218,8 @@
 #define AXIS2_OM_ATTRIBUTE_SET_VALUE(om_attribute, env,value) \
         ((om_attribute)->ops->set_value(om_attribute, env,value))
 
+#define AXIS2_OM_ATTRIBUTE_CLONE(om_attribute, env) \
+        ((om_attribute)->ops->clone(om_attribute, env))
 /** @} */
 
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/include/axis2_om_namespace.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_om_namespace.h?rev=387749&r1=387748&r2=387749&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_om_namespace.h (original)
+++ webservices/axis2/trunk/c/include/axis2_om_namespace.h Tue Mar 21 22:13:00 2006
@@ -98,6 +98,18 @@
                     axis2_env_t **env);
 
 
+        /**
+         * clones an om_namespace struct
+         * @param om_namespace pointer to namespace struct
+         * @param env environment
+         * @returns axis2_om_namespace on success , NULL on error
+         */
+        struct axis2_om_namespace* (AXIS2_CALL *
+        clone)(struct axis2_om_namespace *om_namespace,
+               axis2_env_t **env);
+                                                                                     
+
+
     } axis2_om_namespace_ops_t;
 
   /** 
@@ -140,6 +152,8 @@
 #define AXIS2_OM_NAMESPACE_GET_URI(om_namespace, env) \
         ((om_namespace)->ops->get_uri(om_namespace, env))
 
+#define AXIS2_OM_NAMESPACE_CLONE(om_namespace, env) \
+        ((om_namespace)->ops->clone(om_namespace, env))
 
 /** @} */
 

Modified: webservices/axis2/trunk/c/modules/xml/om/om_attribute.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_attribute.c?rev=387749&r1=387748&r2=387749&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_attribute.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_attribute.c Tue Mar 21 22:13:00 2006
@@ -57,7 +57,12 @@
 axis2_om_attribute_set_namespace(axis2_om_attribute_t *om_attribute,
                                  axis2_env_t **env,
                                  axis2_om_namespace_t *om_namespace);
-                                                                                                                                                                                             
+
+axis2_om_attribute_t* AXIS2_CALL
+axis2_om_attribute_clone(axis2_om_attribute_t *om_attribute,
+                         axis2_env_t **env);
+                         
+
 /*********************************** axis2_om_attribute_impl_t ************************/
 
 typedef struct axis2_om_attribute_impl
@@ -151,7 +156,8 @@
     attribute_impl->om_attribute.ops->set_localname = axis2_om_attribute_set_localname;
     attribute_impl->om_attribute.ops->set_namespace = axis2_om_attribute_set_namespace;
     attribute_impl->om_attribute.ops->set_value = axis2_om_attribute_set_value;
-    
+   
+    attribute_impl->om_attribute.ops->clone = axis2_om_attribute_clone;
     return &(attribute_impl->om_attribute);
 }
 
@@ -338,3 +344,26 @@
     AXIS2_INTF_TO_IMPL(om_attribute)->ns = om_namespace;
     return AXIS2_SUCCESS;
 }
+
+axis2_om_attribute_t* AXIS2_CALL
+axis2_om_attribute_clone(axis2_om_attribute_t *om_attribute,
+                         axis2_env_t **env)
+{
+    axis2_om_attribute_impl_t *attr_impl = NULL;
+    axis2_om_attribute_t *cloned_attr    = NULL;
+    if(!om_attribute) return NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    attr_impl = AXIS2_INTF_TO_IMPL(om_attribute);
+    
+    /** namespace is not cloned since it is a shollow copy*/
+    cloned_attr = axis2_om_attribute_create(env, 
+                            attr_impl->localname,
+                            attr_impl->value,
+                            attr_impl->ns );
+    if(NULL!= cloned_attr)
+    {
+        return cloned_attr;
+    }
+    return NULL;
+}                         

Modified: webservices/axis2/trunk/c/modules/xml/om/om_namespace.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_namespace.c?rev=387749&r1=387748&r2=387749&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_namespace.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_namespace.c Tue Mar 21 22:13:00 2006
@@ -41,7 +41,9 @@
 axis2_om_namespace_get_prefix(axis2_om_namespace_t *om_namespace,
                               axis2_env_t **env);
 
-                                                                                   
+axis2_om_namespace_t* AXIS2_CALL
+axis2_om_namespace_clone(axis2_om_namespace_t *om_namespace,
+                         axis2_env_t **env);
 
 /****************************** axis2_om_namesapce_impl_struct **************************/
 
@@ -129,7 +131,7 @@
     ns->om_namespace.ops->serialize = axis2_om_namespace_serialize;
     ns->om_namespace.ops->get_uri = axis2_om_namespace_get_uri;
     ns->om_namespace.ops->get_prefix = axis2_om_namespace_get_prefix;
-  
+    ns->om_namespace.ops->clone = axis2_om_namespace_clone;
     return &(ns->om_namespace) ;
 }
 
@@ -238,4 +240,23 @@
 {
     AXIS2_ENV_CHECK(env, NULL);
     return AXIS2_INTF_TO_IMPL(om_namespace)->prefix;
-}                              
+}
+
+axis2_om_namespace_t* AXIS2_CALL
+axis2_om_namespace_clone(axis2_om_namespace_t *om_namespace,
+                         axis2_env_t **env)
+{
+    axis2_om_namespace_impl_t *ns_impl = NULL;
+    axis2_om_namespace_t *cloned_ns    = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    ns_impl = AXIS2_INTF_TO_IMPL(om_namespace);
+    
+    cloned_ns = axis2_om_namespace_create(env,
+                      ns_impl->uri, ns_impl->prefix);
+    if(NULL != cloned_ns )
+    {
+        return cloned_ns;
+    }
+    return NULL;
+}