Debian Codegraph @

Source/Parser/CXMLHandlerStackBase.h

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #ifndef KONCLUDE_PARSER_CXMLHANDLERSTACKBASE_H
22 #define KONCLUDE_PARSER_CXMLHANDLERSTACKBASE_H
23
24 // Libraries includes
25 #include <QDomDocument>
26 #include <QStack>
27 #include <QMap>
28 #include <QXmlDefaultHandler>
29
30 // Namespace includes
31 #include "ParserSettings.h"
32 #include "CXMLHandlerStack.h"
33 #include "CXMLHandler.h"
34
35 // Other includes
36 #include "Logger/CLogIdentifier.h"
37
38
39 // Logger includes
40 #include "Logger/CLogger.h"
41
42
43 using namespace Konclude::Logger;
44
45
46
47 namespace Konclude {
48
49
50 namespace Parser {
51
52
53
54
55
56
57
58 /*!
59 *
60 * \class CXMLHandlerStack
61 * \author Andreas Steigmiller
62 * \version 0.1
63 * \brief TODO
64 *
65 */
66 class CXMLHandlerStackBase : public CXMLHandlerStack, public CXMLHandler, public CLogIdentifier {
67 // public methods
68 public:
69 //! Constructor
70 CXMLHandlerStackBase();
71
72
73
74 bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts, CParsingHandlingContext* handlingContext);
75 bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName, CParsingHandlingContext* handlingContext);
76
77
78 bool startDocument(CParsingHandlingContext* handlingContext);
79 bool endDocument(CParsingHandlingContext* handlingContext);
80
81
82 bool pushStackedHandler(CXMLHandler* handler, bool automaticallyPop, CParsingHandlingContext* handlingContext);
83 bool popStackedHandler(CXMLHandler* handler, CParsingHandlingContext* handlingContext);
84
85 // protected methods
86 protected:
87
88
89 // protected variables
90 protected:
91 class CXMLHandlerData {
92 public:
93 inline CXMLHandlerData(CXMLHandler* handler, bool automatPop, cint64 parseElementLevel) {
94 mHandler = handler;
95 mAutoPop = automatPop;
96 mParseElementLevel = parseElementLevel;
97 mStartDocumentCalled = false;
98 }
99 CXMLHandler* mHandler;
100 bool mAutoPop;
101 cint64 mParseElementLevel;
102 bool mStartDocumentCalled;
103 };
104
105 QStack<CXMLHandlerData*> mHandlerDataStack;
106 CXMLHandlerData* mCurrentHandlerData;
107
108 cint64 mParseElementLevel;
109
110
111 // private methods
112 private:
113
114
115 // private variables
116 private:
117
118
119
120 };
121
122 }; // end namespace Parser
123
124 }; // end namespace Konclude
125
126 #endif // KONCLUDE_PARSER_CXMLHANDLERSTACKBASE_H