]> git.donarmstrong.com Git - flightcrew.git/blob - src/FlightCrew/Misc/ErrorResultCollector.h
Imported Upstream version 0.7.2+dfsg
[flightcrew.git] / src / FlightCrew / Misc / ErrorResultCollector.h
1 /************************************************************************
2 **
3 **  Copyright (C) 2010  Strahinja Markovic
4 **
5 **  This file is part of FlightCrew.
6 **
7 **  FlightCrew is free software: you can redistribute it and/or modify
8 **  it under the terms of the GNU Lesser General Public License as published
9 **  by the Free Software Foundation, either version 3 of the License, or
10 **  (at your option) any later version.
11 **
12 **  FlightCrew is distributed in the hope that it will be useful,
13 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 **  GNU Lesser General Public License for more details.
16 **
17 **  You should have received a copy of the GNU Lesser General Public License
18 **  along with FlightCrew.  If not, see <http://www.gnu.org/licenses/>.
19 **
20 *************************************************************************/
21
22 #pragma once
23 #ifndef ERRORRESULTCOLLECTOR_H
24 #define ERRORRESULTCOLLECTOR_H
25
26 #include <vector>
27 #include <xercesc/sax/ErrorHandler.hpp>
28 namespace XERCES_CPP_NAMESPACE 
29 { class SAXParseException; class SAXException; class DOMException; }
30 namespace xc = XERCES_CPP_NAMESPACE;
31
32 #include "Result.h"
33
34 namespace FlightCrew
35 {
36
37 class ErrorResultCollector : public xc::ErrorHandler
38 {
39 public:
40
41     void warning(    const xc::SAXParseException &exception );
42
43     void error(      const xc::SAXParseException &exception );
44
45     void fatalError( const xc::SAXParseException &exception );
46
47     void resetErrors();
48
49     std::vector< Result > GetResults();
50
51     void AddNewExceptionAsResult( const xc::SAXParseException &exception,
52                                   bool xml_error = false );
53
54     void AddNewExceptionAsResult( const xc::SAXException &exception );
55
56     void AddNewExceptionAsResult( const xc::XMLException &exception );
57
58     void AddNewExceptionAsResult( const xc::DOMException &exception );
59
60 private:
61
62     std::vector< Result > m_Results;
63 };
64
65 } // namespace FlightCrew
66
67 #endif // ERRORRESULTCOLLECTOR_H