Writer.h
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/xml/Writer.h
22 
23  \brief This class models a XML writer object.
24 */
25 
26 #ifndef __TERRALIB_XML_INTERNAL_WRITER_H
27 #define __TERRALIB_XML_INTERNAL_WRITER_H
28 
29 // TerraLib
30 #include "../common/Holder.h"
31 #include "AbstractWriter.h"
32 #include "Config.h"
33 
34 // STL
35 #include <string>
36 #include <sstream>
37 
38 // Boost
39 #include <boost/cstdint.hpp>
40 #include <boost/noncopyable.hpp>
41 
42 namespace te
43 {
44  namespace xml
45  {
46  /*!
47  \class Writer
48 
49  \brief This class models a XML writer object.
50 
51  \ingroup xml
52  */
54  {
55  public:
56 
57  Writer();
58 
59  /*! \brief Constructor. */
60  //Writer(std::ostream& ostr);
61 
62  /*! \brief Virtual destructor. */
64 
65  void writeStartDocument(const std::string& encoding, const std::string& standalone);
66 
67  void writeStartElement(const std::string& qName);
68 
69  void writeElement(const std::string& qName, const std::string& value);
70 
71  void writeElement(const std::string& qName, const double& value);
72 
73  void writeElement(const std::string& qName, boost::int32_t value);
74 
75  void writeElement(const std::string& qName, boost::uint32_t value);
76 
77  void writeElement(const std::string& qName, boost::int64_t value);
78 
79  void writeElement(const std::string& qName, boost::uint64_t value);
80 
81  void writeAttribute(const std::string& attName, const std::string& value);
82 
83  void writeAttribute(const std::string& attName, const double& value);
84 
85  void writeAttribute(const std::string& attName, boost::int32_t value);
86 
87  void writeAttribute(const std::string& attName, boost::uint32_t value);
88 
89  void writeAttribute(const std::string& attName, boost::int64_t value);
90 
91  void writeAttribute(const std::string& attName, boost::uint64_t value);
92 
93  void writeValue(const std::string& value);
94 
95  void writeValue(const double& value);
96 
97  void writeValue(boost::int32_t value);
98 
99  void writeValue(boost::uint32_t value);
100 
101  void writeValue(boost::int64_t value);
102 
103  void writeValue(boost::uint64_t value);
104 
105  void writeEndElement(const std::string& qName);
106 
107  void setRootNamespaceURI(const std::string& uri);
108 
109  void writeToFile();
110 
111  std::string getContent() override;
112 
113  private:
114 
115  std::ostringstream* m_ostr;
117  };
118 
119  } // end namespace xml
120 } // end namespace te
121 
122 #endif // __TERRALIB_XML_INTERNAL_WRITER_H
123 
te::xml::Writer::writeValue
void writeValue(boost::uint64_t value)
te::xml::Writer::writeAttribute
void writeAttribute(const std::string &attName, boost::uint64_t value)
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::xml::Writer::m_isOpened
bool m_isOpened
Definition: Writer.h:116
te::xml::Writer::writeElement
void writeElement(const std::string &qName, boost::uint64_t value)
te::xml::Writer::writeStartElement
void writeStartElement(const std::string &qName)
te::xml::Writer::writeValue
void writeValue(boost::int64_t value)
te::xml::Writer::writeElement
void writeElement(const std::string &qName, boost::int64_t value)
te::xml::Writer::writeEndElement
void writeEndElement(const std::string &qName)
TEXMLEXPORT
#define TEXMLEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88
te::xml::Writer::writeValue
void writeValue(const double &value)
te::xml::Writer::writeElement
void writeElement(const std::string &qName, const std::string &value)
te::xml::Writer::writeAttribute
void writeAttribute(const std::string &attName, boost::int32_t value)
te::xml::AbstractWriter
This class models a XML writer object.
Definition: AbstractWriter.h:50
te::xml::Writer::~Writer
~Writer()
Constructor.
te::xml::Writer::writeAttribute
void writeAttribute(const std::string &attName, const std::string &value)
te::xml::Writer
This class models a XML writer object.
Definition: Writer.h:54
te::xml::Writer::writeStartDocument
void writeStartDocument(const std::string &encoding, const std::string &standalone)
te::xml::Writer::writeAttribute
void writeAttribute(const std::string &attName, boost::int64_t value)
te::xml::Writer::writeElement
void writeElement(const std::string &qName, boost::int32_t value)
te::xml::Writer::writeValue
void writeValue(const std::string &value)
te::xml::Writer::m_ostr
std::ostringstream * m_ostr
Definition: Writer.h:115
te::xml::Writer::writeAttribute
void writeAttribute(const std::string &attName, boost::uint32_t value)
AbstractWriter.h
This class models a XML writer object.
te::xml::Writer::writeElement
void writeElement(const std::string &qName, boost::uint32_t value)
te::xml::Writer::writeValue
void writeValue(boost::int32_t value)
te::xml::Writer::setRootNamespaceURI
void setRootNamespaceURI(const std::string &uri)
te::xml::Writer::Writer
Writer()
te::xml::Writer::writeAttribute
void writeAttribute(const std::string &attName, const double &value)
te::xml::Writer::getContent
std::string getContent() override
Gets the XML content in a std::string format.
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::xml::Writer::writeValue
void writeValue(boost::uint32_t value)
te::xml::Writer::writeElement
void writeElement(const std::string &qName, const double &value)
te::xml::Writer::writeToFile
void writeToFile()