axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r523913 - in /webservices/axis2/trunk/c/axiom/src/attachments: axiom_mime_body_part.h mime_body_part.c
Date Fri, 30 Mar 2007 02:24:33 GMT
Author: samisa
Date: Thu Mar 29 19:24:32 2007
New Revision: 523913

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

Modified:
    webservices/axis2/trunk/c/axiom/src/attachments/axiom_mime_body_part.h
    webservices/axis2/trunk/c/axiom/src/attachments/mime_body_part.c

Modified: webservices/axis2/trunk/c/axiom/src/attachments/axiom_mime_body_part.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/attachments/axiom_mime_body_part.h?view=diff&rev=523913&r1=523912&r2=523913
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/attachments/axiom_mime_body_part.h (original)
+++ webservices/axis2/trunk/c/axiom/src/attachments/axiom_mime_body_part.h Thu Mar 29 19:24:32
2007
@@ -38,7 +38,6 @@
 #endif
 
    
-typedef struct axiom_mime_body_part_ops axiom_mime_body_part_ops_t;
 typedef struct axiom_mime_body_part axiom_mime_body_part_t;   
 
 /** @defgroup axiom_mime_body_part
@@ -46,43 +45,29 @@
   * @{
   */
 
-/** 
- * @brief ops struct
- * Encapsulator struct for ops of axiom_mime_body_part
- */
-struct axiom_mime_body_part_ops
-{
-   axis2_status_t (AXIS2_CALL *
-    add_header)(axiom_mime_body_part_t *mime_body_part, 
-            const axis2_env_t *env, 
-            const axis2_char_t *name, 
-            const axis2_char_t *value); 
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axiom_mime_body_part_add_header(axiom_mime_body_part_t *mime_body_part, 
+        const axis2_env_t *env, 
+        const axis2_char_t *name, 
+        const axis2_char_t *value); 
    
-    axis2_status_t (AXIS2_CALL *
-    set_data_handler)(axiom_mime_body_part_t *mime_body_part, 
-            const axis2_env_t *env, 
-            axiom_data_handler_t *data_handler); 
-
-    axis2_status_t (AXIS2_CALL *
-    write_to)(axiom_mime_body_part_t *mime_body_part, 
-            const axis2_env_t *env,
-            axis2_byte_t **output_stream, 
-            int *output_stream_size); 
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axiom_mime_body_part_set_data_handler(axiom_mime_body_part_t *mime_body_part, 
+        const axis2_env_t *env, 
+        axiom_data_handler_t *data_handler); 
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axiom_mime_body_part_write_to(axiom_mime_body_part_t *mime_body_part, 
+        const axis2_env_t *env,
+        axis2_byte_t **output_stream, 
+        int *output_stream_size); 
 
    /** Deallocate memory
      * @return status code
      */
-    void (AXIS2_CALL *
-    free) (axiom_mime_body_part_t *mime_body_part, 
-            const axis2_env_t *env);
-};
-
-struct axiom_mime_body_part
-{
-   axiom_mime_body_part_ops_t *ops;
-   
-};
-
+    AXIS2_EXTERN void AXIS2_CALL
+    axiom_mime_body_part_free(axiom_mime_body_part_t *mime_body_part, 
+        const axis2_env_t *env);
 /**
  * Creates mime_body_part struct
  * @return pointer to newly created mime_body_part
@@ -90,21 +75,17 @@
 AXIS2_EXTERN axiom_mime_body_part_t * AXIS2_CALL 
 axiom_mime_body_part_create (const axis2_env_t *env);
 
-/*************************** Function macros **********************************/
-
 #define AXIOM_MIME_BODY_PART_FREE(mime_body_part, env) \
-    ((mime_body_part)->ops->free (mime_body_part, env))
+    axiom_mime_body_part_free (mime_body_part, env)
 
 #define AXIOM_MIME_BODY_PART_ADD_HEADER(mime_body_part, env, name, value) \
-    ((mime_body_part)->ops->add_header (mime_body_part, env, name, value))
+    axiom_mime_body_part_add_header (mime_body_part, env, name, value)
 
 #define AXIOM_MIME_BODY_PART_SET_DATA_HANDLER(mime_body_part, env, data_handler) \
-    ((mime_body_part)->ops->set_data_handler (mime_body_part, env, data_handler))
+    axiom_mime_body_part_set_data_handler (mime_body_part, env, data_handler)
 
 #define AXIOM_MIME_BODY_PART_WRITE_TO(mime_body_part, env, output_stream, output_stream_size)
