axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r495494 [8/8] - in /webservices/axis2/trunk/c/axiom: include/ src/om/
Date Fri, 12 Jan 2007 06:11:44 GMT
Modified: webservices/axis2/trunk/c/axiom/src/om/om_text.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/om/om_text.c?view=diff&rev=495494&r1=495493&r2=495494
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/om/om_text.c (original)
+++ webservices/axis2/trunk/c/axiom/src/om/om_text.c Thu Jan 11 22:11:41 2007
@@ -38,11 +38,8 @@
         const axis2_env_t *env,
         axiom_output_t *om_output);
 
-/********************* axiom_text_impl_struct ***************/
-
-typedef struct axiom_text_impl_t
+struct axiom_text
 {
-    axiom_text_t om_text;
     /** Text value */
     axis2_char_t *value;
     /** The following fields are for MTOM */
@@ -54,20 +51,8 @@
     axiom_attribute_t *om_attribute;
     axiom_namespace_t *ns;
     axiom_data_handler_t *data_handler;
-}
-axiom_text_impl_t;
-
-static const axiom_text_ops_t axiom_text_ops_var = {
-    0
 };
 
-/*********************** Macro ***********************************/
-
-#define AXIS2_INTF_TO_IMPL(text) ((axiom_text_impl_t*)text)
-
-/*****************************************************************/
-
-
 AXIS2_EXTERN axiom_text_t* AXIS2_CALL
 axiom_text_create(const axis2_env_t *env,
         axiom_node_t * parent,
@@ -75,7 +60,7 @@
         axiom_node_t **node)
 {
 
-    axiom_text_impl_t *om_text = NULL;
+    axiom_text_t *om_text = NULL;
     AXIS2_ENV_CHECK(env, NULL);
     AXIS2_PARAM_CHECK(env->error, node, NULL);
 
@@ -86,8 +71,8 @@
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
-    om_text = (axiom_text_impl_t *) AXIS2_MALLOC(env->allocator,
-            sizeof(axiom_text_impl_t));
+    om_text = (axiom_text_t *) AXIS2_MALLOC(env->allocator,
+            sizeof(axiom_text_t));
     if (!om_text)
     {
         AXIS2_FREE(env->allocator, *node);
@@ -120,10 +105,7 @@
         AXIOM_NODE_ADD_CHILD(parent, env, (*node));
     }
 
-    /* ops */
-    om_text->om_text.ops = &axiom_text_ops_var;
-
-    return &(om_text->om_text);
+    return om_text;
 }
 
 AXIS2_EXTERN axiom_text_t* AXIS2_CALL
@@ -133,58 +115,56 @@
         axiom_node_t **node)
 {
 
-    axiom_text_impl_t *om_text_impl = NULL;
+    axiom_text_t *om_text = NULL;
     AXIS2_ENV_CHECK(env, NULL);
     AXIS2_PARAM_CHECK(env->error, data_handler, NULL);
 
-    om_text_impl = (axiom_text_impl_t*)axiom_text_create(env, parent, NULL, node);
-    if (!om_text_impl)
+    om_text = (axiom_text_t*)axiom_text_create(env, parent, NULL, node);
+    if (!om_text)
         return NULL;
-    om_text_impl->optimize = AXIS2_TRUE;
-    om_text_impl->is_binary = AXIS2_TRUE;
-    om_text_impl->data_handler = data_handler;
-    return &(om_text_impl->om_text);
+    om_text->optimize = AXIS2_TRUE;
+    om_text->is_binary = AXIS2_TRUE;
+    om_text->data_handler = data_handler;
+    return om_text;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axiom_text_free(axiom_text_t * om_text,
         const axis2_env_t *env)
 {
-    axiom_text_impl_t *text_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-    text_impl = AXIS2_INTF_TO_IMPL(om_text);
-    if (text_impl->value)
+    if (om_text->value)
     {
-        AXIS2_FREE(env->allocator, text_impl->value);
-        text_impl->value = NULL;
+        AXIS2_FREE(env->allocator, om_text->value);
+        om_text->value = NULL;
     }
 
-    if (text_impl->ns)
+    if (om_text->ns)
     {
-        AXIOM_NAMESPACE_FREE(text_impl->ns, env);
-        text_impl->ns = NULL;
+        AXIOM_NAMESPACE_FREE(om_text->ns, env);
+        om_text->ns = NULL;
     }
 
-    if (text_impl->content_id)
+    if (om_text->content_id)
     {
-        AXIS2_FREE(env->allocator, text_impl->content_id);
-        text_impl->content_id = NULL;
+        AXIS2_FREE(env->allocator, om_text->content_id);
+        om_text->content_id = NULL;
     }
 
-    if (text_impl->om_attribute)
+    if (om_text->om_attribute)
     {
-        AXIOM_ATTRIBUTE_FREE(text_impl->om_attribute, env);
-        text_impl->om_attribute = NULL;
+        AXIOM_ATTRIBUTE_FREE(om_text->om_attribute, env);
+        om_text->om_attribute = NULL;
     }
 
-    if (text_impl->data_handler)
+    if (om_text->data_handler)
     {
-        AXIOM_DATA_HANDLER_FREE(text_impl->data_handler, env);
-        text_impl->data_handler = NULL;
+        AXIOM_DATA_HANDLER_FREE(om_text->data_handler, env);
+        om_text->data_handler = NULL;
     }
 
-    AXIS2_FREE(env->allocator, text_impl);
+    AXIS2_FREE(env->allocator, om_text);
     return AXIS2_SUCCESS;
 }
 
@@ -194,44 +174,42 @@
         axiom_output_t *om_output)
 {
     int status = AXIS2_SUCCESS;
-    axiom_text_impl_t *om_text_impl = NULL;
     axis2_char_t *attribute_value = NULL;
     axis2_char_t *text = NULL;
     axiom_xml_writer_t *om_output_xml_writer = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, om_output, AXIS2_FAILURE);
-    om_text_impl = AXIS2_INTF_TO_IMPL(om_text);
 
     if (!axiom_text_get_is_binary(om_text, env))
     {
-        if (AXIS2_INTF_TO_IMPL(om_text)->value)
+        if (om_text->value)
             status = axiom_output_write(om_output, env,
                     AXIOM_TEXT, 1,
-                    AXIS2_INTF_TO_IMPL(om_text)->value);
+                    om_text->value);
     }
     else
     {
         om_output_xml_writer = AXIOM_OUTPUT_GET_XML_WRITER(om_output, env);
-        if (om_text_impl->optimize)
+        if (om_text->optimize)
         {
             if (axiom_text_get_content_id(om_text, env) == NULL)
             {
                 axis2_char_t *content_id = AXIOM_OUTPUT_GET_NEXT_CONTENT_ID(om_output, env);
                 if (content_id)
-                    om_text_impl->content_id = AXIS2_STRDUP(content_id, env);
+                    om_text->content_id = AXIS2_STRDUP(content_id, env);
             }
 
-            attribute_value = AXIS2_STRACAT("cid:", om_text_impl->content_id, env);
+            attribute_value = AXIS2_STRACAT("cid:", om_text->content_id, env);
 
             /*send binary as MTOM optimised*/
-            if (om_text_impl->om_attribute)
+            if (om_text->om_attribute)
             {
-                AXIOM_ATTRIBUTE_FREE(om_text_impl->om_attribute, env);
-                om_text_impl->om_attribute = NULL;
+                AXIOM_ATTRIBUTE_FREE(om_text->om_attribute, env);
+                om_text->om_attribute = NULL;
             }
 
-            om_text_impl->om_attribute = axiom_attribute_create(env, "href", attribute_value,
NULL);
+            om_text->om_attribute = axiom_attribute_create(env, "href", attribute_value,
NULL);
 
             AXIS2_FREE(env->allocator, attribute_value);
             attribute_value = NULL;
@@ -256,7 +234,7 @@
         const axis2_env_t *env)
 {
     AXIS2_ENV_CHECK(env, NULL);
-    return AXIS2_INTF_TO_IMPL(om_text)->value;
+    return om_text->value;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -264,20 +242,17 @@
         const axis2_env_t *env,
         const axis2_char_t *value)
 {
-    axiom_text_impl_t *text_impl = NULL;
-
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error , om_text, AXIS2_FAILURE);
 
-    text_impl = AXIS2_INTF_TO_IMPL(om_text);
-    if (text_impl->value)
+    if (om_text->value)
     {
-        AXIS2_FREE(env->allocator, text_impl->value);
-        text_impl->value = NULL;
+        AXIS2_FREE(env->allocator, om_text->value);
+        om_text->value = NULL;
     }
 
-    text_impl->value = (axis2_char_t*)AXIS2_STRDUP(value, env);
-    if (!text_impl->value)
+    om_text->value = (axis2_char_t*)AXIS2_STRDUP(value, env);
+    if (!om_text->value)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
                 AXIS2_FAILURE);
