Group.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 Group.h
22 
23  \brief This class models a group element in a XML Schema.
24 */
25 
26 #ifndef __TERRALIB_XSD_INTERNAL_GROUP_H
27 #define __TERRALIB_XSD_INTERNAL_GROUP_H
28 
29 // TerraLib
30 #include "Annotated.h"
31 #include "Content.h"
32 #include "Identifiable.h"
33 #include "Occurs.h"
34 
35 namespace te
36 {
37  namespace xsd
38  {
39 // Forward declarations
40  class Content;
41  class QName;
42 
43  /*!
44  \class Group
45 
46  \brief This class models a group element in a XML Schema.
47 
48  The group element is used to define a group of elements to be used in complex type definitions.
49 
50  \note Parent elements: schema, choice, sequence, complexType, restriction (both simpleContent and complexContent), extension (both simpleContent and complexContent).
51  */
52  class TEXSDEXPORT Group : public Content, public Occurs, public Identifiable, public Annotated
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 minOccurs The minimum number of times the element can occur.
61  \param maxOccurs The maximum number of times the element can occur.
62  */
63  Group(unsigned int minOccurs = 1, unsigned int maxOccurs = 1, Annotation* ann = 0, std::string* id = 0);
64 
65  /*!
66  \brief Copy constructor.
67 
68  \param rhs Right-hand-side object.
69 
70  \todo Implement this method!
71  */
72  Group(const Group& rhs);
73 
74  /*! \brief Destructor. */
75  ~Group();
76 
77  /*!
78  \brief Assignment operator.
79 
80  \param rhs Right-hand-side object.
81 
82  \return A reference to this object.
83 
84  \todo Implement this method!
85  */
86  Group& operator=(const Group& rhs);
87 
88  /*!
89  \brief It returns the name of the group.
90 
91  \return The name of the group.
92  */
93  std::string* getName() const;
94 
95  /*!
96  \brief It returns the reference to a name of another group.
97 
98  \return The reference to a name of another group.
99  */
100  QName* getRef() const;
101 
102  /*!
103  \brief It returns the content of this group.
104 
105  \return The content of this group.
106  */
107  Content* getContent() const;
108 
109  /*!
110  \brief It sets a name for the group.
111 
112  \param name The group name.
113 
114  \note Setting a name will turn to NULL the reference property.
115  \note The Group object will take the ownership of the given pointer.
116  */
117  void setName(std::string* name);
118 
119  /*!
120  \brief It sets a reference to a name of another group.
121 
122  \param ref A reference to a name of another group.
123 
124  \note Setting a reference property will turn to NULL the name.
125  \note The Group object will take the ownership of the given pointer.
126  */
127  void setRef(QName* ref);
128 
129  /*!
130  \brief It sets the group content. It can be one of: all | choice | sequence.
131 
132  \param c The appropriate content to group.
133 
134  \note The Group object will take the ownership of the given pointer.
135  */
136  void setContent(Content* c);
137 
138  Content* clone() const;
139 
140  private:
141 
142  std::string* m_name; //!< It specifies a name for the group. (Optional)
143  QName* m_ref; //!< It refers to the name of another group. Name and ref attributes cannot both be present.
144  Content* m_content; //!< It can be one of: all | choice | sequence. (Optional)
145  };
146 
147  } // end namespace xsd
148 } // end namespace te
149 
150 #endif // __TERRALIB_XSD_INTERNAL_GROUP_H
A base class for XSD classes that may allow annotation.
Definition: Annotated.h:49
A base class for XSD classes that have occurs attributes.
Definition: Occurs.h:43
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
QName * m_ref
It refers to the name of another group. Name and ref attributes cannot both be present.
Definition: Group.h:143
A base class for elements that are not definitions nor declarations. This class is just for creating ...
A base class for XSD classes that must provide a unique ID property.
Definition: Identifiable.h:46
URI C++ Library.
A base class for XSD classes that have occurs attributes.
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
A class to be used to represent XML qualified names.
Definition: QName.h:49
std::string * m_name
It specifies a name for the group. (Optional)
Definition: Group.h:142
A class that models a XSD annotation element.
Definition: Annotation.h:55
Content * m_content
It can be one of: all | choice | sequence. (Optional)
Definition: Group.h:144
This class models a group element in a XML Schema.
Definition: Group.h:52