Commit 9ddf22fb authored by Langella Olivier's avatar Langella Olivier
Browse files

indentation

parent 34694195
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -34,14 +34,13 @@
XtandemParamSaxHandler::XtandemParamSaxHandler(
TandemParameters *p_tandem_parameters)
TandemParameters *p_tandem_parameters)
{
_p_tandem_parameters = p_tandem_parameters;
//<note type="input" label="output, xsl path">tandem-style.xsl</note>
_p_tandem_parameters->setParamLabelValue("output, xsl path",
"tandem-style.xsl");
_p_tandem_parameters = p_tandem_parameters;
//<note type="input" label="output, xsl path">tandem-style.xsl</note>
_p_tandem_parameters->setParamLabelValue("output, xsl path",
"tandem-style.xsl");
}
XtandemParamSaxHandler::~XtandemParamSaxHandler()
{
......@@ -50,7 +49,7 @@ XtandemParamSaxHandler::~XtandemParamSaxHandler()
bool
XtandemParamSaxHandler::isTandemParameter() const
{
return m_isTandemParameter;
return m_isTandemParameter;
}
bool
XtandemParamSaxHandler::startElement(const QString &namespaceURI,
......@@ -58,58 +57,58 @@ XtandemParamSaxHandler::startElement(const QString &namespaceURI,
const QString &qName,
const QXmlAttributes &attributes)
{
// qDebug()<< "XtandemParamSaxHandler::startElement begin" << namespaceURI <<
// " " << localName << " " << qName ;
_tag_stack.push_back(qName);
bool is_ok = true;
// qDebug()<< "XtandemParamSaxHandler::startElement begin" << namespaceURI <<
// " " << localName << " " << qName ;
_tag_stack.push_back(qName);
bool is_ok = true;
try
try
{
//<bioml label="example api document">
if(_tag_stack.size() == 1)
//<bioml label="example api document">
if(_tag_stack.size() == 1)
{
if(qName != "bioml")
if(qName != "bioml")
{
_errorStr = QObject::tr(
"ERROR in XtandemParamSaxHandler::startElement "
"root tag %1 is not <bioml>")
_errorStr = QObject::tr(
"ERROR in XtandemParamSaxHandler::startElement "
"root tag %1 is not <bioml>")
.arg(qName);
m_isTandemParameter = false;
return false;
m_isTandemParameter = false;
return false;
}
else
else
{
m_isTandemParameter = true;
m_isTandemParameter = true;
}
}
// startElement_group
// startElement_group
if(qName == "note")
if(qName == "note")
{
is_ok = startElement_note(attributes);
is_ok = startElement_note(attributes);
}
_current_text.clear();
_current_text.clear();
}
catch(pappso::PappsoException exception_pappso)
catch(pappso::PappsoException exception_pappso)
{
_errorStr = QObject::tr(
"ERROR in XtandemParamSaxHandler::startElement "
"tag %1, PAPPSO exception:\n%2")
_errorStr = QObject::tr(
"ERROR in XtandemParamSaxHandler::startElement "
"tag %1, PAPPSO exception:\n%2")
.arg(qName)
.arg(exception_pappso.qwhat());
return false;
return false;
}
catch(std::exception exception_std)
catch(std::exception exception_std)
{
_errorStr = QObject::tr(
"ERROR in XtandemParamSaxHandler::startElement "
"tag %1, std exception:\n%2")
_errorStr = QObject::tr(
"ERROR in XtandemParamSaxHandler::startElement "
"tag %1, std exception:\n%2")
.arg(qName)
.arg(exception_std.what());
return false;
return false;
}
return is_ok;
return is_ok;
}
bool
......@@ -118,75 +117,75 @@ XtandemParamSaxHandler::endElement(const QString &namespaceURI,
const QString &qName)
{
bool is_ok = true;
// endElement_peptide_list
try
bool is_ok = true;
// endElement_peptide_list
try
{
if(qName == "note")
if(qName == "note")
{
is_ok = endElement_note();
is_ok = endElement_note();
}
}
catch(pappso::PappsoException exception_pappso)
catch(pappso::PappsoException exception_pappso)
{
_errorStr = QObject::tr(
"ERROR in XtandemParamSaxHandler::endElement tag "
"%1, PAPPSO exception:\n%2")
_errorStr = QObject::tr(
"ERROR in XtandemParamSaxHandler::endElement tag "
"%1, PAPPSO exception:\n%2")
.arg(qName)
.arg(exception_pappso.qwhat());
return false;
return false;
}
catch(std::exception exception_std)
catch(std::exception exception_std)
{
_errorStr = QObject::tr(
"ERROR in XtandemParamSaxHandler::endElement tag "
"%1, std exception:\n%2")
_errorStr = QObject::tr(
"ERROR in XtandemParamSaxHandler::endElement tag "
"%1, std exception:\n%2")
.arg(qName)
.arg(exception_std.what());
return false;
return false;
}
_current_text.clear();
_tag_stack.pop_back();
_current_text.clear();
_tag_stack.pop_back();
return is_ok;
return is_ok;
}
bool
XtandemParamSaxHandler::error(const QXmlParseException &exception)
{
_errorStr = QObject::tr(
"Parse error at line %1, column %2 :\n"
"%3")
_errorStr = QObject::tr(
"Parse error at line %1, column %2 :\n"
"%3")
.arg(exception.lineNumber())
.arg(exception.columnNumber())
.arg(exception.message());
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
<< _errorStr;
return false;
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
<< _errorStr;
return false;
}
bool
XtandemParamSaxHandler::fatalError(const QXmlParseException &exception)
{
_errorStr = QObject::tr(
"Parse error at line %1, column %2 :\n"
"%3")
_errorStr = QObject::tr(
"Parse error at line %1, column %2 :\n"
"%3")
.arg(exception.lineNumber())
.arg(exception.columnNumber())
.arg(exception.message());
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
<< _errorStr;
return false;
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
<< _errorStr;
return false;
}
QString
XtandemParamSaxHandler::errorString() const
{
return _errorStr;
return _errorStr;
}
......@@ -194,67 +193,67 @@ bool
XtandemParamSaxHandler::endDocument()
{
return true;
return true;
}
bool
XtandemParamSaxHandler::startDocument()
{
/*<?xml version="1.0" encoding="UTF-8"?>
<bioml label="example api document">
<note type="input" label="spectrum, parent monoisotopic mass error
units">ppm</note> <note type="input" label="spectrum, parent monoisotopic mass
error minus">10</note>
*/
return true;
/*<?xml version="1.0" encoding="UTF-8"?>
<bioml label="example api document">
<note type="input" label="spectrum, parent monoisotopic mass error
units">ppm</note> <note type="input" label="spectrum, parent monoisotopic mass
error minus">10</note>
*/
return true;
}
bool
XtandemParamSaxHandler::characters(const QString &str)
{
_current_text += str;
return true;
_current_text += str;
return true;
}
bool
XtandemParamSaxHandler::startElement_note(QXmlAttributes attributes)
{
// qDebug() << "XtandemParamSaxHandler::startElement_note begin " <<
// attributes.value("type");
_current_label = "";
// qDebug() << "XtandemParamSaxHandler::startElement_note begin " <<
// attributes.value("type");
_current_label = "";
if(attributes.value("type") == "input")
if(attributes.value("type") == "input")
{
_current_label = attributes.value("label");
_current_label = attributes.value("label");
}
// qDebug() << "XtandemParamSaxHandler::startElement_note _current_label " <<
// _current_label;
return true;
// qDebug() << "XtandemParamSaxHandler::startElement_note _current_label " <<
// _current_label;
return true;
}
bool
XtandemParamSaxHandler::endElement_note()
{
// qDebug() << "XtandemParamSaxHandler::endElement_note begin " <<
// _current_label << " " << _current_text.simplified();
if(!_current_label.isEmpty())
// qDebug() << "XtandemParamSaxHandler::endElement_note begin " <<
// _current_label << " " << _current_text.simplified();
if(!_current_label.isEmpty())
{
try
try
{
_p_tandem_parameters->setParamLabelValue(_current_label,
_current_text.simplified());
_p_tandem_parameters->setParamLabelValue(_current_label,
_current_text.simplified());
}
catch(pappso::PappsoException &exception)
catch(pappso::PappsoException &exception)
{
_errorStr =
QObject::tr("Error reading tandem input parameter \"%1\" :\n%2")
.arg(_current_label)
.arg(exception.qwhat());
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
<< _errorStr;
return false;
_errorStr =
QObject::tr("Error reading tandem input parameter \"%1\" :\n%2")
.arg(_current_label)
.arg(exception.qwhat());
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
<< _errorStr;
return false;
}
}
return true;
return true;
}
......@@ -35,53 +35,53 @@ using namespace std;
int
main(int argc, char *argv[])
{
QTextStream errorStream(stderr, QIODevice::WriteOnly);
QApplication app(argc, argv);
QTextStream errorStream(stderr, QIODevice::WriteOnly);
QApplication app(argc, argv);
qRegisterMetaType<TandemRunBatch>("TandemRunBatch");
qRegisterMetaType<std::vector<pappso::pappso_double>>(
"std::vector<pappso::pappso_double>");
qRegisterMetaType<pappso::PrecisionPtr>("pappso::PrecisionPtr");
qRegisterMetaType<std::vector<pappso::XicCstSPtr>>(
"std::vector<pappso::XicCstSPtr>");
qRegisterMetaType<pappso::PeptideSp>("pappso::PeptideSp");
qRegisterMetaType<pappso::XicExtractMethod>("pappso::XicExtractMethod");
qRegisterMetaType<pappso::MassSpectrumCstSPtr>("pappso::MassSpectrumCstSPtr");
qRegisterMetaType<MsRunSp>("MsRunSp");
qRegisterMetaType<std::vector<pappso::PeptideNaturalIsotopeAverageSp>>(
"std::vector<pappso::PeptideNaturalIsotopeAverageSp>");
qRegisterMetaType<ExportFastaType>("ExportFastaType");
qRegisterMetaType<MasschroqFileParameters>("MasschroqFileParameters");
qRegisterMetaType<TandemRunBatch>("TandemRunBatch");
qRegisterMetaType<std::vector<pappso::pappso_double>>(
"std::vector<pappso::pappso_double>");
qRegisterMetaType<pappso::PrecisionPtr>("pappso::PrecisionPtr");
qRegisterMetaType<std::vector<pappso::XicCstSPtr>>(
"std::vector<pappso::XicCstSPtr>");
qRegisterMetaType<pappso::PeptideSp>("pappso::PeptideSp");
qRegisterMetaType<pappso::XicExtractMethod>("pappso::XicExtractMethod");
qRegisterMetaType<pappso::MassSpectrumCstSPtr>("pappso::MassSpectrumCstSPtr");
qRegisterMetaType<MsRunSp>("MsRunSp");
qRegisterMetaType<std::vector<pappso::PeptideNaturalIsotopeAverageSp>>(
"std::vector<pappso::PeptideNaturalIsotopeAverageSp>");
qRegisterMetaType<ExportFastaType>("ExportFastaType");
qRegisterMetaType<MasschroqFileParameters>("MasschroqFileParameters");
qRegisterMetaType<ContaminantRemovalMode>("ContaminantRemovalMode");
qRegisterMetaType<ContaminantRemovalMode>("ContaminantRemovalMode");
// qRegisterMetaType<pappso::PeakIonIsotopeMatch>("pappso::PeakIonIsotopeMatch");
// qRegisterMetaType<pappso::PeakIonIsotopeMatch>("pappso::PeakIonIsotopeMatch");
try
try
{
QCoreApplication::setOrganizationName("PAPPSO");
QCoreApplication::setOrganizationDomain("pappso.inra.fr");
QCoreApplication::setApplicationName("xtpcpp");
MainWindow window;
window.show();
QCoreApplication::setOrganizationName("PAPPSO");
QCoreApplication::setOrganizationDomain("pappso.inra.fr");
QCoreApplication::setApplicationName("xtpcpp");
MainWindow window;
window.show();
// This code will start the messaging engine in QT and in
// 10ms it will start the execution in the MainClass.run routine;
QTimer::singleShot(10, &window, SLOT(run()));
// This code will start the messaging engine in QT and in
// 10ms it will start the execution in the MainClass.run routine;
QTimer::singleShot(10, &window, SLOT(run()));
return app.exec();
return app.exec();
}
catch(pappso::PappsoException &error)
catch(pappso::PappsoException &error)
{
errorStream << "Oops! an error occurred in XTPcpp. Dont Panic :" << endl;
errorStream << error.qwhat() << endl;
app.exit(1);
errorStream << "Oops! an error occurred in XTPcpp. Dont Panic :" << endl;
errorStream << error.qwhat() << endl;
app.exit(1);
}
catch(std::exception &error)
catch(std::exception &error)
{
errorStream << "Oops! an error occurred in XTPcpp. Dont Panic :" << endl;
errorStream << error.what() << endl;
app.exit(1);
errorStream << "Oops! an error occurred in XTPcpp. Dont Panic :" << endl;
errorStream << error.what() << endl;
app.exit(1);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment