Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Examples

woden_xml_attr.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2004,2005 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef WODEN_XML_ATTR_H
00018 #define WODEN_XML_ATTR_H
00019 
00027 #include <axis2_allocator.h>
00028 #include <axis2_env.h>
00029 #include <axis2_error.h>
00030 #include <axis2_string.h>
00031 #include <axis2_utils.h>
00032 #include <axis2_hash.h>
00033 #include <axis2_qname.h>
00034 #include <axis2_generic_obj.h>
00035 #include <woden.h>
00036 
00037 #ifdef __cplusplus
00038 extern "C"
00039 {
00040 #endif
00041 
00042 typedef struct woden_xml_attr woden_xml_attr_t;
00043 typedef struct woden_xml_attr_ops woden_xml_attr_ops_t;
00044 struct axiom_node;
00045 struct axiom_element;
00046 
00052 struct woden_xml_attr_ops
00053 {
00058     axis2_status_t (AXIS2_CALL *
00059     free) (
00060             void *xml_attr,
00061             const axis2_env_t *env);
00062       
00063     woden_obj_types_t (AXIS2_CALL *
00064     type) (
00065             void *xml_attr,
00066             const axis2_env_t *env);
00067     
00068     axis2_status_t (AXIS2_CALL *
00069     init) (
00070             void *xml_attr,
00071             const axis2_env_t *env,
00072             struct axiom_element *owner_el,
00073             struct axiom_node *owner_node,
00074             axis2_qname_t *attr_type, 
00075             axis2_char_t *attr_value);
00076 
00077     axis2_qname_t *(AXIS2_CALL *
00078     get_attribute_type) (
00079             void *xml_attr,
00080             const axis2_env_t *env);
00081 
00082     axis2_generic_obj_t *(AXIS2_CALL *
00083     get_content) (
00084             void *xml_attr,
00085             const axis2_env_t *env);
00086 
00087     axis2_char_t *(AXIS2_CALL *
00088     to_external_form) (
00089             void *xml_attr,
00090             const axis2_env_t *env);
00091 
00092     axis2_bool_t (AXIS2_CALL *
00093     is_valid) (
00094             void *xml_attr,
00095             const axis2_env_t *env);
00096 
00097     /* ************************************************************
00098      *  Non-API implementation methods 
00099      * ************************************************************/
00100 
00101     void *(AXIS2_CALL *
00102     convert) (
00103             void *xml_attr,
00104             const axis2_env_t *env,
00105             struct axiom_element *owner_el,
00106             struct axiom_node *ownder_node,
00107             axis2_char_t *attr_value);
00108 
00109     /*
00110      * Validity is initialized to true, but set to false if the attribute's
00111      * value is null or if it cannot be converted to an object of the 
00112      * appropriate type). This method may be used to change the validity later
00113      * (e.g. if Validation determines an error).
00114      * 
00115      * TODO confirm this method is needed, otherwise remove it.
00116      */
00117     axis2_status_t (AXIS2_CALL *
00118     set_valid) (
00119             void *xml_attr,
00120             const axis2_env_t *env,
00121             axis2_bool_t validity);
00122       
00123 };
00124 
00125 struct woden_xml_attr
00126 {
00127     woden_xml_attr_ops_t *ops;
00128 };
00129 
00130 AXIS2_EXTERN woden_xml_attr_t * AXIS2_CALL
00131 woden_xml_attr_create(
00132         const axis2_env_t *env,
00133         struct axiom_element *owner_el,
00134         struct axiom_node *owner_node,
00135         axis2_qname_t *attr_type, 
00136         axis2_char_t *attr_value);
00137 
00138 /************************Woden C Internal Methods******************************/
00139 AXIS2_EXTERN axis2_status_t AXIS2_CALL
00140 woden_xml_attr_resolve_methods(
00141         woden_xml_attr_t *xml_attr,
00142         const axis2_env_t *env,
00143         axis2_hash_t *methods);
00144 /************************End of Woden C Internal Methods***********************/
00145 
00146 #define WODEN_XML_ATTR_FREE(xml_attr, env) \
00147       (((woden_xml_attr_t *) xml_attr)->ops->free (xml_attr, env))
00148 
00149 #define WODEN_XML_ATTR_TYPE(xml_attr, env) \
00150       (((woden_xml_attr_t *) xml_attr)->ops->type (xml_attr, env))
00151 
00152 #define WODEN_XML_ATTR_INIT(xml_attr, env, owner_el, owner_node, \
00153         attr_type, attr_value) \
00154       (((woden_xml_attr_t *) xml_attr)->ops->init(xml_attr, env, \
00155             owner_el, owner_node, attr_type, attr_value))
00156 
00157 #define WODEN_XML_ATTR_GET_ATTRIBUTE_TYPE(xml_attr, env) \
00158       (((woden_xml_attr_t *) xml_attr)->ops->\
00159          get_attribute_type(xml_attr, env))
00160 
00161 #define WODEN_XML_ATTR_GET_CONTENT(xml_attr, env) \
00162       (((woden_xml_attr_t *) xml_attr)->ops->get_content(xml_attr, env))
00163 
00164 #define WODEN_XML_ATTR_TO_EXTERNAL_FORM(xml_attr, env) \
00165       (((woden_xml_attr_t *) xml_attr)->ops->\
00166          to_external_form(xml_attr, env))
00167 
00168 #define WODEN_XML_ATTR_IS_VALID(xml_attr, env) \
00169       (((woden_xml_attr_t *) xml_attr)->ops->is_valid(xml_attr, env))
00170 
00171 #define WODEN_XML_ATTR_CONVERT(xml_attr, env, owner_el, owner_node, \
00172         attr_type, attr_value) \
00173       (((woden_xml_attr_t *) xml_attr)->ops->convert(xml_attr, env, \
00174             owner_el, owner_node, attr_type, attr_value))
00175 
00176 #define WODEN_XML_ATTR_SET_VALID(xml_attr, env, validity) \
00177       (((woden_xml_attr_t *) xml_attr)->ops->set_valid(xml_attr, \
00178                                                   env, validity))
00179 
00181 #ifdef __cplusplus
00182 }
00183 #endif
00184 #endif /* WODEN_XML_ATTR_H */

Generated on Fri Jun 16 18:02:32 2006 for Axis2/C by  doxygen 1.4.2