GCC Code Coverage Report


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