-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSSTInfoXMLFileParser.h
89 lines (73 loc) · 3.02 KB
/
SSTInfoXMLFileParser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
////////////////////////////////////////////////////////////////////////
// Copyright 2009-2018 NTESS. Under the terms
// of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
// Copyright (c) 2009-2018, NTESS
// All rights reserved.
//
// Portions are copyright of other developers:
// See the file CONTRIBUTORS.TXT in the top level directory
// the distribution for more information.
//
// This file is part of the SST software package. For license
// information, see the LICENSE file in the top level directory of the
// distribution.
////////////////////////////////////////////////////////////////////////
#ifndef SSTINFOXMLFILEPARSER_H
#define SSTINFOXMLFILEPARSER_H
#include "GlobalIncludes.h"
class XMLSSTInfoDataHandler :public QXmlDefaultHandler
{
// Enumeration for Identifying the object being processed
enum CurrentlyProcessing { NONE, ELEMENT, COMPONENT, INTROSPECTOR, EVENT, MODULE, PARTITIONER, GENERATOR };
public:
// Constructor / Destructor
XMLSSTInfoDataHandler(QString InputFilePath, SSTInfoData* ptrSSTInfoData);
~XMLSSTInfoDataHandler();
private:
bool fatalError(const QXmlParseException& exception);
bool startDocument();
bool endDocument();
bool characters(const QString& ch);
bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts );
bool endElement(const QString & namespaceURI, const QString & localName, const QString & qName);
SSTInfoDataComponent::ComponentType ConvertStringToComponentType(QString ComponentTypeString);
bool GenerateParsingError(QString ObjectTitle, QString ObjectName, QString Index, SSTInfoDataElement* CurrentElement);
private:
QString m_InputFilePath;
SSTInfoData* m_SSTInfoData;
bool m_XMLFileValid;
bool m_XMLFileCorrectVersion;
CurrentlyProcessing m_CurrentlyProcessing;
SSTInfoDataElement* m_CurrentElement;
SSTInfoDataComponent* m_CurrentComponent;
SSTInfoDataIntrospector* m_CurrentIntrospector;
SSTInfoDataEvent* m_CurrentEvent;
SSTInfoDataModule* m_CurrentModule;
SSTInfoDataPartitioner* m_CurrentPartitioner;
SSTInfoDataGenerator* m_CurrentGenerator;
SSTInfoDataParam* m_CurrentParam;
SSTInfoDataPort* m_CurrentPort;
};
////////////////////////////////////////////////////////
class SSTInfoXMLFileParser : public QXmlSimpleReader
{
public:
// Constructor / Destructor
SSTInfoXMLFileParser();
~SSTInfoXMLFileParser();
public:
void SetXMLInputFile(QString InputFilePath);
bool ParseXMLFile();
SSTInfoData* GetParsedSSTInfoData() {return m_SSTInfoData;}
private:
void Cleanup();
private:
QString m_InputFilePath;
QFile* m_XMLFile;
QXmlInputSource* m_XMLInputSource;
XMLSSTInfoDataHandler* m_XMLSSTInfoDataHandler;
SSTInfoData* m_SSTInfoData;
};
#endif // SSTINFOXMLFILEPARSER_H