All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Extension.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 Extension.cpp
22 
23  \brief This class models an extension element that can be used to extend an existing simpleType or complexType element.
24 */
25 
26 // TerraLib
27 #include "../common/STLUtils.h"
28 #include "AbstractAttribute.h"
29 #include "AnyAttribute.h"
30 #include "Content.h"
31 #include "Extension.h"
32 #include "QName.h"
33 
34 // STL
35 #include <cassert>
36 
37 te::xsd::Extension::Extension(QName* base, Annotation* ann, std::string* id)
38  : Identifiable(id),
39  Annotated(ann),
40  m_base(base),
41  m_content(0),
42  m_anyAttr(0)
43 {
44 }
45 
47  : Identifiable(rhs),
48  Annotated(rhs),
49  m_base(0),
50  m_content(0),
51  m_anyAttr(0)
52 {
53 }
54 
56 {
57  delete m_base;
58  delete m_content;
59  delete m_anyAttr;
60 }
61 
63 {
64  return *this;
65 }
66 
68 {
69  return m_base;
70 }
71 
73 {
74  return m_content;
75 }
76 
77 const boost::ptr_vector<te::xsd::AbstractAttribute>& te::xsd::Extension::getAttributes() const
78 {
79  return m_attributeVec;
80 }
81 
83 {
84  return m_anyAttr;
85 }
86 
88 {
89  delete m_base;
90  m_base = base;
91 }
92 
94 {
95  delete m_content;
96  m_content = c;
97 }
98 
100 {
101  m_attributeVec.push_back(a);
102 }
103 
105 {
106  delete m_anyAttr;
107  m_anyAttr = a;
108 }
This class models an extension element that can be used to extend an existing simpleType or complexTy...
A base class for XSD classes that may allow annotation.
Definition: Annotated.h:49
void setBase(QName *base)
It sets the name of a built-in data type, simple type or complex type that will be extended...
Definition: Extension.cpp:87
A base class for elements that are not definitions nor declarations. This class is just for creating ...
Definition: Content.h:43
A class to deal with XML qualified names.
A base class for elements that are not definitions nor declarations. This class is just for creating ...
~Extension()
Destructor.
Definition: Extension.cpp:55
This is the base class for XML Schema Attribute classes.
void addAttribute(AbstractAttribute *a)
It adds an attribute to this Extension element.
Definition: Extension.cpp:99
It models an XML anyAttribute element.
Definition: AnyAttribute.h:49
This is the base class for XML Schema Attribute classes.
Extension & operator=(const Extension &rhs)
Assignment operator.
Definition: Extension.cpp:62
A base class for XSD classes that must provide a unique ID property.
Definition: Identifiable.h:46
void setAnyAttribute(AnyAttribute *a)
It sets the anyAttribute to Extension element.
Definition: Extension.cpp:104
QName * getBase() const
It returns the name of a built-in data type, simple type or complex type that will be extended...
Definition: Extension.cpp:67
It models an XML anyAttribute element.
Content * getContent() const
It returns the content of Extension element.
Definition: Extension.cpp:72
Extension(QName *base=0, Annotation *ann=0, std::string *id=0)
Constructor.
Definition: Extension.cpp:37
This class models an extension element that can be used to extend an existing simpleType or complexTy...
Definition: Extension.h:52
void setContent(Content *c)
It sets the content of this Extension element. It can be one of: group | all | choice | sequence...
Definition: Extension.cpp:93
A class to be used to represent XML qualified names.
Definition: QName.h:49
const boost::ptr_vector< AbstractAttribute > & getAttributes() const
It returns the list of attributes of this Extension element.
Definition: Extension.cpp:77
A class that models a XSD annotation element.
Definition: Annotation.h:55
AnyAttribute * getAnyAttribute() const
It returns the anyAttribute defined on this Extension element.
Definition: Extension.cpp:82