libpappsomspp
Library for mass spectrometry
xtandemoutputsaxhandler.h
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/processing/tandemwrapper/xtandemoutputsaxhandler.h
3  * \date 01/02/2020
4  * \author Olivier Langella
5  * \brief rewrites tandem xml output file with temporary files
6  */
7 
8 /*******************************************************************************
9  * Copyright (c) 2020 Olivier Langella <Olivier.Langella@u-psud.fr>.
10  *
11  * This file is part of PAPPSOms-tools.
12  *
13  * PAPPSOms-tools is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation, either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * PAPPSOms-tools is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
25  *
26  ******************************************************************************/
27 
28 #pragma once
29 
30 #include <QDebug>
31 #include <QXmlDefaultHandler>
32 #include <QXmlStreamWriter>
33 /**
34  * @todo write docs
35  */
36 namespace pappso
37 {
38 class XtandemOutputSaxHandler : public QXmlDefaultHandler
39 {
40  public:
41  /**
42  * Default constructor
43  */
44  XtandemOutputSaxHandler(const QString &final_tandem_output,
45  const QString &original_msdata_file_name);
46 
47  /**
48  * Destructor
49  */
51 
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  void setInputParameters(const QString &label_name_attribute,
74  const QString &input_value);
75 
76  private:
77  bool startElement_note(QXmlAttributes attributes);
78  bool endElement_note();
79  void writeOpenTag(const QString &qName, const QXmlAttributes &attributes);
80 
81  private:
82  std::map<QString, QString> m_mapTandemInputParameters;
83  std::vector<QString> m_tagStack;
85  QXmlStreamWriter *p_writeXmlTandemOutput;
86  QString m_errorString;
87  QString m_currentText;
88  bool m_isTandemParameter = false;
89  QString m_currentLabel;
91 };
92 } // namespace pappso
XtandemOutputSaxHandler(const QString &final_tandem_output, const QString &original_msdata_file_name)
bool error(const QXmlParseException &exception) override
void setInputParameters(const QString &label_name_attribute, const QString &input_value)
void writeOpenTag(const QString &qName, const QXmlAttributes &attributes)
bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes) override
bool fatalError(const QXmlParseException &exception) override
bool startElement_note(QXmlAttributes attributes)
std::map< QString, QString > m_mapTandemInputParameters
bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName) override
bool characters(const QString &str) override
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39