All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Restriction4SimpleContent.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 Restriction4SimpleContent.h
22 
23  \brief This restriction class defines restrictions on a simpleContent.
24 */
25 
26 // TerraLib
27 #include "AbstractAttribute.h"
28 #include "AnyAttribute.h"
29 #include "Facet.h"
31 #include "SimpleType.h"
32 #include "QName.h"
33 
34 // STL
35 #include <cassert>
36 
38  : Identifiable(id),
39  Annotated(0),
40  m_base(base),
41  m_simpleType(0),
42  m_anyAttr(0)
43 {
44  assert(base);
45 }
46 
48 {
49  delete m_base;
50  delete m_simpleType;
51  delete m_anyAttr;
52 }
53 
55 {
56  return m_base;
57 }
58 
59 const boost::ptr_vector<te::xsd::Facet>& te::xsd::Restriction4SimpleContent::getFacets() const
60 {
61  return m_facetVec;
62 }
63 
64 const boost::ptr_vector<te::xsd::AbstractAttribute>& te::xsd::Restriction4SimpleContent::getAttributes() const
65 {
66  return m_attributeVec;
67 }
68 
70 {
71  return m_anyAttr;
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  m_attributeVec.push_back(a);
100 }
101 
103 {
104  delete m_anyAttr;
105  m_anyAttr = a;
106 }
void setSimpleType(SimpleType *simpleType)
It sets the restriction internal simple type.
const boost::ptr_vector< Facet > & getFacets() const
It returns the list of facets defined on this restriction.
A base class for XSD classes that may allow annotation.
Definition: Annotated.h:49
const boost::ptr_vector< AbstractAttribute > & getAttributes() const
It returns the list of attributes of this restriction.
void setAnyAttribute(AnyAttribute *a)
It sets the anyAttribute to this restriction.
This restriction class defines restrictions on a simpleContent.
It models a XML Schema SimpleType element.
A class to deal with XML qualified names.
QName * getBase() const
It returns the name of a built-in data type, simple type or complex type that will be restricted...
This is the base class for XML Schema Attribute classes.
It models an XML anyAttribute element.
Definition: AnyAttribute.h:49
This is the base class for XML Schema Attribute classes.
A base class for XSD classes that must provide a unique ID property.
Definition: Identifiable.h:46
This class can be used to model a facet (a constraint in the range of values).
It models an XML anyAttribute element.
Restriction4SimpleContent(std::string *id, QName *base)
Constructor.
void addAttribute(AbstractAttribute *a)
It adds an attribute to this restriction.
AnyAttribute * getAnyAttribute() const
It returns the anyAttribute defined on this restriction.
void addFacet(FacetType fType, const std::string &value)
Adds a new facet to this restriction.
void setBase(QName *base)
It sets the name of a built-in data type, simple type or complex type that will be restricted...
A class to be used to represent XML qualified names.
Definition: QName.h:49
FacetType
It enumerates the available facet types.
Definition: Enums.h:91
This class can be used to model a facet (a constraint in the range of values).
Definition: Facet.h:45
It models a XML Schema SimpleType element.
Definition: SimpleType.h:54