All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Serializer.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 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/AbstractWriter.h"
29 #include "../../../xml/Reader.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 #ifdef TERRALIB_MOD_XML_ENABLED
42 std::auto_ptr<te::dt::Property> te::serialize::xml::ReadProperty(te::xml::Reader& /*reader*/)
43 {
44  //assert(reader.getNodeType() == te::xml::START_ELEMENT);
45  //assert(reader.getElementLocalName() == "Property");
46 
47  //unsigned int id = reader.getAttrAsUInt32(0);
48  //std::string name = reader.getAttr(1);
49  //int datatype = reader.getAttrAsInt32(2);
50 
51  //reader.next();
52 
53  //std::auto_ptr<te::dt::Property> p(0);
54 
55  //switch(datatype)
56  //{
57  // case te::dt::CHAR_TYPE:
58  // case te::dt::UCHAR_TYPE:
59  // case te::dt::INT16_TYPE:
60  // case te::dt::INT32_TYPE:
61  // case te::dt::INT64_TYPE:
62  // case te::dt::BOOLEAN_TYPE:
63  // case te::dt::FLOAT_TYPE:
64  // case te::dt::DOUBLE_TYPE:
65  // p.reset(new te::dt::SimpleProperty(name, datatype, false, 0, id, 0));
66  // break;
67 
68  // case te::dt::NUMERIC_TYPE:
69  // p.reset(new te::dt::NumericProperty(name, 0, 0, false, 0, id, 0));
70  // break;
71 
72  // case te::dt::STRING_TYPE:
73  // p.reset(new te::dt::StringProperty(name, te::dt::STRING, 0, false, 0, id, 0));
74  // break;
75 
76  // case te::dt::GEOMETRY_TYPE:
77  // p = new te::gm::GeometryProperty(name, 0, te::gm::GeometryType);
78  // break;
79 
80  // default:
81  // throw te::dt::Exception(TE_TR("Data type not supported!"));
82  //}
83 
84  //assert(reader.getNodeType() == te::xml::END_ELEMENT); // End of Property Element
85  //reader.next();
86 
87  //return p;
88 
89  return std::auto_ptr<te::dt::Property>(0);
90 }
91 
93 {
94  //writer.writeStartElement("te_dt:Property");
95 
96  //writer.writeAttribute("id", p.getId());
97  //writer.writeAttribute("name", p.getName());
98  //writer.writeAttribute("datatype", p.getType());
99 
100  //writer.writeEndElement("te_dt:Property");
101 }
102 #endif // TERRALIB_MOD_XML_ENABLED
This class models a XML reader object.
Definition: Reader.h:55
This class models a XML writer object.
It models a property definition.
Definition: Property.h:59
TEDATAACCESSEXPORT void Save(const std::string &fileName)
Definition: Serializer.cpp:201
Support for Property serialization.