@@ -294,7 +269,7 @@
         const axis2_env_t *env)
 {
     AXIS2_ENV_CHECK(env, NULL);
-    return AXIS2_INTF_TO_IMPL(om_text)->mime_type;
+    return om_text->mime_type;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -304,9 +279,9 @@
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error , om_text, AXIS2_FAILURE);
-    if (AXIS2_INTF_TO_IMPL(om_text)->mime_type)
-        AXIS2_FREE(env->allocator, AXIS2_INTF_TO_IMPL(om_text)->mime_type);
-    AXIS2_INTF_TO_IMPL(om_text)->mime_type = (axis2_char_t*)AXIS2_STRDUP(mime_type, env);
+    if (om_text->mime_type)
+        AXIS2_FREE(env->allocator, om_text->mime_type);
+    om_text->mime_type = (axis2_char_t*)AXIS2_STRDUP(mime_type, env);
     return AXIS2_SUCCESS;
 }
 
@@ -316,7 +291,7 @@
         const axis2_env_t *env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    return AXIS2_INTF_TO_IMPL(om_text)->optimize;
+    return om_text->optimize;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -326,7 +301,7 @@
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error , om_text, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(om_text)->optimize = optimize;
+    om_text->optimize = optimize;
     return AXIS2_SUCCESS;
 }
 
@@ -336,7 +311,7 @@
         const axis2_env_t *env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    return AXIS2_INTF_TO_IMPL(om_text)->is_binary;
+    return om_text->is_binary;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -346,7 +321,7 @@
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error , om_text, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(om_text)->is_binary = is_binary;
+    om_text->is_binary = is_binary;
     return AXIS2_SUCCESS;
 }
 
@@ -355,7 +330,7 @@
         const axis2_env_t *env)
 {
     AXIS2_ENV_CHECK(env, NULL);
-    return AXIS2_INTF_TO_IMPL(om_text)->localname;
+    return om_text->localname;
 }
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
@@ -363,7 +338,7 @@
         const axis2_env_t *env)
 {
     AXIS2_ENV_CHECK(env, NULL);
-    return AXIS2_INTF_TO_IMPL(om_text)->content_id;
+    return om_text->content_id;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -373,9 +348,9 @@
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error , om_text, AXIS2_FAILURE);
-    if (AXIS2_INTF_TO_IMPL(om_text)->content_id)
-        AXIS2_FREE(env->allocator, AXIS2_INTF_TO_IMPL(om_text)->content_id);
-    AXIS2_INTF_TO_IMPL(om_text)->content_id = (axis2_char_t*)AXIS2_STRDUP(content_id,
env);
+    if (om_text->content_id)
+        AXIS2_FREE(env->allocator, om_text->content_id);
+    om_text->content_id = (axis2_char_t*)AXIS2_STRDUP(content_id, env);
     return AXIS2_SUCCESS;
 }
 
