Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 36846 invoked from network); 24 Aug 2006 11:57:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Aug 2006 11:57:55 -0000 Received: (qmail 39851 invoked by uid 500); 24 Aug 2006 11:57:53 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 39767 invoked by uid 500); 24 Aug 2006 11:57:53 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 39756 invoked by uid 500); 24 Aug 2006 11:57:53 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 39750 invoked by uid 99); 24 Aug 2006 11:57:53 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Aug 2006 04:57:53 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Aug 2006 04:57:52 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 055CF1A981A; Thu, 24 Aug 2006 04:57:32 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r434377 - in /webservices/axis2/trunk/c/xml_schema: include/xml_schema_obj.h src/xml_schema_obj.c Date: Thu, 24 Aug 2006 11:57:31 -0000 To: axis2-cvs@ws.apache.org From: nandika@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060824115732.055CF1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: nandika Date: Thu Aug 24 04:57:30 2006 New Revision: 434377 URL: http://svn.apache.org/viewvc?rev=434377&view=rev Log: doc comments added Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_obj.h webservices/axis2/trunk/c/xml_schema/src/xml_schema_obj.c Modified: webservices/axis2/trunk/c/xml_schema/include/xml_schema_obj.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/include/xml_schema_obj.h?rev=434377&r1=434376&r2=434377&view=diff ============================================================================== --- webservices/axis2/trunk/c/xml_schema/include/xml_schema_obj.h (original) +++ webservices/axis2/trunk/c/xml_schema/include/xml_schema_obj.h Thu Aug 24 04:57:30 2006 @@ -18,8 +18,17 @@ #define XML_SCHEMA_OBJ_H /** + * @defgroup xml_schema_obj xml_schema_obj + * @ingroup xml_schema + * xml_schema_obj defines a set of functions that are common to + * other interfaces in xml_schema + * @{ + */ + +/** * @file xml_schema_obj.h - * @brief Axis2 Xml Schema Obj interface + * @brief xml_schema_obj defines common function + * set that is used by other xml_schema structures */ #include @@ -37,119 +46,255 @@ { #endif -typedef struct xml_schema_obj xml_schema_obj_t; -typedef struct xml_schema_obj_ops xml_schema_obj_ops_t; - -/** @defgroup xml_schema_obj Xml Schema Obj - * @ingroup xml_schema - * @{ - */ - -struct xml_schema_obj_ops -{ - axis2_status_t (AXIS2_CALL * - free) ( - void *obj, - const axis2_env_t *env); - - axis2_hash_t *(AXIS2_CALL * - super_objs) ( - void *obj, - const axis2_env_t *env); - - xml_schema_types_t (AXIS2_CALL * - get_type) ( - void *obj, - const axis2_env_t *env); - - int (AXIS2_CALL * - get_line_num) (void *obj, + /* Type name for struct xml_schema_obj */ + typedef struct xml_schema_obj xml_schema_obj_t; + /* Type name for struct xml_schema_obj */ + typedef struct xml_schema_obj_ops xml_schema_obj_ops_t; + + /** xml_schema_obj_ops struct + * Encapsulator struct for operations of the xml_schema_obj + */ + struct xml_schema_obj_ops + { + /** + * Free the xml_schema_obj + * @param obj pointer to xml_schema_obj struct + * @param env pointer to environment struct + * @returns AXIS2_SUCCESS on success else FAILURE + */ + axis2_status_t (AXIS2_CALL * + free) ( + void *obj, + const axis2_env_t *env); + /** + * returns a hashtable containing pointers to base struct instances + * @param obj xml_schema_obj struct + * @param env environment struct + * @returns pointer to hashtable if available , + * NULL otherwise + */ + + axis2_hash_t *(AXIS2_CALL * + super_objs) ( + void *obj, const axis2_env_t *env); - axis2_status_t (AXIS2_CALL * - set_line_num) (void *obj, - const axis2_env_t *env, - int line_num); - - int (AXIS2_CALL * - get_line_pos) (void *obj, + /** + * get the type of the derived struct instance + * eg :- xml_schema_annotated_t is a derived type of + * xml_schema_obj, If this function is called on a xml_schema_annotated + * pointer it will return XML_SCHEMA_ANNOTATED enum value + * xml_schema_types_t is defined as an enumaration + * @param obj xml_schema_obj + * @param env pointer to environment struct + * @returns xml_schema_types_t + */ + xml_schema_types_t (AXIS2_CALL * + get_type) ( + void *obj, const axis2_env_t *env); - axis2_status_t (AXIS2_CALL * - set_line_pos) (void *obj, - const axis2_env_t *env, - int line_pos); + /** + * get the line number in xml document corresponding to + * this struct instance + * @param obj pointer to xml_schema_obj struct instance + * @param env pointer to environment + * @returns the line number + */ + int (AXIS2_CALL * + get_line_num) (void *obj, + const axis2_env_t *env); + /** + * set the line number in xml document corresponding to + * this struct instance + * @param obj pointer to xml_schema_obj struct instance + * @param env pointer to environment + * @returns AXIS2_SUCCESS + */ + axis2_status_t (AXIS2_CALL * + set_line_num) (void *obj, + const axis2_env_t *env, + int line_num); - axis2_char_t * (AXIS2_CALL * - get_source_uri) (void *obj, + /** + * get line positon in xml document corresponding to + * this struct instance + * @param obj pointer to xml_schema_obj struct instance + * @param env environment struct + * @returns the line position + */ + int (AXIS2_CALL * + get_line_pos) (void *obj, const axis2_env_t *env); - axis2_status_t (AXIS2_CALL * - set_source_uri) (void *obj, + /** + * set line position in xml document corresponding to + * this struct instance + * @param obj pointer to xml_schema_obj or its derived struct instance + * @param env environment struct + * @param line_pos line position + * @returns AXIS2_SUCCESS + */ + axis2_status_t (AXIS2_CALL * + set_line_pos) (void *obj, const axis2_env_t *env, - axis2_char_t *source_uri); + int line_pos); + /** + * get the source uri of xml schema obj + * @param obj xml_schema_obj struct instance + * @param env pointer to environment + * @returns pointer to source uri string + */ - axis2_bool_t (AXIS2_CALL * - equals) (void *obj, - const axis2_env_t *env, - void *obj_comp); - -}; + axis2_char_t * (AXIS2_CALL * + get_source_uri) (void *obj, + const axis2_env_t *env); + + /** + * get the source uri of xml schema obj + * @param obj xml_schema_obj struct instance + * @param env pointer to environment + * @param source_uri source uri string + * @returns env pointer to environment struct + */ + axis2_status_t (AXIS2_CALL * + set_source_uri) (void *obj, + const axis2_env_t *env, + axis2_char_t *source_uri); + + /** + * compares two xml_schema_obj instances + * @param obj xml_schema_obj instance + * @param env environment struct + * @param obj_comp xml_schema_obj instance to be compared + * @param AXIS2_TRUE if equals , AXIS2_FALSE otherwise + */ + axis2_bool_t (AXIS2_CALL * + equals) (void *obj, + const axis2_env_t *env, + void *obj_comp); -struct xml_schema_obj -{ - xml_schema_obj_ops_t *ops; -}; + /** + * Add a value to meta info hashtable + * if hashtable will be created, when this function is called + * for the first time . + * @param obj xml_schema_obj instance + * @param env environment struct + * @param key key + * @param value value + * @returns AXIS2_SUCCESS on success, AXIS2_FAILURE otherwise + */ + axis2_status_t (AXIS2_CALL * + add_meta_info)(void *obj, + const axis2_env_t *env, + axis2_char_t *key, + void *value); + + /** + * get meta info hashtable , will be null if it does not + * contain any meta infomation. + * @param obj xml_schema_obj or its subtype + * @param env environment struct + * @returns pointer to axis2_hash_t , NULL of not intialized + */ + axis2_hash_t* (AXIS2_CALL * + get_meta_info)(void *obj, + const axis2_env_t *env); -AXIS2_EXTERN xml_schema_obj_t * AXIS2_CALL -xml_schema_obj_create(const axis2_env_t *env); + }; -/** - * This method is internal to Axis2 C. It is called from Child Constructor - */ -AXIS2_EXTERN axis2_status_t AXIS2_CALL -xml_schema_obj_resolve_methods(xml_schema_obj_t *schema_obj, - const axis2_env_t *env, - xml_schema_obj_t *schema_obj_impl, - XML_SCHEMA_SUPER_OBJS_FN super_objs, - XML_SCHEMA_GET_TYPE_FN get_type, - XML_SCHEMA_FREE_FN free_fn); - + /** + * xml_schema_obj struct + */ + + struct xml_schema_obj + { + /** operations of the xml_schema_obj */ + xml_schema_obj_ops_t *ops; + }; + + /** + * Creates an xml_schema_obj instance + * @param env pointer to environment struct + * @returns xml_schema_obj instance + */ + + AXIS2_EXTERN xml_schema_obj_t * AXIS2_CALL + xml_schema_obj_create(const axis2_env_t *env); + + /** + * This method is internal to Axis2 C. + * It is called from Child Constructor + */ + AXIS2_EXTERN axis2_status_t AXIS2_CALL + xml_schema_obj_resolve_methods(xml_schema_obj_t *schema_obj, + const axis2_env_t *env, + xml_schema_obj_t *schema_obj_impl, + XML_SCHEMA_SUPER_OBJS_FN super_objs, + XML_SCHEMA_GET_TYPE_FN get_type, + XML_SCHEMA_FREE_FN free_fn); -/******************************************************************************/ +/** Free xml_schema_obj struct instance. + @sa xml_schema_obj_ops#free */ #define XML_SCHEMA_OBJ_FREE(obj, env) \ (((xml_schema_obj_t *) obj)->ops->free (obj, env)) +/** Get hashtable containing pointers to base struct instances. + @sa xml_schema_obj_ops#super_objs */ #define XML_SCHEMA_OBJ_SUPER_OBJS(obj, env) \ (((xml_schema_obj_t *) obj)->ops->super_objs (obj, env)) - + +/** Get the type of struct type one of xml_schema_types enu. + @sa xml_schema_obj_ops#get_type */ #define XML_SCHEMA_OBJ_GET_TYPE(obj, env) \ (((xml_schema_obj_t *) obj)->ops->get_type (obj, env)) +/** Get the line number in xml document . + @sa xml_schema_obj_ops#get_line_num */ #define XML_SCHEMA_OBJ_GET_LINE_NUM(obj, env) \ (((xml_schema_obj_t *) obj)->ops->get_line_num (obj, env)) +/** Set line number. + @sa xml_schema_obj_ops#set_line_num */ #define XML_SCHEMA_OBJ_SET_LINE_NUM(obj, env, line_num) \ (((xml_schema_obj_t *) obj)->ops->set_line_num (obj, env, line_num)) +/** Get line position. + @sa xml_schema_obj_ops#get_line_ops */ #define XML_SCHEMA_OBJ_GET_LINE_POS(obj, env) \ (((xml_schema_obj_t *) obj)->ops->get_line_pos (obj, env)) +/** Set Line position. + @sa xml_schema_obj_ops#set_line_pos */ #define XML_SCHEMA_OBJ_SET_LINE_POS(obj, env, line_pos) \ (((xml_schema_obj_t *) obj)->ops->set_line_pos (obj, env, line_pos)) +/** Get source uri. + @sa xml_schema_obj_ops#get_source_uri */ #define XML_SCHEMA_OBJ_GET_SOURCE_URI(obj, env) \ (((xml_schema_obj_t *) obj)->ops->get_source_uri (obj, env)) +/** Set source uri. + @sa xml_schema_obj_ops#set_source_uri */ #define XML_SCHEMA_OBJ_SET_SOURCE_URI(obj, env, source_uri) \ - (((xml_schema_obj_t *) obj)->ops->set_source_uri (obj, env, \ - source_uri)) + (((xml_schema_obj_t *) obj)->ops->set_source_uri (obj, env, source_uri)) +/** Equals + @sa xml_schema_obj_ops#equals */ #define XML_SCHEMA_OBJ_EQUALS(obj, env) \ (((xml_schema_obj_t *) obj)->ops->equals (obj, env)) -/** @} */ +/** Get meta infomation + @sa xml_schema_obj_ops#get_meta_info */ +#define XML_SCHEMA_OBJ_GET_META_INFO(obj , env) \ + (((xml_schema_obj_t*) obj)->ops->get_meta_info(obj, env)) + +/** Add meta info + @sa xml_schema_obj#add_meta_info */ +#define XML_SCHEMA_OBJ_ADD_META_INFO(obj, env) \ + (((xml_schema_obj_t*) obj)->ops->add_meta_info(obj, env)) + /** @} */ #ifdef __cplusplus } #endif Modified: webservices/axis2/trunk/c/xml_schema/src/xml_schema_obj.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/xml_schema/src/xml_schema_obj.c?rev=434377&r1=434376&r2=434377&view=diff ============================================================================== --- webservices/axis2/trunk/c/xml_schema/src/xml_schema_obj.c (original) +++ webservices/axis2/trunk/c/xml_schema/src/xml_schema_obj.c Thu Aug 24 04:57:30 2006 @@ -18,14 +18,10 @@ #include #include -typedef struct xml_schema_obj_impl - xml_schema_obj_impl_t; - /** - * @brief Xml Schema Obj Struct Impl - * Axis2 Xml Schema Obj + * @brief xml_schema_obj struct impl */ -struct xml_schema_obj_impl +typedef struct xml_schema_obj_impl { xml_schema_obj_t obj; @@ -36,9 +32,12 @@ int line_num; int line_pos; + + axis2_hash_t *meta_info_map; axis2_char_t *source_uri; -}; + +}xml_schema_obj_impl_t; #define AXIS2_INTF_TO_IMPL(obj) \ ((xml_schema_obj_impl_t *) obj) @@ -52,55 +51,65 @@ axis2_hash_t *AXIS2_CALL xml_schema_obj_super_objs( - void *obj, - const axis2_env_t *env); + void *obj, + const axis2_env_t *env); xml_schema_types_t AXIS2_CALL xml_schema_obj_get_type( - void *obj, - const axis2_env_t *env); + void *obj, + const axis2_env_t *env); axis2_char_t * AXIS2_CALL xml_schema_obj_get_source_uri( - void *obj, - const axis2_env_t *env); + void *obj, + const axis2_env_t *env); axis2_status_t AXIS2_CALL xml_schema_obj_set_source_uri( - void *obj, - const axis2_env_t *env, - axis2_char_t *source_uri); + void *obj, + const axis2_env_t *env, + axis2_char_t *source_uri); axis2_bool_t AXIS2_CALL xml_schema_obj_equals( - void *obj, - const axis2_env_t *env, - void *obj_comp); + void *obj, + const axis2_env_t *env, + void *obj_comp); int AXIS2_CALL xml_schema_obj_get_line_num( - void *obj, - const axis2_env_t *env); + void *obj, + const axis2_env_t *env); axis2_status_t AXIS2_CALL xml_schema_obj_set_line_num( - void *obj, - const axis2_env_t *env, - int line_num); + void *obj, + const axis2_env_t *env, + int line_num); int AXIS2_CALL xml_schema_obj_get_line_pos( - void *obj, - const axis2_env_t *env); + void *obj, + const axis2_env_t *env); axis2_status_t AXIS2_CALL xml_schema_obj_set_line_pos( - void *obj, - const axis2_env_t *env, - int line_pos); - -/******************* end function pointers ************************************/ + void *obj, + const axis2_env_t *env, + int line_pos); +axis2_status_t AXIS2_CALL +xml_schema_obj_add_meta_info( + void *obj, + const axis2_env_t *env, + axis2_char_t *key, + void *value); + +axis2_hash_t* AXIS2_CALL +xml_schema_obj_get_meta_info( + void *obj, + const axis2_env_t *env); + AXIS2_EXTERN xml_schema_obj_t * AXIS2_CALL xml_schema_obj_create(const axis2_env_t *env) { @@ -121,6 +130,7 @@ obj_impl->line_num = -1; obj_impl->line_pos = -1; obj_impl->source_uri = NULL; + obj_impl->meta_info_map = NULL; obj_impl->obj.ops = NULL; obj_impl->obj.ops = AXIS2_MALLOC(env->allocator, @@ -153,8 +163,13 @@ xml_schema_obj_set_source_uri; obj_impl->obj.ops->equals = xml_schema_obj_equals; - + obj_impl->obj.ops->get_meta_info = + xml_schema_obj_get_meta_info; + obj_impl->obj.ops->add_meta_info = + xml_schema_obj_add_meta_info; + obj_impl->ht_super = axis2_hash_make(env); + if(!obj_impl->ht_super) { AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); @@ -400,3 +415,48 @@ return AXIS2_TRUE; } +axis2_status_t AXIS2_CALL +xml_schema_obj_add_meta_info(void *obj, + const axis2_env_t *env, + axis2_char_t *key, + void *value) +{ + xml_schema_obj_impl_t *obj_impl = NULL; + axis2_hash_t *ht_super = NULL; + + ht_super = XML_SCHEMA_OBJ_SUPER_OBJS(obj, env); + if(NULL != ht_super) + { + obj_impl = AXIS2_INTF_TO_IMPL(axis2_hash_get(ht_super, "XML_SCHEMA_OBJ", + AXIS2_HASH_KEY_STRING)); + if(!obj_impl->meta_info_map) + { + obj_impl->meta_info_map = axis2_hash_make(env); + if(!obj_impl->meta_info_map) + { + AXIS2_ERROR_SET((env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return AXIS2_FAILURE; + } + axis2_hash_set(obj_impl->meta_info_map, key, AXIS2_HASH_KEY_STRING, + value); + } + return AXIS2_SUCCESS; + } + return AXIS2_FAILURE; +} + +axis2_hash_t* AXIS2_CALL +xml_schema_obj_get_meta_info(void *obj, + const axis2_env_t *env) +{ + xml_schema_obj_impl_t *obj_impl = NULL; + axis2_hash_t *ht_super = NULL; + ht_super = XML_SCHEMA_OBJ_SUPER_OBJS(obj, env); + if(NULL != ht_super) + { + obj_impl = AXIS2_INTF_TO_IMPL(axis2_hash_get(ht_super, "XML_SCHEMA_OBJ", + AXIS2_HASH_KEY_STRING)); + return obj_impl->meta_info_map; + } + return NULL; +} --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org