SimpleType.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 SimpleType.h
22 
23  \brief It models a XML Schema SimpleType element.
24 */
25 
26 #ifndef __TERRALIB_XSD_INTERNAL_SIMPLETYPE_H
27 #define __TERRALIB_XSD_INTERNAL_SIMPLETYPE_H
28 
29 // TerraLib
30 #include "Annotated.h"
31 #include "Identifiable.h"
32 #include "Type.h"
33 
34 // STL
35 #include <string>
36 
37 namespace te
38 {
39  namespace xsd
40  {
41 // Forward declarations
42  class SimpleTypeConstructor;
43 
44  /*!
45  \class SimpleType
46 
47  \brief It models a XML Schema SimpleType element.
48 
49  The simpleType element defines a simple type and specifies the constraints and information about
50  the values of attributes or text-only elements.
51 
52  \sa Annotated, Identifiable
53  */
54  class TEXSDEXPORT SimpleType : public Type, public Identifiable, public Annotated
55  {
56  public:
57 
58  /*!
59  \brief Constructor.
60 
61  \param ann An annotation.
62  \param id It specifies a unique ID for the element.
63 
64  \note The SimpleType object will take the ownership of the annotation and id.
65  */
66  SimpleType(Annotation* ann = 0, std::string* id = 0);
67 
68  /*!
69  \brief Copy constructor.
70 
71  \param rhs Right-hand-side object.
72  */
73  SimpleType(const SimpleType& rhs);
74 
75  /*! \brief Destructor. */
76  ~SimpleType();
77 
78  /*!
79  \brief Assignment operator.
80 
81  \param rhs Right-hand-side object.
82 
83  \return A reference to this object.
84  */
85  SimpleType& operator=(const SimpleType& rhs);
86 
87  /*!
88  \brief It returns the name of the element.
89 
90  \return The name of the element.
91  */
92  std::string* getName() const;
93 
94  /*!
95  \brief It returns the constructor of the element.
96 
97  \return The constructor of the element - (restriction | list | union).
98  */
99  SimpleTypeConstructor* getConstructor() const;
100 
101  /*!
102  \brief It sets the name of the element.
103 
104  \param name It specifies the element name.
105 
106  \note The SimpleType object will take the ownership of the given pointer.
107  */
108  void setName(std::string* name);
109 
110  /*!
111  \brief It sets the constructor of the element.
112 
113  \param c It specifies the constructor of the element.
114 
115  \note The SimpleType object will take the ownership of the given pointer.
116  */
117  void setConstructor(SimpleTypeConstructor* c);
118 
119  Type* clone() const;
120 
121  private:
122 
123  std::string* m_name; //!< It specifies a name for the element. Required if the simpleType element is a child of the schema element, otherwise it is not allowed.
124  SimpleTypeConstructor* m_constructor; //!< restriction | list | union.
125  };
126 
127  } // end namespace xsd
128 } // end namespace te
129 
130 #endif // __TERRALIB_XSD_INTERNAL_SIMPLETYPE_H
An abstract class for modeling the definition of a new XML Schema Type.
A base class for XSD classes that may allow annotation.
Definition: Annotated.h:49
A base class for XSD classes that may allow annotation.
std::string * m_name
It specifies a name for the element. Required if the simpleType element is a child of the schema elem...
Definition: SimpleType.h:123
A base class for SympleType elements. List, Union and Restriction4SimpleType is derived from this bas...
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 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
SimpleTypeConstructor * m_constructor
restriction | list | union.
Definition: SimpleType.h:124
A class that models a XSD annotation element.
Definition: Annotation.h:55
It models a XML Schema SimpleType element.
Definition: SimpleType.h:54
An abstract class for modeling the definition of a new XML Schema Type.
Definition: Type.h:65