All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List.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 // TerraLib
21 #include "List.h"
22 #include "QName.h"
23 #include "SimpleType.h"
24 
25 te::xsd::List::List(Annotation* ann, std::string* id)
26  : SimpleTypeConstructor(ann, id),
27  m_itemType(0),
28  m_internalSimpleType(0)
29 {
30 }
31 
34 {
35  m_itemType = rhs.m_itemType ? new QName(*rhs.m_itemType) : 0;
37 }
38 
40 {
41  delete m_itemType;
42  delete m_internalSimpleType;
43 }
44 
46 {
47  if(this != &rhs)
48  {
50 
51  delete m_itemType;
52 
53  m_itemType = rhs.m_itemType ? new QName(*rhs.m_itemType) : 0;
54 
55  delete m_internalSimpleType;
56 
57  m_internalSimpleType = rhs.m_internalSimpleType ? static_cast<SimpleType*>(rhs.m_internalSimpleType->clone()) : 0;
58  }
59 
60  return *this;
61 }
62 
64 {
65  return m_itemType;
66 }
67 
69 {
70  return m_internalSimpleType;
71 }
72 
74 {
75  delete m_internalSimpleType;
76  m_internalSimpleType = 0;
77 
78  delete m_itemType;
79  m_itemType = name;
80 }
81 
83 {
84  delete m_itemType;
85  m_itemType = 0;
86 
87  delete m_internalSimpleType;
88  m_internalSimpleType = a;
89 }
90 
92 {
93  return new List(*this);
94 }
List & operator=(const List &rhs)
Assignment operator.
Definition: List.cpp:45
~List()
Destructor.
Definition: List.cpp:39
It models a XML Schema SimpleType element.
A class to deal with XML qualified names.
SimpleTypeConstructor * clone() const
It creates a clone of the object.
Definition: List.cpp:91
SimpleType * getSimpleType() const
It returns list internal simple type.
Definition: List.cpp:68
It is used to define a simple type element as a list of values.
Definition: List.h:45
A base class for SympleType elements. List, Union and Restriction4SimpleType is derived from this bas...
List(Annotation *ann=0, std::string *id=0)
Constructor.
Definition: List.cpp:25
SimpleTypeConstructor & operator=(const SimpleTypeConstructor &rhs)
Assignment operator not allowed.
Type * clone() const
Definition: SimpleType.cpp:97
SimpleType * m_internalSimpleType
Used when the list has an internal simple type. (Optional if m_itemType is present) ...
Definition: List.h:117
It is used to define a simple type element as a list of values.
void setItemType(QName *name)
It sets the name of a built-in data type or simpleType element defined in this or another schema...
Definition: List.cpp:73
void setSimpleType(SimpleType *a)
It sets the list internal simple type.
Definition: List.cpp:82
QName * getItemType() const
It returns name of a built-in data type or simpleType element defined in this or another schema...
Definition: List.cpp:63
A class to be used to represent XML qualified names.
Definition: QName.h:49
QName * m_itemType
It specifies the name of a built-in data type or simpleType element defined in this or another schema...
Definition: List.h:116
A class that models a XSD annotation element.
Definition: Annotation.h:55
It models a XML Schema SimpleType element.
Definition: SimpleType.h:54