wsdlpull 1.23
Loading...
Searching...
No Matches
ComplexType.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#ifndef _COMPLEXTYPEH
21#define _COMPLEXTYPEH
22
23#include <list>
25#include "xmlpull/Qname.h"
26#include "xmlpull/XmlUtils.h"
31
32namespace Schema {
33
35{
36 public:
37
38 ComplexType(const std::string& );
40
41 /*
42 * Various getter methods
43 */
44
45 //virtual function ,always return false for complex types
46 bool isSimple() const;
47
48 //returns the content type for complex types whose content model is SIMPLE
49 int getContentType() const;
50
51 //returns the number of attributes ,indices start from 0 to n-1
52 int getNumAttributes() const;
53
54 //gets the id of the attribute at the position "index"
55 int getAttributeType(int index);
56
57 //gets the NCName of the attribute
58 std::string getAttributeName(int index)const;
59
60 //returns the content model structure
62
63 //returns a pointer to the attribute
64 const Attribute *getAttribute(const std::string & name)const;
65
66 const Attribute *getAttribute(int index)const;
67 //returns the list of attributes
68 std::list < Attribute > & pAttributeList() ;
69
70 /*
71 * Various setter methods
72 */
73
74 void setSimpleContentType(int id);
75
76 void setContents(ContentModel* ct);
77
78 void addAttribute(const Attribute &a,
79 bool fwdRef=false);
80 //forward reference to attributeGroup
81 void addAttributeGroupName(const Qname & qn);
82
83 void matchAttributeRef(const std::string & name, Attribute & a);
84 void matchElementRef(const std::string & name, Element & e);
85 bool checkOccurrences(void);
86 void resetCounters(void);
87
88
89#ifdef LOGGING
90 void print(std::ostream & out);
91#endif
92
93 private:
94 std::list < Attribute > attList_;
95 int simpleContentTypeId_; //for simple content
96 ContentModel* cm_;
97 void error(std::string msg) const;
98 bool fwdElemRef_, fwdAttrRef_;
99};
100
101
102inline
103int
105{
106 return simpleContentTypeId_;
107}
108
109inline
110bool
112{
113 return false;
114}
115
116inline
117int
119{
120 return attList_.size();
121}
122
123inline
124int
126{
127 return getAttribute(index)->getType();
128}
129
130inline
131std::string
133{
134 return getAttribute(index)->getName();
135}
136
137inline
138std::list < Attribute > &
140{
141 return attList_;
142}
143
144
145inline
146void
148{
149 simpleContentTypeId_ = id;
150}
151
152
153inline
156{
157 return cm_;
158
159}
160
161inline
162void
164{
165 cm_=ct;
166}
167
168
169inline
171{
172 if(cm_)
173 delete cm_;
174}
175}
176#endif /* */
Definition Qname.h:31
int getType() const
Definition Attribute.h:90
std::string getName() const
Definition Attribute.h:83
void matchAttributeRef(const std::string &name, Attribute &a)
std::list< Attribute > & pAttributeList()
ComplexType(const std::string &)
int getAttributeType(int index)
ContentModel * getContents() const
void resetCounters(void)
void setSimpleContentType(int id)
void addAttributeGroupName(const Qname &qn)
void addAttribute(const Attribute &a, bool fwdRef=false)
bool isSimple() const
int getNumAttributes() const
bool checkOccurrences(void)
void matchElementRef(const std::string &name, Element &e)
std::string getAttributeName(int index) const
void setContents(ContentModel *ct)
const Attribute * getAttribute(const std::string &name) const
int getContentType() const
XSDType(const std::string &ns)
Definition XSDType.h:125
#define WSDLPULL_EXPORT