\
-    ((mime_body_part)->ops->write_to (mime_body_part, env, output_stream, output_stream_size))
-
-/*************************** End of function macros ***************************/
+    axiom_mime_body_part_write_to (mime_body_part, env, output_stream, output_stream_size)
 
 /** @} */
 

Modified: webservices/axis2/trunk/c/axiom/src/attachments/mime_body_part.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/attachments/mime_body_part.c?view=diff&rev=523913&r1=523912&r2=523913
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/attachments/mime_body_part.c (original)
+++ webservices/axis2/trunk/c/axiom/src/attachments/mime_body_part.c Thu Mar 29 19:24:32 2007
@@ -20,101 +20,57 @@
 #include <axiom_data_handler.h>
 #include <axis2_hash.h>
 
-typedef struct axiom_mime_body_part_impl
+struct axiom_mime_body_part
 {
-    axiom_mime_body_part_t mime_body_part;
     /** hash map to hold header name, value pairs */
     axis2_hash_t *header_map;
     axiom_data_handler_t *data_handler;
-}
-axiom_mime_body_part_impl_t;
+};
 
 extern axis2_char_t AXIS2_CRLF[];
 
 
-#define AXIS2_INTF_TO_IMPL(mime_body_part) ((axiom_mime_body_part_impl_t *)(mime_body_part))
-
-void AXIS2_CALL
-axiom_mime_body_part_free(axiom_mime_body_part_t *mime_body_part, 
-    const axis2_env_t *env);
-
-axis2_status_t AXIS2_CALL
-axiom_mime_body_part_add_header(axiom_mime_body_part_t *mime_body_part,
-    const axis2_env_t *env,
-    const axis2_char_t *name,
-    const axis2_char_t *value);
-
-axis2_status_t AXIS2_CALL
-axiom_mime_body_part_set_data_handler(axiom_mime_body_part_t *mime_body_part, 
-    const axis2_env_t *env, 
-    axiom_data_handler_t *data_handler);
-
-axis2_status_t AXIS2_CALL
-axiom_mime_body_part_write_to(axiom_mime_body_part_t *mime_body_part, 
-    const axis2_env_t *env,
-    axis2_byte_t **output_stream, 
-    int *output_stream_size);
-/************************** End of Function headers ************************/
-
 AXIS2_EXTERN axiom_mime_body_part_t * AXIS2_CALL
 axiom_mime_body_part_create(const axis2_env_t *env)
 {
-    axiom_mime_body_part_impl_t *mime_body_part_impl = NULL;
+    axiom_mime_body_part_t *mime_body_part = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
-    mime_body_part_impl = (axiom_mime_body_part_impl_t *) AXIS2_MALLOC(env->allocator,
-        sizeof(axiom_mime_body_part_impl_t));
+    mime_body_part = (axiom_mime_body_part_t *) AXIS2_MALLOC(env->allocator,
+        sizeof(axiom_mime_body_part_t));
 
-    if (!mime_body_part_impl)
+    if (!mime_body_part)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
 
-    mime_body_part_impl->header_map = NULL;
-    mime_body_part_impl->data_handler = NULL;
-    mime_body_part_impl->mime_body_part.ops = NULL;
+    mime_body_part->header_map = NULL;
+    mime_body_part->data_handler = NULL;
 
-    mime_body_part_impl->header_map = axis2_hash_make(env);
-    if (!(mime_body_part_impl->header_map))
+    mime_body_part->header_map = axis2_hash_make(env);
+    if (!(mime_body_part->header_map))
     {
-        axiom_mime_body_part_free(&(mime_body_part_impl->mime_body_part), env);
+        axiom_mime_body_part_free(mime_body_part, env);
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
 
-    mime_body_part_impl->mime_body_part.ops = AXIS2_MALLOC(env->allocator,
-        sizeof(axiom_mime_body_part_ops_t));
-    if (!mime_body_part_impl->mime_body_part.ops)
-    {
-        axiom_mime_body_part_free(&(mime_body_part_impl->mime_body_part), env);
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        return NULL;
-    }
-
-    mime_body_part_impl->mime_body_part.ops->free =  axiom_mime_body_part_free;
-    mime_body_part_impl->mime_body_part.ops->add_header = axiom_mime_body_part_add_header;
-    mime_body_part_impl->mime_body_part.ops->set_data_handler = axiom_mime_body_part_set_data_handler;
-    mime_body_part_impl->mime_body_part.ops->write_to = axiom_mime_body_part_write_to;
-
-    return &(mime_body_part_impl->mime_body_part);
+    return mime_body_part;
 }
 
-void AXIS2_CALL
+AXIS2_EXTERN void AXIS2_CALL
 axiom_mime_body_part_free(axiom_mime_body_part_t *mime_body_part, 
     const axis2_env_t *env)
 {
-    axiom_mime_body_part_impl_t *mime_body_part_impl = NULL;
-
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    mime_body_part_impl = AXIS2_INTF_TO_IMPL(mime_body_part);
 
-    if (mime_body_part_impl->header_map)
+    if (mime_body_part->header_map)
     {
         axis2_hash_index_t *hash_index = NULL;
         const void *key = NULL;
         void *value = NULL;
-        for (hash_index = axis2_hash_first(mime_body_part_impl->header_map, env);
+        for (hash_index = axis2_hash_first(mime_body_part->header_map, env);
             hash_index; hash_index = axis2_hash_next(env, hash_index))
         {
             axis2_hash_this(hash_index, &key, NULL, &value);
@@ -125,57 +81,47 @@
         }
 
     
-        axis2_hash_free(mime_body_part_impl->header_map, env);
-        mime_body_part_impl->header_map = NULL;
+        axis2_hash_free(mime_body_part->header_map, env);
+        mime_body_part->header_map = NULL;
     }
 
-    if (mime_body_part->ops)
+    if (mime_body_part)
     {
-        AXIS2_FREE(env->allocator, mime_body_part->ops);
-    }
-
-    if (mime_body_part_impl)
-    {
-        AXIS2_FREE(env->allocator, mime_body_part_impl);
+        AXIS2_FREE(env->allocator, mime_body_part);
     }
 
     return;
 }
 
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axiom_mime_body_part_add_header(axiom_mime_body_part_t *mime_body_part,
     const axis2_env_t *env,
     const axis2_char_t *name,
     const axis2_char_t *value)
 {
-    axiom_mime_body_part_impl_t *mime_body_part_impl = NULL;
-
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
 
-    mime_body_part_impl = AXIS2_INTF_TO_IMPL(mime_body_part);
-
-    axis2_hash_set(mime_body_part_impl->header_map, name,
+    axis2_hash_set(mime_body_part->header_map, name,
         AXIS2_HASH_KEY_STRING, value);
     return AXIS2_SUCCESS;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axiom_mime_body_part_set_data_handler(axiom_mime_body_part_t *mime_body_part,
     const axis2_env_t *env, axiom_data_handler_t *data_handler)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(mime_body_part)->data_handler = data_handler;
+    mime_body_part->data_handler = data_handler;
     return AXIS2_SUCCESS;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axiom_mime_body_part_write_to(axiom_mime_body_part_t *mime_body_part, 
     const axis2_env_t *env,
     axis2_byte_t **output_stream, int *output_stream_size)
 {
-    axiom_mime_body_part_impl_t *mime_body_part_impl = NULL;
     axis2_hash_index_t *hash_index = NULL;
     const void *key = NULL;
     void *value = NULL;
@@ -190,9 +136,7 @@
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-    mime_body_part_impl = AXIS2_INTF_TO_IMPL(mime_body_part);
-
-    for (hash_index = axis2_hash_first(mime_body_part_impl->header_map, env);
+    for (hash_index = axis2_hash_first(mime_body_part->header_map, env);
         hash_index; hash_index = axis2_hash_next(env, hash_index))
     {
         axis2_hash_this(hash_index, &key, NULL, &value);
@@ -216,7 +160,7 @@
         }
     }
 
-    if (mime_body_part_impl->data_handler)
+    if (mime_body_part->data_handler)
     {
         temp_header_str = axis2_stracat(env, header_str, "\r\n");
         AXIS2_FREE(env->allocator, header_str);
@@ -232,9 +176,9 @@
        Java supports "base64", "uuencode", "x-uuencode", "x-uue", 
        "quoted-printable" 
     */
-    if (mime_body_part_impl->data_handler)
+    if (mime_body_part->data_handler)
     {
-        status = AXIOM_DATA_HANDLER_READ_FROM(mime_body_part_impl->data_handler, env,
+        status = AXIOM_DATA_HANDLER_READ_FROM(mime_body_part->data_handler, env,
             &data_handler_stream, &data_handler_stream_size);
         if (status == AXIS2_FAILURE)
 	{



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