axiom_node.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 AXIOM_NODE_H
00018 #define AXIOM_NODE_H
00019 
00037 #include <axis2_env.h>
00038 #include <axis2_utils.h>
00039 
00040 
00041 #ifdef __cplusplus
00042 extern "C"
00043 {
00044 #endif
00045 
00046     typedef struct axiom_node axiom_node_t;
00047     struct axiom_node_ops;
00048     struct axiom_output;
00049     struct axiom_document;
00050     struct axiom_stax_builder;
00060     typedef enum axiom_types_t
00061     {
00063         AXIOM_INVALID = 0,
00065         AXIOM_DOCUMENT,
00067         AXIOM_ELEMENT,
00069         AXIOM_DOCTYPE,
00071         AXIOM_COMMENT,
00073         AXIOM_ATTRIBUTE,
00075         AXIOM_NAMESPACE,
00077         AXIOM_PROCESSING_INSTRUCTION,
00079         AXIOM_TEXT
00080     } axiom_types_t;
00081 
00086    typedef struct axiom_node_ops
00087 {
00094     axis2_status_t (AXIS2_CALL *
00095     free) (axiom_node_t *om_node,
00096            const axis2_env_t *env);
00105     axis2_status_t (AXIS2_CALL *
00106     add_child) (axiom_node_t* om_node,
00107                 const axis2_env_t *env,
00108                 axiom_node_t *child);
00109 
00117     axiom_node_t  *(AXIS2_CALL *
00118     detach) (axiom_node_t  *om_node,
00119              const axis2_env_t *env);
00120 
00128     axis2_status_t (AXIS2_CALL *
00129     insert_sibling_after)(axiom_node_t  *om_node,
00130                           const axis2_env_t *env,
00131                           axiom_node_t  * node_to_insert);
00132 
00140     axis2_status_t (AXIS2_CALL *
00141     insert_sibling_before)(axiom_node_t  *om_node,
00142                            const axis2_env_t *env,
00143                            axiom_node_t  * node_to_insert);
00144 
00153     axis2_status_t (AXIS2_CALL *
00154     serialize)(axiom_node_t  * om_node,
00155                const axis2_env_t *env,
00156               struct axiom_output *om_output);
00157               
00165     axiom_node_t * (AXIS2_CALL *
00166     get_parent)(axiom_node_t  *om_node,
00167                 const axis2_env_t *env);
00168 
00176     axiom_node_t * (AXIS2_CALL *
00177     get_first_child)(axiom_node_t  *om_node,
00178                      const axis2_env_t *env);
00185     axiom_node_t * (AXIS2_CALL *
00186     get_last_child)(axiom_node_t  *om_node,
00187                     const axis2_env_t *env);
00195     axiom_node_t * (AXIS2_CALL *
00196     get_previous_sibling)(axiom_node_t  *om_node,
00197                           const axis2_env_t *env);
00204     axiom_node_t * (AXIS2_CALL *
00205     get_next_sibling)(axiom_node_t  *om_node,
00206                       const axis2_env_t *env);
00215     axiom_types_t (AXIS2_CALL *
00216     get_node_type)(axiom_node_t  *om_node,
00217                    const axis2_env_t *env);
00227     void* (AXIS2_CALL *
00228     get_data_element)(axiom_node_t  *om_node,
00229                       const axis2_env_t *env);    
00237     axis2_bool_t (AXIS2_CALL *
00238     is_complete)(axiom_node_t  *om_node,
00239                       const axis2_env_t *env); 
00248     struct axiom_document* (AXIS2_CALL *
00249     get_document)(axiom_node_t *om_node,
00250                   const axis2_env_t *env);
00251                   
00252     axis2_char_t* (AXIS2_CALL *
00253     to_string)(axiom_node_t *om_node,
00254                const axis2_env_t *env);                  
00255                                                                         
00256 } axiom_node_ops_t;
00257 
00258 
00263     struct axiom_node
00264     {
00266         axiom_node_ops_t *ops;
00267                
00268     };
00269 
00275 AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
00276 axiom_node_create (const axis2_env_t *env);
00277 
00279 #define AXIOM_NODE_FREE_TREE(om_node,env) \
00280         ((om_node)->ops->free(om_node,env))
00281 
00282 #define AXIOM_NODE_ADD_CHILD(om_node, env, child) \
00283         ((om_node)->ops->add_child(om_node, env, child))
00284 
00285 #define AXIOM_NODE_DETACH(om_node,env) \
00286         ((om_node)->ops->detach(om_node,env))
00287 
00288 #define AXIOM_NODE_INSERT_SIBLING_AFTER(om_node,env,node_to_insert) \
00289         ((om_node)->ops->insert_sibling_after(om_node,env,node_to_insert))
00290 
00291 #define AXIOM_NODE_INSERT_SIBLING_BEFORE(om_node,env,node_to_insert) \
00292         ((om_node)->ops->insert_sibling_before(om_node,env,node_to_insert))
00293 
00294 #define AXIOM_NODE_SERIALIZE(om_node,env, om_output) \
00295         ((om_node)->ops->serialize(om_node,env,om_output))
00296 
00297 #define AXIOM_NODE_GET_PARENT(om_node,env) \
00298         ((om_node)->ops->get_parent(om_node,env))
00299 
00300 #define AXIOM_NODE_GET_FIRST_CHILD(om_node,env) \
00301         ((om_node)->ops->get_first_child(om_node,env))
00302 
00303 #define AXIOM_NODE_GET_LAST_CHILD(om_node,env) \
00304         ((om_node)->ops->get_last_child(om_node,env))
00305 
00306 #define AXIOM_NODE_GET_NEXT_SIBLING(om_node,env) \
00307         ((om_node)->ops->get_next_sibling(om_node,env))
00308 
00309 #define AXIOM_NODE_GET_PREVIOUS_SIBLING(om_node,env) \
00310         ((om_node)->ops->get_previous_sibling(om_node,env))
00311 
00313 #define AXIOM_NODE_IS_COMPLETE(om_node,env) \
00314         ((om_node)->ops->is_complete(om_node,env))
00315 
00316 #define AXIOM_NODE_GET_DATA_ELEMENT(om_node,env) \
00317         ((om_node)->ops->get_data_element(om_node,env))
00318 
00319 #define AXIOM_NODE_GET_NODE_TYPE(om_node,env) \
00320         ((om_node)->ops->get_node_type(om_node,env))       
00321 
00322 #define AXIOM_NODE_GET_DOCUMENT(om_node, env) \
00323         ((om_node)->ops->get_document(om_node, env))
00324 
00325 #define AXIOM_NODE_TO_STRING(om_node, env) \
00326         ((om_node)->ops->to_string(om_node, env))        
00327 
00329 #ifdef __cplusplus
00330 }
00331 #endif
00332 
00333 #endif                          /* AXIOM_NODE_H */

Generated on Thu Oct 26 21:00:10 2006 for Axis2/C by  doxygen 1.4.7