All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Group.cpp
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.cpp
22 
23  \brief This class models a group element in a XML Schema.
24 */
25 
26 // TerraLib
27 #include "Content.h"
28 #include "Group.h"
29 #include "QName.h"
30 
31 te::xsd::Group::Group(unsigned int minOccurs, unsigned int maxOccurs, Annotation* ann, std::string* id)
32  : Occurs(minOccurs, maxOccurs),
33  Identifiable(id),
34  Annotated(ann),
35  m_name(0),
36  m_ref(0),
37  m_content(0)
38 {
39 }
40 
42  : Occurs(rhs),
43  Identifiable(rhs),
44  Annotated(rhs),
45  m_name(0),
46  m_ref(0),
47  m_content(0)
48 {
49 }
50 
52 {
53  delete m_name;
54  delete m_ref;
55  delete m_content;
56 }
57 
59 {
60  return *this;
61 }
62 
63 std::string* te::xsd::Group::getName() const
64 {
65  return m_name;
66 }
67 
69 {
70  return m_ref;
71 }
72 
74 {
75  return m_content;
76 }
77 
78 void te::xsd::Group::setName(std::string* name)
79 {
80  delete m_name;
81  m_name = name;
82 
83  delete m_ref;
84  m_ref = 0;
85 }
86 
88 {
89  delete m_ref;
90  m_ref = ref;
91 
92  delete m_name;
93  m_name = 0;
94 }
95 
97 {
98  delete m_content;
99  m_content = c;
100 }
101 
103 {
104  return new Group(*this);
105 }
void setRef(QName *ref)
It sets a reference to a name of another group.
Definition: Group.cpp:87
A base class for XSD classes that may allow annotation.
Definition: Annotated.h:49
This class models a group element in a XML Schema.
A base class for XSD classes that have occurs attributes.
Definition: Occurs.h:43
void setContent(Content *c)
It sets the group content. It can be one of: all | choice | sequence.
Definition: Group.cpp:96
Content * getContent() const
It returns the content of this group.
Definition: Group.cpp:73
std::string * getName() const
It returns the name of the group.
Definition: Group.cpp:63
A base class for elements that are not definitions nor declarations. This class is just for creating ...
Definition: Content.h:43
A class to deal with XML qualified names.
A base class for elements that are not definitions nor declarations. This class is just for creating ...
Group & operator=(const Group &rhs)
Assignment operator.
Definition: Group.cpp:58
A base class for XSD classes that must provide a unique ID property.
Definition: Identifiable.h:46
void setName(std::string *name)
It sets a name for the group.
Definition: Group.cpp:78
~Group()
Destructor.
Definition: Group.cpp:51
A class to be used to represent XML qualified names.
Definition: QName.h:49
Content * clone() const
Definition: Group.cpp:102
QName * getRef() const
It returns the reference to a name of another group.
Definition: Group.cpp:68
A class that models a XSD annotation element.
Definition: Annotation.h:55
Group(unsigned int minOccurs=1, unsigned int maxOccurs=1, Annotation *ann=0, std::string *id=0)
Constructor.
Definition: Group.cpp:31
This class models a group element in a XML Schema.
Definition: Group.h:52