00001 /* 00002 * wsdlpull - A C++ parser for WSDL (Web services description language) 00003 * Copyright (C) 2005-2007 Vivek Krishna 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public 00016 * License along with this library; if not, write to the Free 00017 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 * 00019 */ 00020 #ifndef _WSDLELEMENTH 00021 #define _WSDLELEMENTH 00022 00023 #include <string> 00024 #include <vector> 00025 #include "xmlpull/Qname.h" 00026 #include "xmlpull/XmlUtils.h" 00027 #include "schemaparser/Element.h" 00028 #include "wsdlparser/WsdlException.h" 00029 #include "xmlpull/wsdlpull_export.h" 00030 00031 using namespace Schema; 00032 00033 //Implementation of a Wsdl element 00034 //This is the base class of all wsdl elements 00035 namespace WsdlPull{ 00036 class WsdlParser; 00037 00038 class WSDLPULL_EXPORT WsdlElement 00039 { 00040 public: 00041 00042 WsdlElement(WsdlParser& w); 00043 virtual ~WsdlElement(); 00046 00051 std::string getName() const; 00052 00057 const std::string getDocumentation() const; 00058 00067 bool getExtensibilityElements(const std::string & namespc, 00068 std::vector<int>& ids); 00069 00070 bool getExtensibilityAttributes(const std::string & namespc, 00071 std::vector<int>& ids); 00072 00074 00077 void setName(std::string nam); 00078 void addExtElement(int ident); 00079 void addExtAttribute(int ident); 00080 void setDocumentation(std::string* s); 00082 00083 virtual void print(std::ostream & out); 00084 protected: 00085 std::string name_; 00086 int id_; 00087 std::vector<int> extElems_; 00088 std::vector<int> extAttributes_; 00089 std::string * doc_; 00090 protected: 00091 WsdlParser & wParser_; 00092 }; 00093 00094 inline 00095 WsdlElement::WsdlElement(WsdlParser & w) 00096 :wParser_(w) 00097 { 00098 doc_=0; 00099 extElems_.clear(); 00100 extAttributes_.clear(); 00101 } 00102 00103 inline 00104 WsdlElement::~WsdlElement() 00105 { 00106 } 00107 00108 inline 00109 std::string 00110 WsdlElement::getName() const 00111 { 00112 return name_; 00113 } 00114 00115 inline 00116 const std::string 00117 WsdlElement::getDocumentation() const 00118 { 00119 if (doc_) 00120 return *doc_; 00121 else 00122 return std::string (); 00123 } 00124 00125 inline 00126 void 00127 WsdlElement::setName(std::string nam) 00128 { 00129 this->name_ = nam; 00130 } 00131 inline 00132 void 00133 WsdlElement::setDocumentation(std::string* s) 00134 { 00135 doc_=s; 00136 } 00137 00138 inline 00139 void 00140 WsdlElement::addExtElement(int id) 00141 { 00142 extElems_.push_back(id); 00143 } 00144 00145 inline 00146 void 00147 WsdlElement::addExtAttribute(int id) 00148 { 00149 extAttributes_.push_back(id); 00150 } 00151 } 00152 #endif /* */