All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ComplexType.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib 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
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file ComplexType.cpp
22 
23  \brief It models a XML Schema Complex Type definition.
24 */
25 
26 // TerraLib
27 #include "AbstractAttribute.h"
28 #include "AnyAttribute.h"
29 #include "ComplexContent.h"
30 #include "ComplexType.h"
31 #include "Content.h"
32 #include "SimpleContent.h"
33 
35  : Identifiable(id),
36  Annotated(ann),
37  m_name(0),
38  m_abstract(false),
39  m_mixed(false),
40  m_block(UNKNOWN),
41  m_final(UNKNOWN),
42  m_sContent(0),
43  m_cContent(0),
44  m_content(0),
45  m_anyAttr(0)
46 {
47 }
48 
50  : Identifiable(rhs),
51  Annotated(rhs),
52  m_name(0),
53  m_abstract(false),
54  m_mixed(false),
55  m_block(UNKNOWN),
56  m_final(UNKNOWN),
57  m_sContent(0),
58  m_cContent(0),
59  m_content(0),
60  m_anyAttr(0)
61 {
62 }
63 
65 {
66  delete m_name;
67  delete m_sContent;
68  delete m_cContent;
69  delete m_content;
70  delete m_anyAttr;
71 }
72 
74 {
75  return *this;
76 }
77 
78 std::string* te::xsd::ComplexType::getName() const
79 {
80  return m_name;
81 }
82 
84 {
85  return m_abstract;
86 }
87 
89 {
90  return m_mixed;
91 }
92 
94 {
95  return m_block;
96 }
97 
99 {
100  return m_final;
101 }
102 
104 {
105  return m_sContent;
106 }
107 
109 {
110  return m_cContent;
111 }
112 
114 {
115  return m_content;
116 }
117 
118 const boost::ptr_vector<te::xsd::AbstractAttribute>& te::xsd::ComplexType::getAttributes() const
119 {
120  return m_attributeVec;
121 }
122 
124 {
125  return m_anyAttr;
126 }
127 
128 void te::xsd::ComplexType::setName(std::string* name)
129 {
130  delete m_name;
131  m_name = name;
132 }
133 
135 {
136  m_abstract = v;
137 }
138 
140 {
141  m_mixed = v;
142 }
143 
145 {
146  m_block = v;
147 }
148 
150 {
151  m_final = v;
152 }
153 
155 {
156  delete m_sContent;
157  m_sContent = sc;
158 
159  // Clears mutually exclusive members
160  delete m_cContent;
161  m_cContent = 0;
162 
163  delete m_content;
164  m_content = 0;
165 
166  m_attributeVec.clear();
167 
168  delete m_anyAttr;
169  m_anyAttr = 0;
170 }
171 
173 {
174  delete m_cContent;
175  m_cContent = cc;
176 
177  // Clears mutually exclusive members
178  delete m_sContent;
179  m_sContent = 0;
180 
181  delete m_content;
182  m_content = 0;
183 
184  m_attributeVec.clear();
185 
186  delete m_anyAttr;
187  m_anyAttr = 0;
188 }
189 
191 {
192  delete m_content;
193  m_content = c;
194 
195  // Clears mutually exclusive members
196  delete m_sContent;
197  m_sContent = 0;
198 
199  delete m_cContent;
200  m_cContent = 0;
201 }
202 
204 {
205  // Clears mutually exclusive members
206  delete m_sContent;
207  m_sContent = 0;
208 
209  delete m_cContent;
210  m_cContent = 0;
211 
212  m_attributeVec.push_back(a);
213 }
214 
216 {
217  delete m_anyAttr;
218  m_anyAttr = a;
219 
220  // Clears mutually exclusive members
221  delete m_sContent;
222  m_sContent = 0;
223 
224  delete m_cContent;
225  m_cContent = 0;
226 }
227 
229 {
230  return new ComplexType(*this);
231 }
ComplexType & operator=(const ComplexType &rhs)
Assignment operator.
Definition: ComplexType.cpp:73
std::string * getName() const
It returns the element name or NULL if it doesn't have one.
Definition: ComplexType.cpp:78
void addAttribute(AbstractAttribute *a)
It adds an attribute to this ComplexType.
It models an XML Schema complexContent element.
void setAnyAttribute(AnyAttribute *a)
It sets the anyAttribute to this ComplexType.
~ComplexType()
Destructor.
Definition: ComplexType.cpp:64
A base class for XSD classes that may allow annotation.
Definition: Annotated.h:49
It models an XML Schema complexContent element.
int getBlock()
It returns the block value for the CompleType.
Definition: ComplexType.cpp:93
void setComplexContent(ComplexContent *cc)
It sets the ComplexContent to this ComplexType.
void setBlock(int v)
It prevents an element with a specified type of derivation from being used in place of this element...
void setFinal(int v)
It sets the default value of the final attribute on the element element.
A base class for elements that are not definitions nor declarations. This class is just for creating ...
Definition: Content.h:43
SimpleContent * getSimpleContent() const
It returns the SimpleContent of this ComplexType.
AnyAttribute * getAnyAttribute() const
It returns the anyAttribute defined on this ComplexType.
void setAsAbstract(bool v)
It specifies whether the element can be used in an instance of the document.
A base class for elements that are not definitions nor declarations. This class is just for creating ...
void setSimpleContent(SimpleContent *sc)
It sets the SimpleContent to this ComplexType.
This is the base class for XML Schema Attribute classes.
It models an XML anyAttribute element.
Definition: AnyAttribute.h:49
This is the base class for XML Schema Attribute classes.
It models a XML Schema Complex Type definition.
It models a XML Schema Complex Type definition.
Definition: ComplexType.h:56
A base class for XSD classes that must provide a unique ID property.
Definition: Identifiable.h:46
void setName(std::string *name)
It sets the element name.
It models an XML anyAttribute element.
Type * clone() const
ComplexType(Annotation *ann=0, std::string *id=0)
Constructor.
Definition: ComplexType.cpp:34
bool isAbstract()
If the CompleType is "abstract" or not.
Definition: ComplexType.cpp:83
bool isMixed()
If the CompleType is "mixed" or not.
Definition: ComplexType.cpp:88
Content * getContent()
It returns the content element of this ComplexType.
A class that models an XML Schema simpleContent element.
Definition: SimpleContent.h:50
const boost::ptr_vector< AbstractAttribute > & getAttributes() const
It returns the list of attributes of this ComplexType.
A class that models an XML Schema simpleContent element.
ComplexContent * getComplexContent() const
It returns the ComplexContent of this ComplexType.
void setContent(Content *c)
It sets the ComplexType content. It can be one of: group | all | choice | sequence.
A class that models a XSD annotation element.
Definition: Annotation.h:55
void setAsMixed(bool v)
It specifies whether character data is allowed to appear between the child elements of this complexTy...
int getFinal()
It returns the final value for the CompleType.
Definition: ComplexType.cpp:98
An abstract class for modeling the definition of a new XML Schema Type.
Definition: Type.h:65