Restriction4SimpleType.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 Lesser 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 Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser 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 Restriction4SimpleType.h
22 
23  \brief The restriction element defines restrictions on a simpleType definition.
24 */
25 
26 #ifndef __TERRALIB_XSD_INTERNAL_RESTRICTION4SIMPLETYPE_H
27 #define __TERRALIB_XSD_INTERNAL_RESTRICTION4SIMPLETYPE_H
28 
29 // TerraLib
30 #include "Enums.h"
31 #include "SimpleTypeConstructor.h"
32 
33 // Boost
34 #include <boost/ptr_container/ptr_vector.hpp>
35 
36 namespace te
37 {
38  namespace xsd
39  {
40 // Forward declarations
41  class Facet;
42  class QName;
43  class SimpleType;
44 
45  /*!
46  \class Restriction4SimpleType
47 
48  \brief The restriction element defines restrictions on a simpleType definition.
49 
50  \note Parent elements: simpleType.
51  */
53  {
54  public:
55 
56  /*!
57  \brief Constructor.
58 
59  \param base The name of a built-in data type simpleType element defined in a schema.
60  \param ann An annotation.
61  \param id It specifies a unique ID for the element.
62 
63  \note The List object will take the ownership of the given pointers.
64  */
65  Restriction4SimpleType(QName* base = 0, Annotation* ann = 0, std::string* id = 0);
66 
67  /*!
68  \brief Copy constructor.
69 
70  \param rhs Right-hand-side object.
71 
72  \todo need review!!!!!
73  */
75 
76  /*! \brief Destructor. */
78 
79  /*!
80  \brief Assignment operator.
81 
82  \param rhs Right-hand-side object.
83 
84  \return A reference to this object.
85 
86  \todo need review!!!!!
87  */
88  Restriction4SimpleType& operator=(const Restriction4SimpleType& rhs);
89 
90  /*!
91  \brief It returns the name of the built-in data type simpleType element that will be restricted.
92 
93  \return The name of the built-in data type simpleType element that will be restricted.
94  */
95  QName* getBase() const;
96 
97  /*!
98  \brief It returns the list of facets defined on this restriction.
99 
100  \return The list of facets defined on this restriction.
101  */
102  const boost::ptr_vector<Facet>& getFacets() const;
103 
104  /*!
105  \brief It sets the name of the built-in data type simpleType element that will be restricted.
106 
107  \param base The name of the built-in data type simpleType element that will be restricted.
108  */
109  void setBase(QName* base);
110 
111  /*!
112  \brief It sets the simpleType element that will be restricted.
113 
114  \param base The name of the built-in data type simpleType element that will be restricted.
115  */
116  void setSimpleType(SimpleType* simpleType);
117 
118  /*!
119  \brief Adds a new facet to this restriction.
120 
121  \param fType The facet type.
122  \param value The facet associated value.
123  */
124  void addFacet(FacetType fType, const std::string& value);
125 
126  /*!
127  \brief Adds a new facet to this restriction.
128 
129  \param f The facet that will be added.
130 
131  \note The Restriction4SimpleType object will take the ownership of the given pointer.
132  */
133  void addFacet(Facet* f);
134 
135  SimpleTypeConstructor* clone() const;
136 
137  private:
138 
139  QName* m_base; //!< It specifies the name of the built-in data type simpleType element that will be restricted. (Required)
140  SimpleType* m_simpleType; //!< Optional.
141  boost::ptr_vector<Facet> m_facetVec; //!< The list of facets. (Optional)
142  };
143 
144  } // end namespace xsd
145 } // end namespace te
146 
147 #endif // __TERRALIB_XSD_INTERNAL_RESTRICTION4SIMPLETYPE_H
boost::ptr_vector< Facet > m_facetVec
The list of facets. (Optional)
A base class for SympleType elements. List, Union and Restriction4SimpleType is derived from this bas...
URI C++ Library.
A base class for SimpleType elements. List, Union and Restriction4SimpleType is derived from this bas...
#define TEXSDEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:57
A class to be used to represent XML qualified names.
Definition: QName.h:49
FacetType
It enumerates the available facet types.
Definition: Enums.h:91
The restriction element defines restrictions on a simpleType definition.
This class can be used to model a facet (a constraint in the range of values).
Definition: Facet.h:45
A class that models a XSD annotation element.
Definition: Annotation.h:55
It models a XML Schema SimpleType element.
Definition: SimpleType.h:54
QName * m_base
It specifies the name of the built-in data type simpleType element that will be restricted. (Required)