libpappsomspp
Library for mass spectrometry
xtandempresetsaxhandler.h
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/processing/tandemwrapper/xtandempresetsaxhandler.h
3  * \date 06/02/2020
4  * \author Olivier Langella
5  * \brief read tandem preset file to get centroid parameters and number of
6  * threads
7  */
8 
9 /*******************************************************************************
10  * Copyright (c) 2020 Olivier Langella <Olivier.Langella@u-psud.fr>.
11  *
12  * This file is part of PAPPSOms-tools.
13  *
14  * PAPPSOms-tools is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation, either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * PAPPSOms-tools is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
26  *
27  ******************************************************************************/
28 
29 #pragma once
30 
31 #include <QDebug>
32 #include <QXmlDefaultHandler>
33 #include <QXmlStreamWriter>
34 #include "../../types.h"
35 /**
36  * @todo write docs
37  */
38 namespace pappso
39 {
40 class XtandemPresetSaxHandler : public QXmlDefaultHandler
41 {
42  public:
43  /**
44  * Default constructor
45  */
47 
48  /**
49  * Destructor
50  */
52 
53  bool startElement(const QString &namespaceURI,
54  const QString &localName,
55  const QString &qName,
56  const QXmlAttributes &attributes) override;
57 
58  bool endElement(const QString &namespaceURI,
59  const QString &localName,
60  const QString &qName) override;
61 
62  bool startDocument() override;
63 
64  bool endDocument() override;
65 
66  bool characters(const QString &str) override;
67 
68  bool fatalError(const QXmlParseException &exception) override;
69  bool error(const QXmlParseException &exception) override;
70 
71  QString errorString() const;
72 
73  int getNumberOfThreads() const;
74  const QString getMs2FiltersOptions() const;
75 
76  private:
77  bool startElement_note(QXmlAttributes attributes);
78  bool endElement_note();
79 
80  private:
81  QString m_errorString;
82  std::vector<QString> m_tagStack;
83  QString m_currentText;
84  bool m_isTandemParameter = false;
85  QString m_currentLabel;
86  int m_threads = -1;
87 
89  double m_ms2precisionValue = 0;
90 };
91 } // namespace pappso
bool characters(const QString &str) override
bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName) override
bool fatalError(const QXmlParseException &exception) override
bool error(const QXmlParseException &exception) override
bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes) override
bool startElement_note(QXmlAttributes attributes)
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
PrecisionUnit
Definition: types.h:63