-
Notifications
You must be signed in to change notification settings - Fork 0
/
saxmzxmlhandler.h
68 lines (61 loc) · 1.95 KB
/
saxmzxmlhandler.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
#if !defined(SAXMZXMLHANDLER_H)
#define SAXMZXMLHANDLER_H
#include "saxhandler.h"
#include <set>
/**
* Uses eXpat SAX parser to parse mzData XML.
*/
class SAXMzxmlHandler : public SAXSpectraHandler
{
public:
SAXMzxmlHandler(vector<mspectrum>& _pv, mspectrumcondition& _p, mscore& _m);
~SAXMzxmlHandler();
// -----------------------------------------------------------------------
// Overrides of SAXHandler functions
// -----------------------------------------------------------------------
/**
* Receive notification of the start of an element.
*
* <p>By default, do nothing. Application writers may override this
* method in a subclass to take specific actions at the start of
* each element (such as allocating a new tree node or writing
* output to a file).</p>
*/
void startElement(const XML_Char *el, const XML_Char **attr);
/**
* Receive notification of the end of an element.
*
* <p>By default, do nothing. Application writers may override this
* method in a subclass to take specific actions at the end of
* each element (such as finalising a tree node or writing
* output to a file).</p>
*/
void endElement(const XML_Char *el);
/**
* Receive notification of character data inside an element.
*
* <p>By default, do nothing. Application writers may override this
* method to take specific actions for each chunk of character data
* (such as adding the data to a node or buffer, or printing it to
* a file).</p>
*/
void characters(const XML_Char *s, int len);
inline void reset()
{
m_viPossiblePrecursorCharges.clear();
SAXSpectraHandler::reset();
}
private:
/**
* Handle data collected in the characters() function.
*/
void processData();
set<size_t> m_sId;
private:
// Flags indicating parser is inside a particular tag.
bool m_bInMsLevel2;
bool m_bInPrecursorMz;
bool m_bInPeaks;
vector<int> m_viPossiblePrecursorCharges;
};
#endif //SAXMzxmlHandler_H