Union.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 Union.h
22 
23  \brief It defines a simple type as a collection (union) of values from specified simple data types.
24 */
25 
26 #ifndef __TERRALIB_XSD_INTERNAL_UNION_H
27 #define __TERRALIB_XSD_INTERNAL_UNION_H
28 
29 // TerraLib
30 #include "SimpleTypeConstructor.h"
31 
32 // Boost
33 #include <boost/ptr_container/ptr_vector.hpp>
34 
35 namespace te
36 {
37  namespace xsd
38  {
39 // Forward declarations
40  class QName;
41  class SimpleType;
42 
43  /*!
44  \class Union
45 
46  \brief It defines a simple type as a collection (union) of values from specified simple data types.
47 
48  \note Parent elements: simpleType.
49  */
51  {
52  public:
53 
54  /*!
55  \brief Constructor.
56 
57  \param ann An annotation.
58  \param id It specifies a unique ID for the element.
59 
60  \note The Union object will take the ownership of the given pointers.
61  */
62  Union(Annotation* ann = 0, std::string* id = 0);
63 
64  /*!
65  \brief Copy constructor.
66 
67  \param rhs Right-hand-side object.
68  */
69  Union(const Union& rhs);
70 
71  /*! \brief Destructor. */
72  ~Union();
73 
74  /*!
75  \brief Assignment operator.
76 
77  \param rhs Right-hand-side object.
78 
79  \return A reference to this object.
80  */
81  Union& operator=(const Union& rhs);
82 
83  /*!
84  \brief It returns the list of member types.
85 
86  \return The list list of member types.
87  */
88  const boost::ptr_vector<QName>& getMemberTypes() const;
89 
90  /*!
91  \brief It returns the list of simple types defined on this union element.
92 
93  \return The the list of simple types defined on this union element.
94  */
95  const boost::ptr_vector<SimpleType>& getSimpleTypes() const;
96 
97  /*!
98  \brief It adds a member type to this Union element.
99 
100  \param name The name of a built-in data type or simpleType element defined in this or another schema.
101 
102  \note The Union object will take the ownership of the given pointer.
103  */
104  void addMemberType(QName* name);
105 
106  /*!
107  \brief It adds an internal simple type element to this Union element.
108 
109  \param a The simple type that will be added.
110 
111  \note The Union object will take the ownership of the given pointer.
112  */
113  void addSimpleType(SimpleType* a);
114 
115  SimpleTypeConstructor* clone() const;
116 
117  private:
118 
119  boost::ptr_vector<QName> m_memberTypeVec; //!< It specifies a list of built-in data types or simpleType elements defined in a schema. (Optional)
120  boost::ptr_vector<SimpleType> m_internalSimpleTypeVec; //!< Used when the union has internal simple types.
121  };
122 
123  } // end namespace xsd
124 } // end namespace te
125 
126 #endif // __TERRALIB_XSD_INTERNAL_UNION_H
boost::ptr_vector< SimpleType > m_internalSimpleTypeVec
Used when the union has internal simple types.
Definition: Union.h:120
A base class for SympleType elements. List, Union and Restriction4SimpleType is derived from this bas...
boost::ptr_vector< QName > m_memberTypeVec
It specifies a list of built-in data types or simpleType elements defined in a schema. (Optional)
Definition: Union.h:119
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
It defines a simple type as a collection (union) of values from specified simple data types...
Definition: Union.h:50
A class that models a XSD annotation element.
Definition: Annotation.h:55
It models a XML Schema SimpleType element.
Definition: SimpleType.h:54