Restriction4SimpleContent.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 Restriction4SimpleContent.h
22 
23  \brief This restriction class defines restrictions on a simpleContent.
24 */
25 
26 #ifndef __TERRALIB_XSD_INTERNAL_RESTRICTION4SIMPLECONTENT_H
27 #define __TERRALIB_XSD_INTERNAL_RESTRICTION4SIMPLECONTENT_H
28 
29 // TerraLib
30 #include "Annotated.h"
31 #include "Enums.h"
32 #include "Identifiable.h"
33 #include "TypeDerivation.h"
34 
35 // Boost
36 #include <boost/ptr_container/ptr_vector.hpp>
37 
38 namespace te
39 {
40  namespace xsd
41  {
42 // Forward declarations
43  class AbstractAttribute;
44  class AnyAttribute;
45  class Facet;
46  class QName;
47  class SimpleType;
48 
49  /*!
50  \class Restriction4SimpleContent
51 
52  \brief This restriction class defines restrictions on a simpleContent.
53  */
55  {
56  public:
57 
58  /*!
59  \brief Constructor.
60 
61  \param id It specifies a unique ID for the element. It can be a NULL value.
62  \param base The name of a built-in data type simpleType element defined in a schema. It can not be a NULL value.
63 
64  \note The Restriction4SimpleContent object will take the ownership of the given pointers.
65  */
66  Restriction4SimpleContent(std::string* id, QName* base);
67 
68  /*!
69  \brief Copy constructor.
70 
71  \param rhs Right-hand-side object.
72 
73  \todo Implement!
74  */
76 
77  /*! \brief Destructor. */
79 
80  /*!
81  \brief Assignment operator.
82 
83  \param rhs Right-hand-side object.
84 
85  \return A reference to this object.
86 
87  \todo Implement!
88  */
90 
91  /*!
92  \brief It returns the name of a built-in data type, simple type or complex type that will be restricted.
93 
94  \return The name of a built-in data type, simple type or complex type that will be restricted.
95  */
96  QName* getBase() const;
97 
98  /*!
99  \brief It returns the list of facets defined on this restriction.
100 
101  \return The list of facets defined on this restriction.
102  */
103  const boost::ptr_vector<Facet>& getFacets() const;
104 
105  /*!
106  \brief It returns the list of attributes of this restriction.
107 
108  \return The list of attributes of this restriction.
109  */
110  const boost::ptr_vector<AbstractAttribute>& getAttributes() const;
111 
112  /*!
113  \brief It returns the anyAttribute defined on this restriction.
114 
115  \return The anyAttribute.
116  */
117  AnyAttribute* getAnyAttribute() const;
118 
119  /*!
120  \brief It sets the name of a built-in data type, simple type or complex type that will be restricted.
121 
122  \param base The name of a built-in data type, simple type or complex type that will be restricted.
123 
124  \note The Restriction4SimpleContent object will take the ownership of the given pointer.
125  */
126  void setBase(QName* base);
127 
128  /*!
129  \brief It sets the restriction internal simple type.
130 
131  \param simpleType The restriction internal simple type.
132 
133  \note The Restriction4SimpleContent object will take the ownership of the given pointer.
134  */
135  void setSimpleType(SimpleType* simpleType);
136 
137  /*!
138  \brief Adds a new facet to this restriction.
139 
140  \param fType The facet type.
141  \param value The facet associated value.
142  */
143  void addFacet(FacetType fType, const std::string& value);
144 
145  /*!
146  \brief Adds a new facet to this restriction.
147 
148  \param f The facet that will be added.
149 
150  \note The Restriction4SimpleContent object will take the ownership of the given pointer.
151  */
152  void addFacet(Facet* f);
153 
154  /*!
155  \brief It adds an attribute to this restriction.
156 
157  \param a The attribute that will be added.
158 
159  \note The Restriction4SimpleContent object will take the ownership of the given pointer.
160  */
161  void addAttribute(AbstractAttribute* a);
162 
163  /*!
164  \brief It sets the anyAttribute to this restriction.
165 
166  \param a It specifies the anyAttribute.
167 
168  \note The Restriction4SimpleContent object will take the ownership of the given pointer.
169  */
170  void setAnyAttribute(AnyAttribute* a);
171 
172  // TODO
173  TypeDerivation* clone() const { return 0; }
174 
175  private:
176 
177  QName* m_base; //!< It specifies the name of a built-in data type, simpleType element or complexType element defined in this schema or another schema. (Required)
178  SimpleType* m_simpleType; //!< Optional.
179  boost::ptr_vector<Facet> m_facetVec; //!< The list of facets. (Optional)
180  boost::ptr_vector<AbstractAttribute> m_attributeVec; //!< The list of attributes (attributes and attributeGroups). (Optional)
181  AnyAttribute* m_anyAttr; //!< The anyAttribute element. (Optional)
182  };
183 
184  } // end namespace xsd
185 } // end namespace te
186 
187 #endif // __TERRALIB_XSD_INTERNAL_RESTRICTION4SIMPLECONTENT_H
188 
AnyAttribute * m_anyAttr
The anyAttribute element. (Optional)
A base class for XSD classes that may allow annotation.
Definition: Annotated.h:49
A base class for XSD classes that may allow annotation.
boost::ptr_vector< Facet > m_facetVec
The list of facets. (Optional)
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 restriction class defines restrictions on a simpleContent.
This is the base class for XML Schema Attribute classes.
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
boost::ptr_vector< AbstractAttribute > m_attributeVec
The list of attributes (attributes and attributeGroups). (Optional)
A class to be used to represent XML qualified names.
Definition: QName.h:49
QName * m_base
It specifies the name of a built-in data type, simpleType element or complexType element defined in t...
FacetType
It enumerates the available facet types.
Definition: Enums.h:91
This class can be used to model a facet (a constraint in the range of values).
Definition: Facet.h:45
It models a XML Schema SimpleType element.
Definition: SimpleType.h:54