Commit 3e8e90ea authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add const + use std::as_const

parent 7900f855
Pipeline #177948 passed with stage
in 2 minutes and 20 seconds
......@@ -40,7 +40,7 @@ void ElementCountMap::add(ElementCountMap &_map)
}
}
QList<Element*> ElementCountMap::elements()
QList<Element*> ElementCountMap::elements() const
{
QList<Element*> list;
......@@ -267,7 +267,7 @@ Element *MoleculeParser::lookupElement(const QString& _name)
{
qCDebug(KALZIUM_LIBSCIENCE_LOG) << "looking up " << _name;
foreach (Element* e, m_elementList) {
for (Element* e : std::as_const(m_elementList)) {
if (e->dataAsVariant(ChemicalDataObject::symbol) == _name) {
qCDebug(KALZIUM_LIBSCIENCE_LOG) << "Found element " << _name;
return e;
......@@ -394,7 +394,7 @@ QString MoleculeParser::expandTerm (const QString& _group)
QFile file2(fileName);
// Check file validity
if (!(!file2.open(QIODevice::ReadOnly | QIODevice::Text))) {
if (file2.open(QIODevice::ReadOnly | QIODevice::Text)) {
qCDebug(KALZIUM_LIBSCIENCE_LOG) << fileName << " opened";
QTextStream in(&file2);
......
......@@ -127,7 +127,7 @@ public:
* is CO2, a list with C and O will be returned.
* @return the elements in the molecule
*/
QList<Element*> elements();
QList<Element*> elements() const;
/**
* @param _element
......
Supports Markdown
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