libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
massspectrumjs.cpp
Go to the documentation of this file.
1/* BEGIN software license
2 *
3 * msXpertSuite - mass spectrometry software suite
4 * -----------------------------------------------
5 * Copyright(C) 2009,...,2018 Filippo Rusconi
6 *
7 * http://www.msxpertsuite.org
8 *
9 * This file is part of the msXpertSuite project.
10 *
11 * The msXpertSuite project is the successor of the massXpert project. This
12 * project now includes various independent modules:
13 *
14 * - massXpert, model polymer chemistries and simulate mass spectrometric data;
15 * - mineXpert, a powerful TIC chromatogram/mass spectrum viewer/miner;
16 *
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29 *
30 * END software license
31 */
32
33
34/////////////////////// Qt includes
35
36
37/////////////////////// Local includes
38#include "massspectrumjs.h"
39#include "jsclassregistrar.h"
40
41
42namespace pappso
43{
44
45MassSpectrumJs::MassSpectrumJs(QObject *parent) : QObject(parent)
46{
47}
48
49
53
54
55// For the invokable method
56int
58{
59 return static_cast<int>(m_massSpectrum.size());
60}
61
62// For the property
63int
65{
66 return getCount();
67}
68
69void
71{
72 if(!engine)
73 {
74 qWarning() << "Cannot register class: engine is null";
75 return;
76 }
77
78 // Register the meta object as a constructor
79 QJSValue jsMetaObject = engine->newQMetaObject(&MassSpectrumJs::staticMetaObject);
80 engine->globalObject().setProperty("MassSpectrum", jsMetaObject);
81}
82
83} // namespace pappso
MassSpectrum m_massSpectrum
Q_INVOKABLE MassSpectrumJs(QObject *parent=nullptr)
static void registerJsConstructor(QJSEngine *engine)
Q_INVOKABLE int getCount() const
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39