Loading...
Searching...
No Matches
ErrorHandler.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 ErrorHandler.h
22
23 \brief This class implements Xerces interface for error handlers.
24*/
25
26#ifndef __TERRALIB_XERCES_INTERNAL_ERRORHANDLER_H
27#define __TERRALIB_XERCES_INTERNAL_ERRORHANDLER_H
28
29// TerraLib
30#include "Config.h"
31
32// STL
33#include <string>
34#include <vector>
35
36// Xerces-C++
37#include <xercesc/sax/ErrorHandler.hpp>
38
39namespace te
40{
41 namespace xerces
42 {
43 /*!
44 \class ErrorHandler
45
46 \brief This class implements Xerces interface for error handlers.
47
48 \sa Reader, ReaderHandler
49 */
50 class ErrorHandler : public xercesc::ErrorHandler
51 {
52 public:
53
54 /*! \brief Default constructor. */
56
57 /*! \brief Destructor. */
59
60 /*!
61 \brief It receives from the parser a notification of a warning.
62
63 \param exc The warning information.
64 */
65 void warning(const xercesc::SAXParseException& exc);
66
67 /*!
68 \brief It receives from the parser a notification of a recoverable error.
69
70 \param exc The error information.
71 */
72 void error(const xercesc::SAXParseException& exc);
73
74 /*!
75 \brief It receives from the parser a notification of a non-recoverable error.
76
77 \param exc The error information.
78 */
79 void fatalError(const xercesc::SAXParseException& exc);
80
81 /*! brief It resets the error handler object on its reuse. */
83
84 /*!
85 \brief It returns the number of reported errors.
86
87 \return The number of reported errors.
88 */
89 const std::size_t getNumErros() const;
90
91 /*!
92 \brief It returns the n-th error message.
93
94 \param i The error message position in the internal conteiner.
95
96 \return The n-th error message.
97
98 \note This method doesn't check the index range.
99 */
100 const std::string& getError(std::size_t i) const;
101
102 /*!
103 \brief It returns a concatenation of all reported error messages.
104
105 \return A concatenation of all reported error messages.
106 */
107 const std::string getErrors() const;
108
109 protected:
110
111 std::vector<std::string> m_errors; //!< The error messages.
112 };
113
114 } // end namespace xerces
115} // end namespace te
116
117#endif // __TERRALIB_XERCES_INTERNAL_ERRORHANDLER_H
118
This class implements Xerces interface for error handlers.
Definition: ErrorHandler.h:51
const std::string & getError(std::size_t i) const
It returns the n-th error message.
void warning(const xercesc::SAXParseException &exc)
It receives from the parser a notification of a warning.
ErrorHandler()
Default constructor.
Definition: ErrorHandler.h:55
void error(const xercesc::SAXParseException &exc)
It receives from the parser a notification of a recoverable error.
const std::string getErrors() const
It returns a concatenation of all reported error messages.
const std::size_t getNumErros() const
It returns the number of reported errors.
~ErrorHandler()
Destructor.
Definition: ErrorHandler.h:58
std::vector< std::string > m_errors
The error messages.
Definition: ErrorHandler.h:111
void fatalError(const xercesc::SAXParseException &exc)
It receives from the parser a notification of a non-recoverable error.
TerraLib.
Proxy configuration file for TerraView (see terraview_config.h).