# OMNode.h

Go to the documentation of this file.

    00001 /*
    00002  * Copyright 2005-2009 WSO2, Inc. http://wso2.com
    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 OMNODE_H
    00018 #define OMNODE_H
    00019
    00020 #include <WSFDefines.h>
    00021 #include <stdio.h>
    00022 #include <axutil_utils.h>
    00023 #include <axiom_node.h>
    00024 #include <WSFault.h>
    00025 #include <string>
    00026
    00035 namespace wso2wsf
    00036 {
    00050     class OMNode
    00051     {
    00058         friend WSF_EXTERN std::ostream & WSF_CALL operator <<(std::ostream & str, OMNode const & node);
    00059
    00066         friend WSF_EXTERN std::ostream & WSF_CALL operator <<(std::ostream & str, OMNode const * node);
    00067
    00068     private:
    00072         axiom_node_t * _wsf_axiom_node;
    00073
    00074
    00075
    00081         bool WSF_CALL isComplete();
    00082
    00083         protected:
    00087                 OMNode *_parent;
    00088
    00089     public:
    00093         WSF_CALL OMNode();
    00094
    00098         virtual WSF_CALL ~OMNode();
    00099
    00104         WSF_EXTERN void WSF_CALL setAxiomNode(axiom_node_t * node);
    00105
    00110        WSF_EXTERN  axiom_node_t * WSF_CALL getAxiomNode();
    00111
    00116         WSF_EXTERN virtual std::string WSF_CALL toString();
    00117
    00122         virtual std::string WSF_CALL subTreeToString();
    00123
    00127         virtual void WSF_CALL freeTree();
    00128
    00134         virtual bool WSF_CALL insertSiblingAfter(OMNode * to_insert);
    00135
    00141         virtual bool WSF_CALL insertSiblingBefore(OMNode * to_insert);
    00142
    00148         virtual OMNode * WSF_CALL detach();
    00149
    00155         virtual OMNode * WSF_CALL getParent();
    00164                 virtual void WSF_CALL setParent(OMNode *parent);
    00170         virtual OMNode * WSF_CALL getPreviousSibling();
    00171
    00176         virtual OMNode * WSF_CALL getNextSibling();
    00177
    00184         virtual axiom_types_t WSF_CALL nodeType() = 0;
    00185
    00186     };
    00189     inline std::ostream & WSF_CALL operator <<(std::ostream & str, OMNode const & node)
    00190     {
    00191         return str << const_cast<OMNode &>(node).toString();
    00192     }
    00193
    00194     inline std::ostream & WSF_CALL operator <<(std::ostream & str, OMNode const * node)
    00195     {
    00196         return str << const_cast<OMNode *>(node)->toString();
    00197     }
    00198 }
    00199 #endif // OMNODE_H