AttributeGroup.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 AttributeGroup.h
22 
23  \brief It models a XML Schema attribute group.
24 */
25 
26 #ifndef __TERRALIB_XSD_INTERNAL_ATTRIBUTEGROUP_H
27 #define __TERRALIB_XSD_INTERNAL_ATTRIBUTEGROUP_H
28 
29 // TerraLib
30 #include "AbstractAttribute.h"
31 #include "Annotated.h"
32 #include "Identifiable.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 AnyAttribute;
43  class QName;
44 
45  /*!
46  \class Attribute
47 
48  \brief It models a XML Schema attribute group.
49 
50  An attribute group can be used to group a set of attribute declarations
51  to be incorporated as a group into a complex type definition.
52 
53  \note Parent elements: attributeGroup, complexType, schema, restriction (both simpleContent and complexContent), extension (both simpleContent and complexContent)
54  */
56  {
57  public:
58 
59  /*!
60  \brief Constructor.
61 
62  \param ann An annotation.
63  \param id It specifies a unique ID for the element.
64 
65  \note The AttributeGroup object will take the ownership of the annotation and id.
66  */
67  AttributeGroup(Annotation* ann = 0, std::string* id = 0);
68 
69  /*!
70  \brief Copy constructor.
71 
72  \param rhs Right-hand-side object.
73  */
74  AttributeGroup(const AttributeGroup& rhs);
75 
76  /*! \brief Destructor. */
77  ~AttributeGroup();
78 
79  /*!
80  \brief Assignment operator.
81 
82  \param rhs Right-hand-side object.
83 
84  \return A reference to this object.
85  */
86  AttributeGroup& operator=(const AttributeGroup& rhs);
87 
88  /*!
89  \brief It returns the name of the attribute group.
90 
91  \return The name of the attribute group.
92  */
93  std::string* getName() const;
94 
95  /*!
96  \brief It returns the reference to a named attribute element.
97 
98  \return The reference to a named attribute element.
99  */
100  QName* getRef() const;
101 
102  /*!
103  \brief It returns the anyAttribute defined on this attribute group element.
104 
105  \return The anyAttribute.
106  */
107  AnyAttribute* getAnyAttribute() const;
108 
109  /*!
110  \brief It sets a name for the attribute group.
111 
112  \param name The attribute group name.
113 
114  \note Setting a name will turn to NULL the reference property.
115  \note The AttributeGroup 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 named attribute.
121 
122  \param ref A reference to a named attribute.
123 
124  \note Setting a reference property will turn to NULL the name.
125  \note The AttributeGroup object will take the ownership of the given pointer.
126  */
127  void setRef(QName* ref);
128 
129  /*!
130  \brief It adds an attrbitue to this attribute group element.
131 
132  \param a The attribute that will be added.
133 
134  \note The AttributeGroup object will take the ownership of the given pointer.
135  */
136  void addAttribute(AbstractAttribute* a);
137 
138  /*!
139  \brief It sets the anyAttribute to this attribute group element.
140 
141  \param a It specifies the anyAttribute.
142 
143  \note The AttributeGroup object will take the ownership of the given pointer.
144  */
145  void setAnyAttribute(AnyAttribute* a);
146 
147  AbstractAttribute* clone() const;
148 
149  private:
150 
151  std::string* m_name; //!< It specifies a name for the attribute group. (Optional)
152  QName* m_ref; //!< It specifies a reference to a named attribute group. Name and ref attributes cannot both be present. (Optional)
153  boost::ptr_vector<AbstractAttribute> m_attributeVec; //!< The list of attributes, references or nested attribute groups. (Optional)
154  AnyAttribute* m_anyAttr; //!< It enables the author to extend the XML document with attributes not specified by the schema. (Optional)
155  };
156 
157  } // end namespace xsd
158 } // end namespace te
159 
160 #endif // __TERRALIB_XSD_INTERNAL_ATTRIBUTEGROUP_H
A base class for XSD classes that may allow annotation.
Definition: Annotated.h:49
A base class for XSD classes that may allow annotation.
QName * m_ref
It specifies a reference to a named attribute group. Name and ref attributes cannot both be present...
std::string * m_name
It specifies a name for the attribute group. (Optional)
This is the base class for XML Schema Attribute classes.
It models an XML anyAttribute element.
Definition: AnyAttribute.h:49
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
boost::ptr_vector< AbstractAttribute > m_attributeVec
The list of attributes, references or nested attribute groups. (Optional)
URI C++ Library.
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
A class that models a XSD annotation element.
Definition: Annotation.h:55
AnyAttribute * m_anyAttr
It enables the author to extend the XML document with attributes not specified by the schema...