@@ -384,22 +359,20 @@
         const axis2_env_t *env,
         axiom_output_t *om_output)
 {
-    axiom_text_impl_t *om_text_impl = NULL;
     axis2_char_t *namespace_uri = NULL;
     axis2_char_t *prefix = NULL;
     const axis2_char_t *local_name = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    om_text_impl = AXIS2_INTF_TO_IMPL(om_text);
     local_name = axiom_text_get_localname(om_text, env);
 
-    om_text_impl->ns = axiom_namespace_create(env, "http://www.w3.org/2004/08/xop/include",
"xop");
+    om_text->ns = axiom_namespace_create(env, "http://www.w3.org/2004/08/xop/include",
"xop");
 
-    if (om_text_impl->ns)
+    if (om_text->ns)
     {
-        namespace_uri = AXIOM_NAMESPACE_GET_URI(om_text_impl->ns, env);
+        namespace_uri = AXIOM_NAMESPACE_GET_URI(om_text->ns, env);
         if (namespace_uri)
         {
-            prefix = AXIOM_NAMESPACE_GET_PREFIX(om_text_impl->ns, env);
+            prefix = AXIOM_NAMESPACE_GET_PREFIX(om_text->ns, env);
 
             if (prefix)
             {
@@ -423,10 +396,10 @@
         axiom_output_write(om_output, env, AXIOM_TEXT, 1,
                 local_name);
     }
-    if (om_text_impl->om_attribute)
-        AXIOM_ATTRIBUTE_SERIALIZE(om_text_impl->om_attribute, env, om_output);
-    if (om_text_impl->ns)
-        AXIOM_NAMESPACE_SERIALIZE(om_text_impl->ns, env, om_output);
+    if (om_text->om_attribute)
+        AXIOM_ATTRIBUTE_SERIALIZE(om_text->om_attribute, env, om_output);
+    if (om_text->ns)
+        AXIOM_NAMESPACE_SERIALIZE(om_text->ns, env, om_output);
 
     return AXIS2_SUCCESS;
 }
@@ -440,7 +413,6 @@
     axiom_xml_writer_t *xml_writer = NULL;
     axiom_namespace_t *om_namespace = NULL;
 
-    axiom_text_impl_t *om_text_impl = NULL;
     axis2_char_t *namespace_uri = NULL;
     axis2_char_t *prefix = NULL;
     axis2_char_t *attribute_local_name = NULL;
@@ -451,15 +423,14 @@
     xml_writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
             AXIS2_XML_PARSER_TYPE_BUFFER);
     om_namespace = axiom_namespace_create(env, "" , "");
-    om_text_impl = AXIS2_INTF_TO_IMPL(om_text);
 
-    namespace_uri = AXIOM_NAMESPACE_GET_URI(om_text_impl->ns, env);
+    namespace_uri = AXIOM_NAMESPACE_GET_URI(om_text->ns, env);
     attribute_local_name = AXIOM_ATTRIBUTE_GET_LOCALNAME(om_attribute, env);
 
 
     if (om_namespace)
     {
-        prefix = AXIOM_NAMESPACE_GET_PREFIX(om_text_impl->ns, env);
+        prefix = AXIOM_NAMESPACE_GET_PREFIX(om_text->ns, env);
         attribute_value = AXIOM_ATTRIBUTE_GET_VALUE(om_attribute, env);
         if (prefix)
         {
@@ -485,7 +456,6 @@
         axiom_output_t *om_output)
 {
     axiom_xml_writer_t *xml_writer = NULL;
-    axiom_text_impl_t *om_text_impl = NULL;
     axis2_char_t *namespace_uri = NULL;
     axis2_char_t *namespace_prefix = NULL;
 
@@ -494,12 +464,11 @@
     xml_writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
             AXIS2_XML_PARSER_TYPE_BUFFER);
     om_namespace = axiom_namespace_create(env, "" , "");
-    om_text_impl = AXIS2_INTF_TO_IMPL(om_text);
 
     if (om_namespace)
     {
-        namespace_uri = AXIOM_NAMESPACE_GET_URI(om_text_impl->ns, env);
-        namespace_prefix = AXIOM_NAMESPACE_GET_PREFIX(om_text_impl->ns, env);
+        namespace_uri = AXIOM_NAMESPACE_GET_URI(om_text->ns, env);
+        namespace_prefix = AXIOM_NAMESPACE_GET_PREFIX(om_text->ns, env);
         AXIOM_XML_WRITER_WRITE_NAMESPACE(xml_writer, env, namespace_prefix, namespace_uri);
         AXIOM_XML_WRITER_SET_PREFIX(xml_writer, env, namespace_prefix, namespace_uri);
     }
@@ -510,23 +479,21 @@
 axiom_text_get_text(axiom_text_t *om_text,
         const axis2_env_t *env)
 {
-    axiom_text_impl_t *om_text_impl = NULL;
     AXIS2_ENV_CHECK(env, NULL);
 
-    om_text_impl = AXIS2_INTF_TO_IMPL(om_text);
-    if (om_text_impl->value)
+    if (om_text->value)
     {
-        return om_text_impl->value;
+        return om_text->value;
     }
     else
     {
         axis2_char_t *data_handler_stream = NULL;
         int data_handler_stream_size = 0;
-        if (om_text_impl->data_handler)
+        if (om_text->data_handler)
         {
             int encoded_len = 0;
             axis2_char_t *encoded_str = NULL;
-            AXIOM_DATA_HANDLER_READ_FROM(om_text_impl->data_handler, env,
+            AXIOM_DATA_HANDLER_READ_FROM(om_text->data_handler, env,
                     &data_handler_stream, &data_handler_stream_size);
             if (data_handler_stream)
             {
@@ -542,7 +509,7 @@
             }
         }
     }
-    return om_text_impl->value;
+    return om_text->value;
 }
 
 AXIS2_EXTERN axiom_data_handler_t *AXIS2_CALL
@@ -550,5 +517,5 @@
         const axis2_env_t *env)
 {
     AXIS2_ENV_CHECK(env, NULL);
-    return AXIS2_INTF_TO_IMPL(om_text)->data_handler;
+    return om_text->data_handler;
 }



---------------------------------------------------------------------
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