All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimpleType.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2010-2012 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.cpp
22 
23  \brief It models a XML Schema SimpleType element.
24 */
25 
26 // TerraLib
27 #include "SimpleType.h"
28 #include "SimpleTypeConstructor.h"
29 
31  : Identifiable(id),
32  Annotated(ann),
33  m_name(0),
34  m_constructor(0)
35 {
36 }
37 
39  : Identifiable(rhs),
40  Annotated(rhs),
41  m_name(0),
42  m_constructor(0)
43 {
44  m_name = rhs.m_name ? new std::string(*rhs.m_name) : 0;
45 
47 }
48 
50 {
51  delete m_name;
52  delete m_constructor;
53 }
54 
56 {
57  if(this != &rhs)
58  {
60 
62 
63  delete m_name;
64 
65  m_name = rhs.m_name ? new std::string(*rhs.m_name) : 0;
66 
67  delete m_constructor;
68 
69  m_constructor = rhs.m_constructor ? rhs.m_constructor->clone() : 0;
70  }
71 
72  return *this;
73 }
74 
75 std::string* te::xsd::SimpleType::getName() const
76 {
77  return m_name;
78 }
79 
81 {
82  return m_constructor;
83 }
84 
85 void te::xsd::SimpleType::setName(std::string* name)
86 {
87  delete m_name;
88  m_name = name;
89 }
90 
92 {
93  delete m_constructor;
94  m_constructor = c;
95 }
96 
98 {
99  return new SimpleType(*this);
100 }
It models a XML Schema SimpleType element.
Definition: SimpleType.h:54
Type * clone() const
Definition: SimpleType.cpp:97
An abstract class for modeling the definition of a new XML Schema Type.
Definition: Type.h:65
SimpleTypeConstructor * m_constructor
restriction | list | union.
Definition: SimpleType.h:124
void setConstructor(SimpleTypeConstructor *c)
It sets the constructor of the element.
Definition: SimpleType.cpp:91
A base class for SimpleType elements. List, Union and Restriction4SimpleType is derived from this bas...
std::string * getName() const
It returns the name of the element.
Definition: SimpleType.cpp:75
Annotated & operator=(const Annotated &rhs)
Assignment operator.
Definition: Annotated.cpp:57
A base class for XSD classes that must provide a unique ID property.
Definition: Identifiable.h:46
SimpleType(Annotation *ann=0, std::string *id=0)
Constructor.
Definition: SimpleType.cpp:30
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 class that models a XSD annotation element.
Definition: Annotation.h:55
void setName(std::string *name)
It sets the name of the element.
Definition: SimpleType.cpp:85
virtual SimpleTypeConstructor * clone() const =0
It creates a clone of the object.
SimpleType & operator=(const SimpleType &rhs)
Assignment operator.
Definition: SimpleType.cpp:55
~SimpleType()
Destructor.
Definition: SimpleType.cpp:49
Identifiable & operator=(const Identifiable &rhs)
Assignment operator.
A base class for SympleType elements. List, Union and Restriction4SimpleType is derived from this bas...
A base class for XSD classes that may allow annotation.
Definition: Annotated.h:49
SimpleTypeConstructor * getConstructor() const
It returns the constructor of the element.
Definition: SimpleType.cpp:80