Loading...
Searching...
No Matches
XMLChToStr.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 XMLChToStr.h
22
23 \brief A class for converting a Xerces string (XMLCh) to a standard string.
24*/
25
26#ifndef __TERRALIB_XERCES_INTERNAL_XMLCHTOSTR_H
27#define __TERRALIB_XERCES_INTERNAL_XMLCHTOSTR_H
28
29// TerraLib
30#include "Config.h"
31
32// STL
33#include <cassert>
34#include <string>
35
36// Xerces-C++
37#include <xercesc/util/XMLString.hpp>
38
39namespace te
40{
41 namespace xerces
42 {
43 /*!
44 \class XMLChToStr
45
46 \brief A class for converting a Xerces string (XMLCh) to a standard string.
47
48 \sa StrToXMLCh
49 */
51 {
52 public:
53
54 /*!
55 \brief It converts the XML string to an internal standard string.
56
57 \param xstr A XML string.
58 */
59 XMLChToStr(const XMLCh* const xstr);
60
61 /*! \brief Destructor */
63
64 /*!
65 \brief It return the standard string representation.
66
67 \return The standard string representation.
68 */
69 const std::string& getStr() const;
70
71 private:
72
73 std::string m_stdstr; //!< The internal standard string.
74 };
75
76 inline XMLChToStr::XMLChToStr(const XMLCh* const xstr)
77 {
78 if(xstr == 0)
79 return;
80
81 m_stdstr = xercesc::XMLString::transcode(xstr);
82 }
83
85 {
86 }
87
88 inline const std::string& XMLChToStr::getStr() const
89 {
90 return m_stdstr;
91 }
92
93 } // end namespace xerces
94} // end namespace te
95
96#endif // __TERRALIB_XERCES_INTERNAL_XMLCHTOSTR_H
97
A class for converting a Xerces string (XMLCh) to a standard string.
Definition: XMLChToStr.h:51
~XMLChToStr()
Destructor.
Definition: XMLChToStr.h:84
std::string m_stdstr
The internal standard string.
Definition: XMLChToStr.h:73
XMLChToStr(const XMLCh *const xstr)
It converts the XML string to an internal standard string.
Definition: XMLChToStr.h:76
const std::string & getStr() const
It return the standard string representation.
Definition: XMLChToStr.h:88
TerraLib.
Proxy configuration file for TerraView (see terraview_config.h).