Changes in src/Formula.cpp [426f2a:bcf653]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Formula.cpp
r426f2a rbcf653 1 /* 2 * Project: MoleCuilder 3 * Description: creates and alters molecular systems 4 * Copyright (C) 2010 University of Bonn. All rights reserved. 5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. 6 */ 7 1 8 /* 2 9 * Formula.cpp … … 6 13 */ 7 14 15 // include config.h 16 #ifdef HAVE_CONFIG_H 17 #include <config.h> 18 #endif 19 20 #include "Helpers/MemDebug.hpp" 21 8 22 #include "Formula.hpp" 9 23 … … 47 61 for(const_iterator iter=end();iter!=begin();){ 48 62 --iter; 49 sstr << (*iter).first-> symbol;63 sstr << (*iter).first->getSymbol(); 50 64 if((*iter).second>1) 51 65 sstr << (*iter).second; … … 146 160 147 161 bool Formula::hasElement(const string &shorthand) const{ 148 element * element = World::getInstance().getPeriode()->FindElement(shorthand);162 const element * element = World::getInstance().getPeriode()->FindElement(shorthand); 149 163 return hasElement(element); 150 164 } … … 167 181 168 182 void Formula::operator+=(const string &shorthand){ 169 element * element = World::getInstance().getPeriode()->FindElement(shorthand);183 const element * element = World::getInstance().getPeriode()->FindElement(shorthand); 170 184 operator+=(element); 171 185 } … … 198 212 199 213 void Formula::operator-=(const string &shorthand){ 200 element * element = World::getInstance().getPeriode()->FindElement(shorthand);214 const element * element = World::getInstance().getPeriode()->FindElement(shorthand); 201 215 operator-=(element); 202 216 } … … 220 234 221 235 void Formula::addElements(const string &shorthand,unsigned int count){ 222 element * element = World::getInstance().getPeriode()->FindElement(shorthand);236 const element * element = World::getInstance().getPeriode()->FindElement(shorthand); 223 237 addElements(element,count); 224 238 } … … 252 266 253 267 const unsigned int Formula::operator[](string shorthand) const{ 254 element * element = World::getInstance().getPeriode()->FindElement(shorthand);268 const element * element = World::getInstance().getPeriode()->FindElement(shorthand); 255 269 return operator[](element); 256 270 } … … 380 394 result_type 381 395 Formula::_iterator<result_type>::operator*(){ 382 element *element = World::getInstance().getPeriode()->FindElement(pos+1);396 const element *element = World::getInstance().getPeriode()->FindElement(pos+1); 383 397 ASSERT(element,"Element with position of iterator not found"); 384 398 return make_pair(element,(*set)[pos]); … … 390 404 // no one can keep this value around, so a static is ok to avoid temporaries 391 405 static value_type value=make_pair(reinterpret_cast<element*>(0),0); // no default constructor for std::pair 392 element *element = World::getInstance().getPeriode()->FindElement(pos+1);406 const element *element = World::getInstance().getPeriode()->FindElement(pos+1); 393 407 ASSERT(element,"Element with position of iterator not found"); 394 408 value = make_pair(element,(*set)[pos]);
Note:
See TracChangeset
for help on using the changeset viewer.