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 OMNAMESPACE_H 00018 #define OMNAMESPACE_H 00019 00020 #include <WSFDefines.h> 00021 #include <stdio.h> 00022 #include <string> 00023 #include <axiom_namespace.h> 00024 00033 namespace wso2wsf 00034 { 00047 class OMNamespace 00048 { 00055 friend WSF_EXTERN std::ostream & WSF_CALL operator <<(std::ostream & str, OMNamespace const & ns); 00056 00063 friend WSF_EXTERN std::ostream & WSF_CALL operator <<(std::ostream & str, OMNamespace const * ns); 00064 00065 private: 00070 axiom_namespace_t * _wsf_axiom_namespace; 00074 int _refcounter; 00075 00076 public: 00081 axiom_namespace_t * WSF_CALL getAxiomNamespace(); 00082 00087 void WSF_CALL setAxiomNamespace(axiom_namespace_t * ns); 00088 00093 WSF_EXTERN WSF_CALL OMNamespace(std::string uri); 00094 00100 WSF_EXTERN WSF_CALL OMNamespace(std::string uri, std::string prefix); 00101 00107 WSF_EXTERN WSF_CALL OMNamespace(axiom_namespace_t *ns); 00108 00113 WSF_EXTERN WSF_CALL OMNamespace(OMNamespace & om_namespace); 00114 00118 virtual WSF_CALL ~OMNamespace(); 00119 00125 WSF_EXTERN bool WSF_CALL equals(OMNamespace * ns); 00126 00131 WSF_EXTERN std::string WSF_CALL getURI(); 00132 00137 WSF_EXTERN std::string WSF_CALL getPrefix(); 00138 00143 WSF_EXTERN virtual std::string WSF_CALL toString(); 00144 00149 WSF_EXTERN int WSF_CALL incrementRef(); 00154 WSF_EXTERN int WSF_CALL decrementRef(); 00155 }; 00158 inline std::ostream & WSF_CALL operator <<(std::ostream & str, OMNamespace const & ns) 00159 { 00160 return str << const_cast<OMNamespace &>(ns).toString(); 00161 } 00162 00163 inline std::ostream & WSF_CALL operator <<(std::ostream & str, OMNamespace const * ns) 00164 { 00165 return str << const_cast<OMNamespace *>(ns)->toString(); 00166 } 00167 } 00168 #endif // OMNAMESPACE_H