All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
IdentityConstraint.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 IdentityConstraint.cpp
22 
23  \brief This is the base class for XML Schema elements that are related to identity constraint.
24 */
25 
26 // TerraLib
27 #include "Field.h"
28 #include "IdentityConstraint.h"
29 #include "Selector.h"
30 
31 // STL
32 #include <cassert>
33 
34 te::xsd::IdentityConstraint::IdentityConstraint(std::string* name, Annotation* ann, std::string* id)
35  : Identifiable(id),
36  Annotated(ann),
37  m_name(name)
38 {
39  assert(m_name);
40 }
41 
43 {
44 }
45 
47 {
48  delete m_name;
49  delete m_selector;
50 }
51 
53 {
54  return *this;
55 }
56 
58 {
59  return m_name;
60 }
61 
63 {
64  return m_selector;
65 }
66 
67 const boost::ptr_vector<te::xsd::Field>& te::xsd::IdentityConstraint::getFields() const
68 {
69  return m_fieldVec;
70 }
71 
72 void te::xsd::IdentityConstraint::setName(std::string* name)
73 {
74  assert(name);
75  delete m_name;
76  m_name = name;
77 }
78 
80 {
81  delete m_selector;
82  m_selector = s;
83 }
84 
86 {
87  m_fieldVec.push_back(f);
88 }
virtual ~IdentityConstraint()
Destructor.
void addField(Field *f)
Adds a new field to this element.
A base class for XSD classes that may allow annotation.
Definition: Annotated.h:49
It models the selector element of an XML Schema.
std::string * m_name
It specifies the name of this element. (Required)
void setName(std::string *name)
It sets a name for this element.
IdentityConstraint(std::string *name, Annotation *ann=0, std::string *id=0)
Constructor.
A base class for XSD classes that must provide a unique ID property.
Definition: Identifiable.h:46
It models the field element of an XML Schema.
Definition: Field.h:47
IdentityConstraint & operator=(const IdentityConstraint &rhs)
Assignment operator.
It models the selector element of an XML Schema.
Definition: Selector.h:44
This is the base class for XML Schema elements that are related to identity constraint.
const boost::ptr_vector< Field > & getFields() const
It returns the list of Fields elements of this element.
Selector * getSelector() const
It returns the Selector element of this element.
A class that models a XSD annotation element.
Definition: Annotation.h:55
std::string * getName() const
It returns the name of this element.
This is the base class for XML Schema elements that are related to identity constraint.
void setSelector(Selector *s)
It sets the Selector element of this element.