woden_xml_attr.h

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

Generated on Wed Dec 20 20:34:50 2006 for Axis2/C by  doxygen 1.5.1