All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Serializer.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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 terralib/datatype/serialization/xml/Serializer.cpp
22 
23  \brief Support for Property serialization.
24 */
25 
26 // TerraLib
27 #include "../../../common/Translator.h"
28 #include "../../../xml/Reader.h"
29 #include "../../../xml/Writer.h"
30 #include "../../Enums.h"
31 #include "../../NumericProperty.h"
32 #include "../../Property.h"
33 #include "../../SimpleProperty.h"
34 #include "../../StringProperty.h"
35 #include "../../Exception.h"
36 #include "Serializer.h"
37 
38 // STL
39 #include <cassert>
40 
41 std::auto_ptr<te::dt::Property> te::serialize::xml::ReadProperty(te::xml::Reader& /*reader*/)
42 {
43  //assert(reader.getNodeType() == te::xml::START_ELEMENT);
44  //assert(reader.getElementLocalName() == "Property");
45 
46  //unsigned int id = reader.getAttrAsUInt32(0);
47  //std::string name = reader.getAttr(1);
48  //int datatype = reader.getAttrAsInt32(2);
49 
50  //reader.next();
51 
52  //std::auto_ptr<te::dt::Property> p(0);
53 
54  //switch(datatype)
55  //{
56  // case te::dt::CHAR_TYPE:
57  // case te::dt::UCHAR_TYPE:
58  // case te::dt::INT16_TYPE:
59  // case te::dt::INT32_TYPE:
60  // case te::dt::INT64_TYPE:
61  // case te::dt::BOOLEAN_TYPE:
62  // case te::dt::FLOAT_TYPE:
63  // case te::dt::DOUBLE_TYPE:
64  // p.reset(new te::dt::SimpleProperty(name, datatype, false, 0, id, 0));
65  // break;
66 
67  // case te::dt::NUMERIC_TYPE:
68  // p.reset(new te::dt::NumericProperty(name, 0, 0, false, 0, id, 0));
69  // break;
70 
71  // case te::dt::STRING_TYPE:
72  // p.reset(new te::dt::StringProperty(name, te::dt::STRING, 0, false, 0, id, 0));
73  // break;
74 
75  // case te::dt::GEOMETRY_TYPE:
76  // p = new te::gm::GeometryProperty(name, 0, te::gm::GeometryType);
77  // break;
78 
79  // default:
80  // throw te::dt::Exception(TR_DATATYPE("Data type not supported!"));
81  //}
82 
83  //assert(reader.getNodeType() == te::xml::END_ELEMENT); // End of Property Element
84  //reader.next();
85 
86  //return p;
87 
88  return std::auto_ptr<te::dt::Property>(0);
89 }
90 
92 {
93  //writer.writeStartElement("te_dt:Property");
94 
95  //writer.writeAttribute("id", p.getId());
96  //writer.writeAttribute("name", p.getName());
97  //writer.writeAttribute("datatype", p.getType());
98 
99  //writer.writeEndElement("te_dt:Property");
100 }
TEDATAACCESSEXPORT void Save(const std::string &fileName)
Definition: Serializer.cpp:191
This class models a XML reader object.
Definition: Reader.h:55
TEDATATYPEEXPORT std::auto_ptr< te::dt::Property > ReadProperty(te::xml::Reader &reader)
Definition: Serializer.cpp:41
Support for Property serialization.
It models a property definition.
Definition: Property.h:59
This class models a XML writer object.
Definition: Writer.h:52