GCC Code Coverage Report


source/XpertMassCore/src/
File: source/XpertMassCore/src/PolChemDefSpec.cpp
Date: 2025-11-20 01:41:33
Lines:
14/14
100.0%
Functions:
6/6
100.0%
Branches:
3/4
75.0%

Line Branch Exec Source
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 /////////////////////// Stdlib includes
35
36
37 /////////////////////// Qt includes
38 #include <QString>
39 #include <QFileInfo>
40 #include <QDir>
41
42
43 /////////////////////// Local includes
44 #include "MsXpS/libXpertMassCore/PolChemDefSpec.hpp"
45
46
47 namespace MsXpS
48 {
49 namespace libXpertMassCore
50 {
51
52
53 /*!
54 \class MsXpS::libXpertMassCore::PolChemDefSpec
55 \inmodule libXpertMassCore
56 \ingroup PolChemDef
57 \inheaderfile PolChemDefSpec.hpp
58
59 \brief The PolChemDefSpec class provides metadata for accessing a given polymer
60 chemistry definition's data on disk.
61
62 \sa PolChemDef
63 */
64
65 /*!
66 \variable MsXpS::libXpertMassCore::PolChemDefSpec::m_name
67
68 \brief The name of the polymer chemistry definition, like \e{protein-1-letter}
69 or \e{nucac}, for example.
70
71 This name is typically identical to both the name of the directory where all
72 the data defining this \c PolChemDef is stored and the name of the XML file
73 that contains the definition itself.
74 */
75
76
77 /*!
78 \variable MsXpS::libXpertMassCore::PolChemDefSpec::m_filePath
79
80 \brief The path to the polymer chemistry defintion.
81
82 The path is relative to the polymer chemistry definitions directory in the data
83 directory, as found in the catalogue files, like
84 protein-1-letter/protein-1-letter.xml.
85 */
86
87 /*!
88 \brief Constructs a polymer chemistry definition specification instance using \a name as the PolChemDef name.
89 */
90
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 175 times.
175 PolChemDefSpec::PolChemDefSpec(const QString &name) : m_name(name)
91 {
92 175 }
93
94
95 /*!
96 \brief Destroys the polymer chemistry definition specification instance.
97 */
98 175 PolChemDefSpec::~PolChemDefSpec()
99 {
100 175 }
101
102 /*!
103 \brief Sets the \a name of the polymer chemistry definition.
104 */
105 void
106 5 PolChemDefSpec::setName(const QString &name)
107 {
108 5 m_name = name;
109 5 }
110
111 /*!
112 \brief Returns the name of the polymer chemistry definition.
113 */
114 const QString &
115 8 PolChemDefSpec::getName() const
116 {
117 8 return m_name;
118 }
119
120 /*!
121 \brief Sets the path to the polymer chemistry definition file to \a file_path.
122 */
123 void
124 5 PolChemDefSpec::setFilePath(const QString &file_path)
125 {
126 5 m_filePath = file_path;
127 5 }
128
129 /*!
130 \brief Returns the path to the polymer chemistry definition file.
131 */
132 QString
133 8 PolChemDefSpec::getFilePath() const
134 {
135
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2 times.
8 return m_filePath;
136 }
137
138 // GCOV_EXCL_START
139 /*!
140 \brief Returns the absolute path to the polymer chemistry definition file.
141
142 If m_filePath is "protein-1-letter/protein-1-letter.xml",
143 returns "<abspathtodir>/protein-1-letter"
144 */
145 QString
146 PolChemDefSpec::dirPath()
147 {
148 QFileInfo fileInfo(m_filePath);
149 QDir dir(fileInfo.dir());
150 return dir.absolutePath();
151 }
152 // GCOV_EXCL_STOP
153
154 } // namespace libXpertMassCore
155
156 } // namespace MsXpS
157