wsdlpull
1.23
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
src
schemaparser
ComplexType.cpp
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
22
#include "
schemaparser/ComplexType.h
"
23
24
namespace
Schema {
25
26
ComplexType::ComplexType
(
const
std::string & ns)
27
:
XSDType
(ns),
28
simpleContentTypeId_ (0),
29
cm_(0),
30
fwdElemRef_(false),
31
fwdAttrRef_(false)
32
{
33
34
setContentModel
(
Schema::Complex
);
35
}
36
37
void
38
ComplexType::addAttribute
(
const
Attribute
& a,
39
bool
ref)
40
{
41
fwdAttrRef_=ref;
42
43
Attribute
*at= (
Attribute
*)
getAttribute
(a.
getName
());
44
if
(at){
45
*at=a;
46
}
else
{
47
attList_.push_back(a);
48
}
49
}
50
51
52
void
53
ComplexType::addAttributeGroupName
(
const
Qname
& qn)
54
{
55
//TODO
56
//store the attribute group and add all attributes later
57
//by calling addAttribute()
58
}
59
60
void
61
ComplexType::matchElementRef
(
const
std::string & name,
Element
& e)
62
{
63
if
(cm_) {
64
cm_->
matchforwardRef
(name,e);
65
}
66
}
67
68
void
69
ComplexType::matchAttributeRef
(
const
std::string & nam,
70
Attribute
& a)
71
{
72
if
(fwdAttrRef_) {
73
Attribute
*at = (
Attribute
*)
getAttribute
(nam);
74
if
(at)
75
*at = a;
76
}
77
}
78
79
const
Attribute
*
80
ComplexType::getAttribute
(
const
std::string & nam)
const
81
{
82
std::list < Attribute >::const_iterator pAttr = attList_.begin();
83
while
(pAttr != attList_.end())
84
{
85
if
(pAttr->getName() == nam)
86
return
&(*pAttr);
87
pAttr++;
88
}
89
return
0;
90
}
91
92
93
void
ComplexType::error(std::string msg)
const
94
{
95
msg+=
"Complex Type "
+
getName
() +msg;
96
SchemaParserException
spe(msg);
97
throw
spe;
98
return
;
99
}
100
101
const
Attribute *
102
ComplexType::getAttribute
(
int
index)
const
103
{
104
105
int
i=0;
106
for
(std::list<Attribute>::const_iterator ali=attList_.begin();
107
ali!=attList_.end();ali++,i++) {
108
if
(i==index)
109
return
&(*ali);
110
}
111
return
0;
112
113
}
114
}
Schema::ComplexType::ComplexType
ComplexType(const std::string &)
Definition:
ComplexType.cpp:26
Schema::ContentModel::matchforwardRef
void matchforwardRef(const std::string &name, Element &e)
Definition:
ContentModel.cpp:103
Schema::Attribute::getName
std::string getName() const
Definition:
Attribute.h:83
Schema::XSDType::getName
std::string getName() const
Definition:
XSDType.h:148
Qname
Definition:
Qname.h:30
Schema::ComplexType::getAttribute
const Attribute * getAttribute(const std::string &name) const
Definition:
ComplexType.cpp:80
ComplexType.h
Schema::SchemaParserException
Definition:
SchemaParserException.h:28
Schema::XSDType::setContentModel
virtual void setContentModel(Schema::ContentModelType)
Definition:
XSDType.h:229
Schema::ComplexType::matchAttributeRef
void matchAttributeRef(const std::string &name, Attribute &a)
Definition:
ComplexType.cpp:69
Schema::Attribute
Definition:
Attribute.h:27
Schema::XSDType
Definition:
XSDType.h:37
Schema::ComplexType::addAttributeGroupName
void addAttributeGroupName(const Qname &qn)
Definition:
ComplexType.cpp:53
Schema::ComplexType::addAttribute
void addAttribute(const Attribute &a, bool fwdRef=false)
Definition:
ComplexType.cpp:38
Schema::ComplexType::matchElementRef
void matchElementRef(const std::string &name, Element &e)
Definition:
ComplexType.cpp:61
Schema::Element
Definition:
Element.h:30
Schema::Complex
Definition:
Schema.h:47
Generated by
1.8.7