Changeset View
Changeset View
Standalone View
Standalone View
libscience/moleculeparser.cpp
Show All 34 Lines | |||||
35 | ElementCount *ElementCountMap::search(Element *_element) | 35 | ElementCount *ElementCountMap::search(Element *_element) | ||
36 | { | 36 | { | ||
37 | foreach (ElementCount *c, m_map) { | 37 | foreach (ElementCount *c, m_map) { | ||
38 | if (c->element() == _element) { | 38 | if (c->element() == _element) { | ||
39 | return c; | 39 | return c; | ||
40 | } | 40 | } | ||
41 | } | 41 | } | ||
42 | 42 | | |||
43 | return 0; | 43 | return nullptr; | ||
44 | } | 44 | } | ||
45 | 45 | | |||
46 | void ElementCountMap::add(ElementCountMap &_map) | 46 | void ElementCountMap::add(ElementCountMap &_map) | ||
47 | { | 47 | { | ||
48 | foreach (ElementCount *c, _map.m_map) { | 48 | foreach (ElementCount *c, _map.m_map) { | ||
49 | add(c->m_element, c->m_count); | 49 | add(c->m_element, c->m_count); | ||
50 | } | 50 | } | ||
51 | } | 51 | } | ||
▲ Show 20 Lines • Show All 232 Lines • ▼ Show 20 Line(s) | 280 | foreach (Element* e, m_elementList) { | |||
284 | } | 284 | } | ||
285 | } | 285 | } | ||
286 | 286 | | |||
287 | //if there is an error make m_error true. | 287 | //if there is an error make m_error true. | ||
288 | m_error = true; | 288 | m_error = true; | ||
289 | 289 | | |||
290 | qDebug() << "no such element!: " << _name; | 290 | qDebug() << "no such element!: " << _name; | ||
291 | 291 | | |||
292 | return NULL; | 292 | return nullptr; | ||
293 | } | 293 | } | ||
294 | 294 | | |||
295 | QString MoleculeParser::expandFormula( const QString& _shortString) | 295 | QString MoleculeParser::expandFormula( const QString& _shortString) | ||
296 | { | 296 | { | ||
297 | QString _fullString; // the expanded string that will be returned | 297 | QString _fullString; // the expanded string that will be returned | ||
298 | QString::const_iterator i; // iterator | 298 | QString::const_iterator i; // iterator | ||
299 | QString temp; // a temporary string that will contain a single element/group | 299 | QString temp; // a temporary string that will contain a single element/group | ||
300 | QString expandedTerm; // expansion of a particular term | 300 | QString expandedTerm; // expansion of a particular term | ||
▲ Show 20 Lines • Show All 136 Lines • Show Last 20 Lines |