All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Restriction4SimpleType.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 "Facet.h"
22 #include "Restriction4SimpleType.h"
23 #include "SimpleType.h"
24 #include "QName.h"
25 
26 // STL
27 #include <cassert>
28 
30  : SimpleTypeConstructor(ann, id),
31  m_base(base)
32 {
33 }
34 
36  : SimpleTypeConstructor(rhs),
37  m_base(0)
38 {
39  m_base = rhs.m_base ? new QName(*rhs.m_base) : 0;
40  //m_facets??
41 }
42 
44 {
45  delete m_base;
46 }
47 
49 {
50  if(this != &rhs)
51  {
53 
54  delete m_base;
55 
56  m_base = rhs.m_base ? new QName(*rhs.m_base) : 0;
57 
58  //m_facets??
59  }
60 
61  return *this;
62 }
63 
65 {
66  return m_base;
67 }
68 
69 const boost::ptr_vector<te::xsd::Facet>& te::xsd::Restriction4SimpleType::getFacets() const
70 {
71  return m_facetVec;
72 }
73 
75 {
76  delete m_base;
77  m_base = base;
78 }
79 
81 {
82  delete m_simpleType;
83  m_simpleType = simpleType;
84 }
85 
87 {
88  te::xsd::Facet* f = new te::xsd::Facet(fType, value);
89  addFacet(f);
90 }
91 
93 {
94  m_facetVec.push_back(f);
95 }
96 
98 {
99  return new Restriction4SimpleType(*this);
100 }
The restriction element defines restrictions on a simpleType definition.
void addFacet(FacetType fType, const std::string &value)
Adds a new facet to this restriction.
Restriction4SimpleType(QName *base=0, Annotation *ann=0, std::string *id=0)
Constructor.
void setBase(QName *base)
It sets the name of the built-in data type simpleType element that will be restricted.
It models a XML Schema SimpleType element.
A class to deal with XML qualified names.
Restriction4SimpleType & operator=(const Restriction4SimpleType &rhs)
Assignment operator.
QName * getBase() const
It returns the name of the built-in data type simpleType element that will be restricted.
A base class for SympleType elements. List, Union and Restriction4SimpleType is derived from this bas...
SimpleTypeConstructor * clone() const
It creates a clone of the object.
SimpleTypeConstructor & operator=(const SimpleTypeConstructor &rhs)
Assignment operator not allowed.
This class can be used to model a facet (a constraint in the range of values).
A class to be used to represent XML qualified names.
Definition: QName.h:49
void setSimpleType(SimpleType *simpleType)
It sets the simpleType element that will be restricted.
FacetType
It enumerates the available facet types.
Definition: Enums.h:91
The restriction element defines restrictions on a simpleType definition.
This class can be used to model a facet (a constraint in the range of values).
Definition: Facet.h:45
A class that models a XSD annotation element.
Definition: Annotation.h:55
It models a XML Schema SimpleType element.
Definition: SimpleType.h:54
const boost::ptr_vector< Facet > & getFacets() const
It returns the list of facets defined on this restriction.
QName * m_base
It specifies the name of the built-in data type simpleType element that will be restricted. (Required)