Changeset 266875


Ignore:
Timestamp:
Feb 4, 2011, 6:56:38 PM (14 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
72d108
Parents:
15f6e9
git-author:
Frederik Heber <heber@…> (02/01/11 11:09:17)
git-committer:
Frederik Heber <heber@…> (02/04/11 18:56:38)
Message:

FIX: ParserError did not adhere to naming convention.

Location:
src
Files:
6 edited
2 moved

Legend:

Unmodified
Added
Removed
  • src/Descriptors/MoleculeFormulaDescriptor.cpp

    r15f6e9 r266875  
    4242}
    4343
    44 MoleculeDescriptor MoleculeByFormula(const std::string &_formula) throw(ParseError){
     44MoleculeDescriptor MoleculeByFormula(const std::string &_formula) throw(FormulaStringParseException){
    4545  Formula formula(_formula);
    4646  return MoleculeByFormula(formula);
  • src/Descriptors/MoleculeFormulaDescriptor.hpp

    r15f6e9 r266875  
    1616
    1717#include "Descriptors/MoleculeDescriptor.hpp"
    18 #include "Exceptions/ParseError.hpp"
     18#include "Exceptions/FormulaStringParseException.hpp"
    1919
    2020class Formula;
    2121
    2222MoleculeDescriptor MoleculeByFormula(const Formula&);
    23 MoleculeDescriptor MoleculeByFormula(const std::string&) throw(ParseError);
     23MoleculeDescriptor MoleculeByFormula(const std::string&) throw(FormulaStringParseException);
    2424
    2525#endif /* MOLECULEFORMULADESCRIPTOR_HPP_ */
  • src/Exceptions/FormulaStringParseException.cpp

    r15f6e9 r266875  
    77
    88/*
    9  * ParseError.cpp
     9 * FormulaStringParseException.cpp
    1010 *
    1111 *  Created on: Jul 21, 2010
     
    2020#include "CodePatterns/MemDebug.hpp"
    2121
    22 #include "ParseError.hpp"
     22#include "FormulaStringParseException.hpp"
    2323
    24 ParseError::ParseError(std::string file, int line) :
     24FormulaStringParseException::FormulaStringParseException(std::string file, int line) :
    2525  CustomException(file,line)
    2626{}
    2727
    28 ParseError::~ParseError() throw(){}
     28FormulaStringParseException::~FormulaStringParseException() throw(){}
    2929
    30 const char* ParseError::what() const throw(){
     30const char* FormulaStringParseException::what() const throw(){
    3131  return "Could not parse string";
    3232}
  • src/Exceptions/FormulaStringParseException.hpp

    r15f6e9 r266875  
    11/*
    2  * ParseError.hpp
     2 * FormulaStringParseException.hpp
    33 *
    44 *  Created on: Jul 21, 2010
     
    1717#include "Exceptions/CustomException.hpp"
    1818
    19 class ParseError : public CustomException
     19class FormulaStringParseException : public CustomException
    2020{
    2121public:
    22   ParseError(std::string file, int line);
    23   virtual ~ParseError() throw();
     22  FormulaStringParseException(std::string file, int line);
     23  virtual ~FormulaStringParseException() throw();
    2424
    2525  virtual const char* what() const throw();
  • src/Exceptions/Makefile.am

    r15f6e9 r266875  
    1616  NotOnSurfaceException.cpp \
    1717  ShapeException.cpp \
    18   ParseError.cpp \
     18  FormulaStringParseException.cpp \
    1919  SkewException.cpp \
    2020  ZeroVectorException.cpp
     
    2929  NotInvertibleException.hpp \
    3030  NotOnSurfaceException.hpp \
    31   ParseError.hpp \
     31  FormulaStringParseException.hpp \
    3232  SkewException.hpp \
    3333  ZeroVectorException.hpp
  • src/Formula.cpp

    r15f6e9 r266875  
    6868}
    6969
    70 void Formula::fromString(const std::string &formula) throw(ParseError){
     70void Formula::fromString(const std::string &formula) throw(FormulaStringParseException){
    7171  // make this transactional, in case an error is thrown
    7272  Formula res;
     
    7777}
    7878
    79 int Formula::parseMaybeNumber(string::const_iterator &it,string::const_iterator &end) throw(ParseError){
     79int Formula::parseMaybeNumber(string::const_iterator &it,string::const_iterator &end) throw(FormulaStringParseException){
    8080  static const range<char> Numbers = makeRange('0',static_cast<char>('9'+1));
    8181  int count = 0;
     
    8787}
    8888
    89 void Formula::parseFromString(string::const_iterator &it,string::const_iterator &end,char delimiter) throw(ParseError){
     89void Formula::parseFromString(string::const_iterator &it,string::const_iterator &end,char delimiter) throw(FormulaStringParseException){
    9090  // some constants needed for parsing... Assumes ASCII, change if other encodings are used
    9191  static const range<char> CapitalLetters = makeRange('A',static_cast<char>('Z'+1));
     
    103103      sub.parseFromString(++it,end,nextdelim);
    104104      if(!sub.getElementCount()){
    105         throw(ParseError(__FILE__,__LINE__));
     105        throw(FormulaStringParseException(__FILE__,__LINE__));
    106106      }
    107107      int count = parseMaybeNumber(++it,end);
     
    112112    // Atom names start with a capital letter
    113113    if(!CapitalLetters.isInRange(*it))
    114       throw(ParseError(__FILE__,__LINE__));
     114      throw(FormulaStringParseException(__FILE__,__LINE__));
    115115    shorthand+=(*it++);
    116116    // the rest of the name follows
     
    120120    // test if the shorthand exists
    121121    if(!World::getInstance().getPeriode()->FindElement(shorthand))
    122       throw(ParseError(__FILE__,__LINE__));
     122      throw(FormulaStringParseException(__FILE__,__LINE__));
    123123    // done, we can get the next one
    124124    addElements(shorthand,count);
    125125  }
    126126  if(it==end && delimiter!=0){
    127     throw(ParseError(__FILE__,__LINE__));
     127    throw(FormulaStringParseException(__FILE__,__LINE__));
    128128  }
    129129}
  • src/Formula.hpp

    r15f6e9 r266875  
    1919#include <iterator>
    2020
    21 #include "Exceptions/ParseError.hpp"
     21#include "Exceptions/FormulaStringParseException.hpp"
    2222
    2323#include "types.hpp"
     
    7171
    7272  std::string toString() const;
    73   void fromString(const std::string&) throw(ParseError);
     73  void fromString(const std::string&) throw(FormulaStringParseException);
    7474  bool checkOut(std::ostream*) const;
    7575
     
    112112
    113113private:
    114   void parseFromString(std::string::const_iterator&,std::string::const_iterator&,char) throw(ParseError);
    115   int parseMaybeNumber(std::string::const_iterator &it,std::string::const_iterator &end) throw(ParseError);
     114  void parseFromString(std::string::const_iterator&,std::string::const_iterator&,char) throw(FormulaStringParseException);
     115  int parseMaybeNumber(std::string::const_iterator &it,std::string::const_iterator &end) throw(FormulaStringParseException);
    116116  // this contains all counts of elements in the formula
    117117  // the size of the actual structure might be used in comparisons
  • src/unittests/FormulaUnitTest.cpp

    r15f6e9 r266875  
    246246  }
    247247  {
    248     CPPUNIT_ASSERT_THROW(Formula formula("74107"),ParseError);
    249     CPPUNIT_ASSERT_THROW(Formula formula("  "),ParseError);
    250     CPPUNIT_ASSERT_THROW(Formula formula("nAcL"),ParseError);
    251     CPPUNIT_ASSERT_THROW(Formula formula("NAcL"),ParseError);
    252     CPPUNIT_ASSERT_THROW(Formula formula("Na Cl"),ParseError);
    253     CPPUNIT_ASSERT_THROW(Formula formula("1NaCl"),ParseError);
    254     CPPUNIT_ASSERT_THROW(Formula formula("Mag"),ParseError);
    255     CPPUNIT_ASSERT_THROW(Formula formula("AgCl)"),ParseError);
    256     CPPUNIT_ASSERT_THROW(Formula formula("(Na"),ParseError);
    257     CPPUNIT_ASSERT_THROW(Formula formula("(Mag)"),ParseError);
    258     CPPUNIT_ASSERT_THROW(Formula formula("MgCl2)"),ParseError);
    259     CPPUNIT_ASSERT_THROW(Formula formula("((MgCl2)"),ParseError);
    260     CPPUNIT_ASSERT_THROW(Formula formula("(MgCl2))"),ParseError);
    261     CPPUNIT_ASSERT_THROW(Formula formula("(MgCl2]"),ParseError);
    262     CPPUNIT_ASSERT_THROW(Formula formula("[MgCl2)"),ParseError);
    263     CPPUNIT_ASSERT_THROW(Formula formula("N(aCl"),ParseError);
    264     CPPUNIT_ASSERT_THROW(Formula formula("Na()Cl"),ParseError);
     248    CPPUNIT_ASSERT_THROW(Formula formula("74107"),FormulaStringParseException);
     249    CPPUNIT_ASSERT_THROW(Formula formula("  "),FormulaStringParseException);
     250    CPPUNIT_ASSERT_THROW(Formula formula("nAcL"),FormulaStringParseException);
     251    CPPUNIT_ASSERT_THROW(Formula formula("NAcL"),FormulaStringParseException);
     252    CPPUNIT_ASSERT_THROW(Formula formula("Na Cl"),FormulaStringParseException);
     253    CPPUNIT_ASSERT_THROW(Formula formula("1NaCl"),FormulaStringParseException);
     254    CPPUNIT_ASSERT_THROW(Formula formula("Mag"),FormulaStringParseException);
     255    CPPUNIT_ASSERT_THROW(Formula formula("AgCl)"),FormulaStringParseException);
     256    CPPUNIT_ASSERT_THROW(Formula formula("(Na"),FormulaStringParseException);
     257    CPPUNIT_ASSERT_THROW(Formula formula("(Mag)"),FormulaStringParseException);
     258    CPPUNIT_ASSERT_THROW(Formula formula("MgCl2)"),FormulaStringParseException);
     259    CPPUNIT_ASSERT_THROW(Formula formula("((MgCl2)"),FormulaStringParseException);
     260    CPPUNIT_ASSERT_THROW(Formula formula("(MgCl2))"),FormulaStringParseException);
     261    CPPUNIT_ASSERT_THROW(Formula formula("(MgCl2]"),FormulaStringParseException);
     262    CPPUNIT_ASSERT_THROW(Formula formula("[MgCl2)"),FormulaStringParseException);
     263    CPPUNIT_ASSERT_THROW(Formula formula("N(aCl"),FormulaStringParseException);
     264    CPPUNIT_ASSERT_THROW(Formula formula("Na()Cl"),FormulaStringParseException);
    265265  }
    266266
Note: See TracChangeset for help on using the changeset viewer.