wsdlpull  1.23
PortType.h
Go to the documentation of this file.
1 /*
2  * wsdlpull - A C++ parser for WSDL (Web services description language)
3  * Copyright (C) 2005-2007 Vivek Krishna
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  *
20  */
21 #ifndef _PORTTYPEH
22 #define _PORTTYPEH
23 
24 #include "wsdlparser/Operation.h"
25 #include "wsdlparser/Binding.h"
27 
28 namespace WsdlPull {
29 //This class implements a port type of WSDL .
31 {
32  public:
33  typedef std::list<PortType*>::iterator PortTypeIterator;
34  typedef std::list<PortType*>::const_iterator cPortTypeIterator;
35 
36  PortType(WsdlParser& w);
37  ~PortType();
40 
41  int getNumOps(void) const;
42 
48  const Operation *getOperation(int index) const;
49 
55  const Operation *getOperation(const Qname & name) const;
56  int getOperationIndex(const Qname & name) const;
57 
63  bool getOperations(Operation::cOpIterator & start ,Operation::cOpIterator & finish)const;
64 
72  const Binding* binding(const std::string & nsp)const;
73 
75 
78  void addOp(Operation * op);
79  void setBinding(Binding* bn);
81  private:
82  std::vector<Operation *> ops_;
83  std::vector<const Binding *> bindings_;
84 };
85 
86 inline
88  :WsdlElement(w)
89 {
90  ops_.clear() ;
91 }
92 inline
94 {
95  for (size_t i = 0; i < ops_.size(); i++)
96  delete ops_[i];
97 
98 }
99 
100 inline
101 int
103 {
104  return ops_.size();
105 }
106 
107 inline
108 const Operation *
109 PortType::getOperation(int index) const
110 {
111  return ops_[index];
112 }
113 
114 inline
115 int
117 {
118  for (size_t i = 0; i < ops_.size(); i++)
119  {
120  if (ops_[i]->getName() == name.getLocalName())
121  return i;
122  }
123  return 0;
124 }
125 
126 inline
127 const Operation *
128 PortType::getOperation(const Qname & name) const
129 {
130  for (size_t i = 0; i < ops_.size(); i++)
131  {
132  if (ops_[i]->getName() == name.getLocalName())
133  return ops_[i];
134  }
135  return 0;
136 }
137 
138 inline
139 bool
141  Operation::cOpIterator & finish)const
142 {
143  start=ops_.begin();
144  finish=ops_.end();
145  return true;
146 }
147 
148 
149 inline
150 void
152 {
153  ops_.push_back(op);
154 }
155 
156 inline
157 void
159 {
160  bindings_.push_back(bn);
161 }
162 
163 inline
164 const Binding*
165 PortType::binding(const std::string & nsp)const
166 {
167  for (unsigned int i = 0; i<bindings_.size();i++){
168  if (bindings_[i]->getBindingMethod() == nsp)
169  return bindings_[i];
170  }
171  return 0;
172 }
173 }
174 #endif /* */
Definition: Qname.h:31
std::string getLocalName(void) const
Definition: Qname.h:76
std::vector< Operation * >::const_iterator cOpIterator
Definition: Operation.h:57
const Binding * binding(const std::string &nsp) const
Definition: PortType.h:165
std::list< PortType * >::iterator PortTypeIterator
Definition: PortType.h:33
PortType(WsdlParser &w)
Definition: PortType.h:87
const Operation * getOperation(int index) const
Definition: PortType.h:109
int getOperationIndex(const Qname &name) const
Definition: PortType.h:116
void addOp(Operation *op)
Definition: PortType.h:151
std::list< PortType * >::const_iterator cPortTypeIterator
Definition: PortType.h:34
bool getOperations(Operation::cOpIterator &start, Operation::cOpIterator &finish) const
Definition: PortType.h:140
int getNumOps(void) const
Definition: PortType.h:102
void setBinding(Binding *bn)
Definition: PortType.h:158
std::string getName() const
Definition: WsdlElement.h:110
#define WSDLPULL_EXPORT