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 <wsdlparser/Wsdl.h> 00030 00031 //Implementation of a Wsdl element 00032 //This is the base class of all wsdl elements 00033 using namespace Wsdl; 00034 class WsdlParser; 00035 00036 class WsdlElement 00037 { 00038 public: 00039 00040 WsdlElement(WsdlParser& w); 00041 virtual ~WsdlElement(); 00044 00049 std::string getName() const; 00050 00055 const std::string getDocumentation() const; 00056 00065 bool getExtensibilityElements(const std::string & namespc, 00066 std::vector<int>& ids); 00067 00068 bool getExtensibilityAttributes(const std::string & namespc, 00069 std::vector<int>& ids); 00070 00072 00075 void setName(std::string nam); 00076 void addExtElement(int ident); 00077 void addExtAttribute(int ident); 00078 void setDocumentation(std::string* s); 00080 00081 virtual void print(ostream & out); 00082 protected: 00083 std::string name_; 00084 int id_; 00085 std::vector<int> extElems_; 00086 std::vector<int> extAttributes_; 00087 std::string * doc_; 00088 protected: 00089 WsdlParser & wParser_; 00090 }; 00091 00092 inline 00093 WsdlElement::WsdlElement(WsdlParser & w) 00094 :wParser_(w) 00095 { 00096 doc_=0; 00097 extElems_.clear(); 00098 extAttributes_.clear(); 00099 } 00100 00101 inline 00102 WsdlElement::~WsdlElement() 00103 { 00104 }; 00105 00106 inline 00107 std::string 00108 WsdlElement::getName() const 00109 { 00110 return name_; 00111 } 00112 00113 inline 00114 const std::string 00115 WsdlElement::getDocumentation() const 00116 { 00117 if (doc_) 00118 return *doc_; 00119 else 00120 return ""; 00121 } 00122 00123 inline 00124 void 00125 WsdlElement::setName(std::string nam) 00126 { 00127 this->name_ = nam; 00128 } 00129 inline 00130 void 00131 WsdlElement::setDocumentation(std::string* s) 00132 { 00133 doc_=s; 00134 } 00135 00136 inline 00137 void 00138 WsdlElement::addExtElement(int id) 00139 { 00140 extElems_.push_back(id); 00141 } 00142 00143 inline 00144 void 00145 WsdlElement::addExtAttribute(int id) 00146 { 00147 extAttributes_.push_back(id); 00148 } 00149 00150 #endif /* */