Extension.h
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.h
22 
23  \brief This class models an extension element that can be used to extend an existing simpleType or complexType element.
24 */
25 
26 #ifndef __TERRALIB_XSD_INTERNAL_EXTENSION_H
27 #define __TERRALIB_XSD_INTERNAL_EXTENSION_H
28 
29 // TerraLib
30 #include "Annotated.h"
31 #include "Identifiable.h"
32 #include "TypeDerivation.h"
33 
34 // Boost
35 #include <boost/ptr_container/ptr_vector.hpp>
36 
37 namespace te
38 {
39  namespace xsd
40  {
41 // Forward declarations
42  class AbstractAttribute;
43  class AnyAttribute;
44  class Content;
45  class QName;
46 
47  /*!
48  \class Extension
49 
50  \brief This class models an extension element that can be used to extend an existing simpleType or complexType element.
51  */
53  {
54  public:
55 
56  /*!
57  \brief Constructor.
58 
59  \param id It specifies a unique ID for the element. It can be a NULL value.
60  \param base It specifies the name of a built-in data type, a SimpleType element or a ComplexType element. It can not be a NULL value.
61  */
62  Extension(QName* base = 0, Annotation* ann = 0, std::string* id = 0);
63 
64  /*!
65  \brief Copy constructor.
66 
67  \param rhs Right-hand-side object.
68 
69  \todo Implement!
70  */
71  Extension(const Extension& rhs);
72 
73  /*! \brief Destructor. */
74  ~Extension();
75 
76  /*!
77  \brief Assignment operator.
78 
79  \param rhs Right-hand-side object.
80 
81  \return A reference to this object.
82 
83  \todo Implement!
84  */
85  Extension& operator=(const Extension& rhs);
86 
87  /*!
88  \brief It returns the name of a built-in data type, simple type or complex type that will be extended.
89 
90  \return The name of a built-in data type, simple type or complex type that will be extended.
91  */
92  QName* getBase() const;
93 
94  /*!
95  \brief It returns the content of Extension element.
96 
97  \return The content of this Extension element.
98  */
99  Content* getContent() const;
100 
101  /*!
102  \brief It returns the list of attributes of this Extension element.
103 
104  \return The list of attributes.
105  */
106  const boost::ptr_vector<AbstractAttribute>& getAttributes() const;
107 
108  /*!
109  \brief It returns the anyAttribute defined on this Extension element.
110 
111  \return The anyAttribute.
112  */
113  AnyAttribute* getAnyAttribute() const;
114 
115  /*!
116  \brief It sets the name of a built-in data type, simple type or complex type that will be extended.
117 
118  \param base The name of a built-in data type, simple type or complex type that will be extended.
119 
120  \note The Extension object will take the ownership of the given pointer.
121  */
122  void setBase(QName* base);
123 
124  /*!
125  \brief It sets the content of this Extension element. It can be one of: group | all | choice | sequence.
126 
127  \param c The appropriate content to Extension element.
128 
129  \note The Extension object will take the ownership of the given pointer.
130  */
131  void setContent(Content* c);
132 
133  /*!
134  \brief It adds an attribute to this Extension element.
135 
136  \param a The attribute that will be added.
137 
138  \note The Extension object will take the ownership of the given pointer.
139  */
140  void addAttribute(AbstractAttribute* a);
141 
142  /*!
143  \brief It sets the anyAttribute to Extension element.
144 
145  \param a It specifies the anyAttribute.
146 
147  \note The Extension object will take the ownership of the given pointer.
148  */
149  void setAnyAttribute(AnyAttribute* a);
150 
151  // TODO
152  TypeDerivation* clone() const { return 0; }
153 
154  private:
155 
156  QName* m_base; //!< It specifies the name of a built-in data type, a SimpleType element or a ComplexType element. (Required)
157  Content* m_content; //!< It can be: group | all | choice | sequence. (Optional)
158  boost::ptr_vector<AbstractAttribute> m_attributeVec; //!< The list of attributes (attributes and attributeGroups). (Optional)
159  AnyAttribute* m_anyAttr; //!< The anyAttribute element. (Optional)
160  };
161 
162  } // end namespace xsd
163 } // end namespace te
164 
165 #endif // __TERRALIB_XSD_INTERNAL_EXTENSION_H
QName * m_base
It specifies the name of a built-in data type, a SimpleType element or a ComplexType element...
Definition: Extension.h:156
AnyAttribute * m_anyAttr
The anyAttribute element. (Optional)
Definition: Extension.h:159
A base class for XSD classes that may allow annotation.
Definition: Annotated.h:49
A base class for XSD classes that may allow annotation.
A base class for elements that are not definitions nor declarations. This class is just for creating ...
Definition: Content.h:43
SimpleType, SimpleContent and ComplexContent can be used to extend other types. This is just a base c...
It models an XML anyAttribute element.
Definition: AnyAttribute.h:49
This is the base class for XML Schema Attribute classes.
Content * m_content
It can be: group | all | choice | sequence. (Optional)
Definition: Extension.h:157
A base class for XSD classes that must provide a unique ID property.
Definition: Identifiable.h:46
URI C++ Library.
SimpleType, SimpleContent and ComplexContent can be extend other types. This is just a base class for...
A base class for XSD classes that must provide a unique ID property.
#define TEXSDEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:57
This class models an extension element that can be used to extend an existing simpleType or complexTy...
Definition: Extension.h:52
A class to be used to represent XML qualified names.
Definition: QName.h:49
TypeDerivation * clone() const
Definition: Extension.h:152
boost::ptr_vector< AbstractAttribute > m_attributeVec
The list of attributes (attributes and attributeGroups). (Optional)
Definition: Extension.h:158
A class that models a XSD annotation element.
Definition: Annotation.h:55