Changeset 9d5531 for src/UIElements/TextUI
- Timestamp:
- Jul 18, 2012, 2:02:13 PM (13 years ago)
- 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:
- b3a54d
- Parents:
- 30cd0d
- git-author:
- Michael Ankele <ankele@…> (07/04/12 13:49:18)
- git-committer:
- Michael Ankele <ankele@…> (07/18/12 14:02:13)
- Location:
- src/UIElements/TextUI
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/TextUI/Query/AtomTextQuery.cpp
r30cd0d r9d5531 30 30 #include "World.hpp" 31 31 32 TextDialog::AtomTextQuery::AtomTextQuery(Parameter<const atom *> & param, std::string title, std::string _description) :33 Dialog::AtomQuery( param, title,_description)32 TextDialog::AtomTextQuery::AtomTextQuery(Parameter<const atom *> &_param, std::string title, std::string _description) : 33 Dialog::AtomQuery(_param, title,_description) 34 34 {} 35 35 … … 51 51 } 52 52 53 const atom * temp_atom= World::getInstance().getAtom(AtomById(idxOfAtom));54 if(!temp _atom&& idxOfAtom!=-1){53 temp = World::getInstance().getAtom(AtomById(idxOfAtom)); 54 if(!temp && idxOfAtom!=-1){ 55 55 std::cout << "Invalid Atom Index" << idxOfAtom << std::endl; 56 56 badInput = true; 57 } 58 tmp.set(temp_atom);57 }else 58 param.set(temp); 59 59 60 60 } while(badInput); -
src/UIElements/TextUI/Query/AtomsTextQuery.cpp
r30cd0d r9d5531 31 31 32 32 33 TextDialog::AtomsTextQuery::AtomsTextQuery(Parameter<std::vector<const atom *> > & param, std::string title, std::string _description) :34 Dialog::AtomsQuery( param, title,_description)33 TextDialog::AtomsTextQuery::AtomsTextQuery(Parameter<std::vector<const atom *> > &_param, std::string title, std::string _description) : 34 Dialog::AtomsQuery(_param, title,_description) 35 35 {} 36 36 … … 44 44 // dissect by " " 45 45 std::string::iterator olditer = line.begin(); 46 std::vector<const atom *> temp_atoms;47 46 for(std::string::iterator iter = line.begin(); iter != line.end(); ++iter) { 48 47 if (*iter == ' ') { 49 48 std::istringstream stream(std::string(iter, olditer)); 50 49 stream >> idxOfAtom; 51 temp = World::getInstance().getAtom(AtomById(idxOfAtom));52 if(!temp && idxOfAtom!=-1){50 temp_element = World::getInstance().getAtom(AtomById(idxOfAtom)); 51 if(!temp_element && idxOfAtom!=-1){ 53 52 std::cout << "Invalid Atom Index" << idxOfAtom << std::endl; 54 53 break; 55 54 } 56 temp _atoms.push_back(temp);55 temp.push_back(temp_element); 57 56 olditer = iter; 58 57 } … … 61 60 std::istringstream stream(std::string(olditer, line.end())); 62 61 stream >> idxOfAtom; 63 temp = World::getInstance().getAtom(AtomById(idxOfAtom));64 if(!temp && idxOfAtom!=-1) {62 temp_element = World::getInstance().getAtom(AtomById(idxOfAtom)); 63 if(!temp_element && idxOfAtom!=-1) { 65 64 std::cout << "Invalid Atom Index" << idxOfAtom << std::endl; 66 temp _atoms.push_back(temp);65 temp.push_back(temp_element); 67 66 } 68 67 } 69 tmp.set(temp_atoms);68 param.set(temp); 70 69 71 70 return (idxOfAtom!=-1); -
src/UIElements/TextUI/Query/BooleanTextQuery.cpp
r30cd0d r9d5531 28 28 29 29 30 TextDialog::BooleanTextQuery::BooleanTextQuery(Parameter<bool> & param, std::string title, std::string _description) :31 Dialog::BooleanQuery( param, title,_description)30 TextDialog::BooleanTextQuery::BooleanTextQuery(Parameter<bool> &_param, std::string title, std::string _description) : 31 Dialog::BooleanQuery(_param, title,_description) 32 32 {} 33 33 … … 42 42 std::cin >> input; 43 43 if ((input == 'y' ) || (input == 'Y')) { 44 tmp.set(true);44 param.set(true); 45 45 } else if ((input == 'n' ) || (input == 'N')) { 46 tmp.set(false);46 param.set(false); 47 47 } else { 48 48 badInput=true; -
src/UIElements/TextUI/Query/DoubleTextQuery.cpp
r30cd0d r9d5531 28 28 29 29 30 TextDialog::DoubleTextQuery::DoubleTextQuery(Parameter<double> & param, std::string title, std::string _description) :31 Dialog::DoubleQuery( param, title,_description)30 TextDialog::DoubleTextQuery::DoubleTextQuery(Parameter<double> &_param, std::string title, std::string _description) : 31 Dialog::DoubleQuery(_param, title,_description) 32 32 {} 33 33 … … 39 39 badInput = false; 40 40 std::cout << getDescription() << ": ";\ 41 double temp_double; 42 std::cin >> temp_double; 41 std::cin >> temp; 43 42 if(std::cin.fail()){ 44 43 badInput = true; … … 46 45 std::cin.ignore(std::numeric_limits<streamsize>::max(),'\n'); 47 46 std::cout << "Input was not a number!" << std::endl; 48 } 49 tmp.set(temp_double);47 }else 48 param.set(temp); 50 49 }while(badInput); 51 50 std::cin.ignore(std::numeric_limits<streamsize>::max(),'\n'); -
src/UIElements/TextUI/Query/DoublesTextQuery.cpp
r30cd0d r9d5531 28 28 29 29 30 TextDialog::DoublesTextQuery::DoublesTextQuery(Parameter<std::vector<double> > & param, std::string title, std::string _description) :31 Dialog::DoublesQuery( param, title,_description)30 TextDialog::DoublesTextQuery::DoublesTextQuery(Parameter<std::vector<double> > &_param, std::string title, std::string _description) : 31 Dialog::DoublesQuery(_param, title,_description) 32 32 {} 33 33 … … 40 40 // dissect by " " 41 41 std::string::iterator olditer = line.begin(); 42 std::vector<double> temp_doubles;43 42 for(std::string::iterator iter = line.begin(); iter != line.end(); ++iter) { 44 43 if (*iter == ' ') { 45 44 std::istringstream stream(std::string(iter, olditer)); 46 stream >> temp ;47 temp _doubles.push_back(temp);45 stream >> temp_element; 46 temp.push_back(temp_element); 48 47 olditer = iter; 49 48 } … … 51 50 if (olditer != line.begin()) { // insert last part also 52 51 std::istringstream stream(std::string(olditer, line.end())); 53 stream >> temp ;54 temp _doubles.push_back(temp);52 stream >> temp_element; 53 temp.push_back(temp_element); 55 54 } 56 tmp.set(temp_doubles);55 param.set(temp); 57 56 58 57 return true; -
src/UIElements/TextUI/Query/ElementTextQuery.cpp
r30cd0d r9d5531 31 31 32 32 33 TextDialog::ElementTextQuery::ElementTextQuery(Parameter<const element *> & param, std::string title, std::string _description) :34 Dialog::ElementQuery( param, title,_description)33 TextDialog::ElementTextQuery::ElementTextQuery(Parameter<const element *> &_param, std::string title, std::string _description) : 34 Dialog::ElementQuery(_param, title,_description) 35 35 {} 36 36 … … 41 41 bool badInput=false; 42 42 bool aborted = false; 43 const element *temp = NULL;43 temp = NULL; 44 44 do{ 45 45 badInput = false; -
src/UIElements/TextUI/Query/ElementsTextQuery.cpp
r30cd0d r9d5531 35 35 36 36 37 TextDialog::ElementsTextQuery::ElementsTextQuery(Parameter<std::vector<const element *> > & param, std::string title, std::string _description) :38 Dialog::ElementsQuery( param, title,_description)37 TextDialog::ElementsTextQuery::ElementsTextQuery(Parameter<std::vector<const element *> > &_param, std::string title, std::string _description) : 38 Dialog::ElementsQuery(_param, title,_description) 39 39 {} 40 40 … … 50 50 // dissect by " " 51 51 std::string::iterator olditer = line.begin(); 52 std::vector<const element *> temp_elements;53 52 for(std::string::iterator iter = line.begin(); iter != line.end(); ++iter) { 54 53 if (*iter == ' ') { … … 57 56 try { 58 57 Z = lexical_cast<int>(shorthand); 59 temp = World::getInstance().getPeriode()->FindElement(Z);58 temp_element = World::getInstance().getPeriode()->FindElement(Z); 60 59 } catch (bad_lexical_cast) { 61 temp = World::getInstance().getPeriode()->FindElement(shorthand.c_str());60 temp_element = World::getInstance().getPeriode()->FindElement(shorthand.c_str()); 62 61 }; 63 if(!temp && Z!=-1){62 if(!temp_element && Z!=-1){ 64 63 std::cout << "Invalid Element" << shorthand << std::endl; 65 64 break; 66 65 } 67 temp _elements.push_back(temp);66 temp.push_back(temp_element); 68 67 olditer = iter; 69 68 } … … 74 73 try { 75 74 Z = lexical_cast<int>(shorthand); 76 temp = World::getInstance().getPeriode()->FindElement(Z);75 temp_element = World::getInstance().getPeriode()->FindElement(Z); 77 76 } catch (bad_lexical_cast) { 78 temp = World::getInstance().getPeriode()->FindElement(shorthand.c_str());77 temp_element = World::getInstance().getPeriode()->FindElement(shorthand.c_str()); 79 78 }; 80 if(!temp && Z!=-1) {79 if(!temp_element && Z!=-1) { 81 80 std::cout << "Invalid Element" << shorthand << std::endl; 82 temp _elements.push_back(temp);81 temp.push_back(temp_element); 83 82 } 84 83 } 85 tmp.set(temp_elements);84 param.set(temp); 86 85 87 86 return (Z!=-1); -
src/UIElements/TextUI/Query/FileTextQuery.cpp
r30cd0d r9d5531 31 31 32 32 33 TextDialog::FileTextQuery::FileTextQuery(Parameter<boost::filesystem::path> & param, std::string title, std::string _description) :34 Dialog::FileQuery( param, title,_description)33 TextDialog::FileTextQuery::FileTextQuery(Parameter<boost::filesystem::path> &_param, std::string title, std::string _description) : 34 Dialog::FileQuery(_param, title,_description) 35 35 {} 36 36 … … 39 39 bool TextDialog::FileTextQuery::handle() { 40 40 bool badInput = false; 41 std::string tempstring;42 41 do{ 43 42 badInput = false; 44 43 std::cout << getDescription() << ": "; 45 std::cin >> temp string;44 std::cin >> temp; 46 45 if(std::cin.fail()){ 47 46 badInput = true; … … 53 52 } while(badInput); 54 53 std::cin.ignore(std::numeric_limits<streamsize>::max(),'\n'); 55 tmp.set(tempstring);54 param.set(temp); 56 55 return true; 57 56 } -
src/UIElements/TextUI/Query/FilesTextQuery.cpp
r30cd0d r9d5531 31 31 32 32 33 TextDialog::FilesTextQuery::FilesTextQuery(Parameter<std::vector< boost::filesystem::path> > & param, std::string title, std::string _description) :34 Dialog::FilesQuery( param, title,_description)33 TextDialog::FilesTextQuery::FilesTextQuery(Parameter<std::vector< boost::filesystem::path> > &_param, std::string title, std::string _description) : 34 Dialog::FilesQuery(_param, title,_description) 35 35 {} 36 36 … … 64 64 } while(continueflag); 65 65 std::cin.ignore(std::numeric_limits<streamsize>::max(),'\n'); 66 tmp.set(tempfiles);66 param.set(tempfiles); 67 67 return true; 68 68 } -
src/UIElements/TextUI/Query/IntTextQuery.cpp
r30cd0d r9d5531 28 28 29 29 30 TextDialog::IntTextQuery::IntTextQuery(Parameter<int> & param, std::string title, std::string _description) :31 Dialog::IntQuery( param, title,_description)30 TextDialog::IntTextQuery::IntTextQuery(Parameter<int> &_param, std::string title, std::string _description) : 31 Dialog::IntQuery(_param, title,_description) 32 32 {} 33 33 … … 39 39 badInput = false; 40 40 std::cout << getDescription() << ": "; 41 int temp_int; 42 std::cin >> temp_int; 43 tmp.set(temp_int); 41 std::cin >> temp; 44 42 if(std::cin.fail()){ 45 43 badInput=true; … … 47 45 std::cin.ignore(std::numeric_limits<streamsize>::max(),'\n'); 48 46 std::cout << "Input was not a number!" << std::endl; 49 } 47 }else 48 param.set(temp); 50 49 } while(badInput); 51 50 // clear the input buffer of anything still in the line -
src/UIElements/TextUI/Query/IntsTextQuery.cpp
r30cd0d r9d5531 28 28 29 29 30 TextDialog::IntsTextQuery::IntsTextQuery(Parameter<std::vector<int> > & param, std::string title, std::string _description) :31 Dialog::IntsQuery( param, title,_description)30 TextDialog::IntsTextQuery::IntsTextQuery(Parameter<std::vector<int> > &_param, std::string title, std::string _description) : 31 Dialog::IntsQuery(_param, title,_description) 32 32 {} 33 33 … … 39 39 getline(std::cin,line); 40 40 // dissect by " " 41 std::vector<int> temp_int;42 41 std::string::iterator olditer = line.begin(); 43 42 for(std::string::iterator iter = line.begin(); iter != line.end(); ++iter) { 44 43 if (*iter == ' ') { 45 44 std::istringstream stream(std::string(iter, olditer)); 46 stream >> temp ;47 temp _int.push_back(temp);45 stream >> temp_element; 46 temp.push_back(temp_element); 48 47 olditer = iter; 49 48 } … … 51 50 if (olditer != line.begin()) { // insert last part also 52 51 std::istringstream stream(std::string(olditer, line.end())); 53 stream >> temp ;54 temp _int.push_back(temp);52 stream >> temp_element; 53 temp.push_back(temp_element); 55 54 } 56 tmp.set(temp_int);55 param.set(temp); 57 56 58 57 return true; -
src/UIElements/TextUI/Query/MoleculeTextQuery.cpp
r30cd0d r9d5531 31 31 32 32 33 TextDialog::MoleculeTextQuery::MoleculeTextQuery(Parameter<const molecule *> & param, std::string title, std::string _description) :34 Dialog::MoleculeQuery( param, title,_description)33 TextDialog::MoleculeTextQuery::MoleculeTextQuery(Parameter<const molecule *> &_param, std::string title, std::string _description) : 34 Dialog::MoleculeQuery(_param, title,_description) 35 35 {} 36 36 … … 52 52 } 53 53 54 const molecule *temp_mol= World::getInstance().getMolecule(MoleculeById(idxOfMol));55 if(!temp _mol&& idxOfMol!=-1){54 temp = World::getInstance().getMolecule(MoleculeById(idxOfMol)); 55 if(!temp && idxOfMol!=-1){ 56 56 std::cout << "Invalid Molecule Index" << std::endl; 57 57 badInput = true; 58 58 } 59 tmp.set(temp_mol);59 param.set(temp); 60 60 61 61 } while(badInput); -
src/UIElements/TextUI/Query/MoleculesTextQuery.cpp
r30cd0d r9d5531 31 31 32 32 33 TextDialog::MoleculesTextQuery::MoleculesTextQuery(Parameter<std::vector<const molecule *> > & param, std::string title, std::string _description) :34 Dialog::MoleculesQuery( param, title,_description)33 TextDialog::MoleculesTextQuery::MoleculesTextQuery(Parameter<std::vector<const molecule *> > &_param, std::string title, std::string _description) : 34 Dialog::MoleculesQuery(_param, title,_description) 35 35 {} 36 36 … … 43 43 getline(std::cin,line); 44 44 // dissect by " " 45 std::vector<const molecule *> temp_mols;46 45 std::string::iterator olditer = line.begin(); 47 46 for(std::string::iterator iter = line.begin(); iter != line.end(); ++iter) { … … 49 48 std::istringstream stream(std::string(iter, olditer)); 50 49 stream >> idxOfMol; 51 temp = World::getInstance().getMolecule(MoleculeById(idxOfMol));52 if(!temp && idxOfMol!=-1){50 temp_element = World::getInstance().getMolecule(MoleculeById(idxOfMol)); 51 if(!temp_element && idxOfMol!=-1){ 53 52 std::cout << "Invalid Molecule Index" << idxOfMol << std::endl; 54 53 break; 55 54 } 56 temp _mols.push_back(temp);55 temp.push_back(temp_element); 57 56 olditer = iter; 58 57 } … … 61 60 std::istringstream stream(std::string(olditer, line.end())); 62 61 stream >> idxOfMol; 63 temp = World::getInstance().getMolecule(MoleculeById(idxOfMol));64 if(!temp && idxOfMol!=-1){62 temp_element = World::getInstance().getMolecule(MoleculeById(idxOfMol)); 63 if(!temp_element && idxOfMol!=-1){ 65 64 std::cout << "Invalid Molecule Index" << idxOfMol << std::endl; 66 temp _mols.push_back(temp);65 temp.push_back(temp_element); 67 66 } 68 67 } 69 tmp.set(temp_mols);68 param.set(temp); 70 69 71 70 return (idxOfMol!=-1); -
src/UIElements/TextUI/Query/RandomNumberDistribution_ParametersTextQuery.cpp
r30cd0d r9d5531 30 30 #include "RandomNumbers/RandomNumberDistribution_Parameters.hpp" 31 31 32 TextDialog::RandomNumberDistribution_ParametersTextQuery::RandomNumberDistribution_ParametersTextQuery(Parameter<RandomNumberDistribution_Parameters> & param, std::string title, std::string _description) :33 Dialog::RandomNumberDistribution_ParametersQuery( param, title,_description)32 TextDialog::RandomNumberDistribution_ParametersTextQuery::RandomNumberDistribution_ParametersTextQuery(Parameter<RandomNumberDistribution_Parameters> &_param, std::string title, std::string _description) : 33 Dialog::RandomNumberDistribution_ParametersQuery(_param, title,_description) 34 34 {} 35 35 … … 43 43 std::cout << "Please enter parameters as follows: 'p=0.5;'"; 44 44 std::cout << "Empty line terminates." << std::endl; 45 RandomNumberDistribution_Parameters temp_params; 46 std::cin >> temp_params; 47 tmp.set(temp_params); 45 std::cin >> temp; 48 46 if(std::cin.fail()){ 49 47 badInput = true; … … 53 51 continue; 54 52 } 53 param.set(temp); 55 54 56 55 } while(badInput); -
src/UIElements/TextUI/Query/RealSpaceMatrixTextQuery.cpp
r30cd0d r9d5531 29 29 30 30 31 TextDialog::RealSpaceMatrixTextQuery::RealSpaceMatrixTextQuery(Parameter<RealSpaceMatrix> & param, std::string title, std::string _description) :32 Dialog::RealSpaceMatrixQuery( param, title,_description)31 TextDialog::RealSpaceMatrixTextQuery::RealSpaceMatrixTextQuery(Parameter<RealSpaceMatrix> &_param, std::string title, std::string _description) : 32 Dialog::RealSpaceMatrixQuery(_param, title,_description) 33 33 {} 34 34 … … 39 39 std::cout << getTitle(); 40 40 41 double temp[6];41 double dtemp[6]; 42 42 std::cout << getDescription() << " - "; 43 43 std::string coords[6] = {"xx","yx","yy", "zx", "zy", "zz"}; 44 44 for (int i=0;i<6;i++) { 45 45 std::cout << coords[i] << ": "; 46 std::cin >> temp[i];46 std::cin >> dtemp[i]; 47 47 } 48 RealSpaceMatrix M; 49 M.set(0,0, temp[0]); 50 M.set(0,1, temp[1]); 51 M.set(0,2, temp[2]); 52 M.set(1,0, temp[1]); 53 M.set(1,1, temp[3]); 54 M.set(1,2, temp[4]); 55 M.set(2,0, temp[2]); 56 M.set(2,1, temp[4]); 57 M.set(2,2, temp[5]); 58 tmp.set(M); 48 temp.set(0,0, dtemp[0]); 49 temp.set(0,1, dtemp[1]); 50 temp.set(0,2, dtemp[2]); 51 temp.set(1,0, dtemp[1]); 52 temp.set(1,1, dtemp[3]); 53 temp.set(1,2, dtemp[4]); 54 temp.set(2,0, dtemp[2]); 55 temp.set(2,1, dtemp[4]); 56 temp.set(2,2, dtemp[5]); 57 param.set(temp); 59 58 return true; 60 59 } -
src/UIElements/TextUI/Query/StringTextQuery.cpp
r30cd0d r9d5531 28 28 29 29 30 TextDialog::StringTextQuery::StringTextQuery(Parameter<std::string> & param, std::string title, std::string _description) :31 Dialog::StringQuery( param, title,_description)30 TextDialog::StringTextQuery::StringTextQuery(Parameter<std::string> &_param, std::string title, std::string _description) : 31 Dialog::StringQuery(_param, title,_description) 32 32 {} 33 33 … … 36 36 bool TextDialog::StringTextQuery::handle() { 37 37 std::cout << getDescription() << ": "; 38 std::string temp_string; 39 getline(std::cin,temp_string); 40 tmp.set(temp_string); 38 getline(std::cin,temp); 39 param.set(temp); 41 40 return true; 42 41 } -
src/UIElements/TextUI/Query/StringsTextQuery.cpp
r30cd0d r9d5531 28 28 29 29 30 TextDialog::StringsTextQuery::StringsTextQuery(Parameter<std::vector<std::string> > & param, std::string title, std::string _description) :31 Dialog::StringsQuery( param, title,_description)30 TextDialog::StringsTextQuery::StringsTextQuery(Parameter<std::vector<std::string> > &_param, std::string title, std::string _description) : 31 Dialog::StringsQuery(_param, title,_description) 32 32 {} 33 33 … … 36 36 bool TextDialog::StringsTextQuery::handle() { 37 37 std::cout << getDescription() << ": "; 38 getline(std::cin,temp );38 getline(std::cin,temp_element); 39 39 // dissect by " " 40 std::vector<std::string> temp_strings; 41 std::string::iterator olditer = temp.begin(); 42 for(std::string::iterator iter = temp.begin(); iter != temp.end(); ++iter) { 40 std::string::iterator olditer = temp_element.begin(); 41 for(std::string::iterator iter = temp_element.begin(); iter != temp_element.end(); ++iter) { 43 42 if (*iter == ' ') { 44 temp _strings.push_back(std::string(iter, olditer));43 temp.push_back(std::string(iter, olditer)); 45 44 olditer = iter; 46 45 } 47 46 } 48 if (olditer != temp .begin()) // insert last part also49 temp _strings.push_back(std::string(olditer, temp.end()));50 tmp.set(temp_strings);47 if (olditer != temp_element.begin()) // insert last part also 48 temp.push_back(std::string(olditer, temp_element.end())); 49 param.set(temp); 51 50 52 51 return true; -
src/UIElements/TextUI/Query/TextQuery.hpp
r30cd0d r9d5531 152 152 class TextDialog::VectorTextQuery : public Dialog::VectorQuery { 153 153 public: 154 VectorTextQuery(Parameter<Vector> &, std::string title, bool _check,std::string _description = NULL);154 VectorTextQuery(Parameter<Vector> &, std::string title, std::string _description = NULL); 155 155 virtual ~VectorTextQuery(); 156 156 virtual bool handle(); … … 159 159 class TextDialog::VectorsTextQuery : public Dialog::VectorsQuery { 160 160 public: 161 VectorsTextQuery(Parameter<std::vector<Vector> > &, std::string title, bool _check,std::string _description = NULL);161 VectorsTextQuery(Parameter<std::vector<Vector> > &, std::string title, std::string _description = NULL); 162 162 virtual ~VectorsTextQuery(); 163 163 virtual bool handle(); -
src/UIElements/TextUI/Query/UnsignedIntTextQuery.cpp
r30cd0d r9d5531 28 28 29 29 30 TextDialog::UnsignedIntTextQuery::UnsignedIntTextQuery(Parameter<unsigned int> & param, std::string title, std::string _description) :31 Dialog::UnsignedIntQuery( param, title,_description)30 TextDialog::UnsignedIntTextQuery::UnsignedIntTextQuery(Parameter<unsigned int> &_param, std::string title, std::string _description) : 31 Dialog::UnsignedIntQuery(_param, title,_description) 32 32 {} 33 33 … … 39 39 badInput = false; 40 40 std::cout << getDescription() << ": "; 41 unsigned int temp_uint; 42 std::cin >> temp_uint; 41 std::cin >> temp; 43 42 if(std::cin.fail()){ 44 43 badInput=true; … … 46 45 std::cin.ignore(std::numeric_limits<streamsize>::max(),'\n'); 47 46 std::cout << "Input was not a number!" << std::endl; 48 } 49 tmp.set(temp_uint);47 }else 48 param.set(temp); 50 49 } while(badInput); 51 50 // clear the input buffer of anything still in the line -
src/UIElements/TextUI/Query/UnsignedIntsTextQuery.cpp
r30cd0d r9d5531 28 28 29 29 30 TextDialog::UnsignedIntsTextQuery::UnsignedIntsTextQuery(Parameter<std::vector<unsigned int> > & param, std::string title, std::string _description) :31 Dialog::UnsignedIntsQuery( param, title,_description)30 TextDialog::UnsignedIntsTextQuery::UnsignedIntsTextQuery(Parameter<std::vector<unsigned int> > &_param, std::string title, std::string _description) : 31 Dialog::UnsignedIntsQuery(_param, title,_description) 32 32 {} 33 33 … … 39 39 getline(std::cin,line); 40 40 // dissect by " " 41 std::vector<unsigned int> temp_uints;42 41 std::string::iterator olditer = line.begin(); 43 42 for(std::string::iterator iter = line.begin(); iter != line.end(); ++iter) { 44 43 if (*iter == ' ') { 45 44 std::istringstream stream(std::string(iter, olditer)); 46 stream >> temp ;47 temp _uints.push_back(temp);45 stream >> temp_element; 46 temp.push_back(temp_element); 48 47 olditer = iter; 49 48 } … … 51 50 if (olditer != line.begin()) { // insert last part also 52 51 std::istringstream stream(std::string(olditer, line.end())); 53 stream >> temp ;54 temp _uints.push_back(temp);52 stream >> temp_element; 53 temp.push_back(temp_element); 55 54 } 56 tmp.set(temp_uints);55 param.set(temp); 57 56 58 57 return true; -
src/UIElements/TextUI/Query/VectorTextQuery.cpp
r30cd0d r9d5531 31 31 32 32 33 TextDialog::VectorTextQuery::VectorTextQuery(Parameter<Vector> & param, std::string title, bool _check, std::string _description) :34 Dialog::VectorQuery( param, title,_check,_description)33 TextDialog::VectorTextQuery::VectorTextQuery(Parameter<Vector> &_param, std::string title, std::string _description) : 34 Dialog::VectorQuery(_param, title,_description) 35 35 {} 36 36 … … 48 48 getline(std::cin,line); 49 49 50 Vector temp_vector;51 52 50 // dissect by "," 53 51 double coord = 0.; … … 58 56 std::istringstream stream(std::string(iter, olditer)); 59 57 stream >> coord; 60 temp _vector[counter++] = coord;58 temp[counter++] = coord; 61 59 olditer = iter; 62 60 } … … 65 63 std::istringstream stream(std::string(olditer, line.end())); 66 64 stream >> coord; 67 temp _vector[counter++] = coord;65 temp[counter++] = coord; 68 66 } 69 tmp.set(temp_vector);67 param.set(temp); 70 68 71 69 // check vector 72 return World::getInstance().getDomain().isValid(temp _vector);70 return World::getInstance().getDomain().isValid(temp); 73 71 } 74 72 -
src/UIElements/TextUI/Query/VectorsTextQuery.cpp
r30cd0d r9d5531 31 31 32 32 33 TextDialog::VectorsTextQuery::VectorsTextQuery(Parameter<std::vector<Vector> > & param, std::string title, bool _check, std::string _description) :34 Dialog::VectorsQuery( param, title,_check,_description)33 TextDialog::VectorsTextQuery::VectorsTextQuery(Parameter<std::vector<Vector> > &_param, std::string title, std::string _description) : 34 Dialog::VectorsQuery(_param, title,_description) 35 35 {} 36 36 … … 50 50 // dissect by "," 51 51 double coord = 0.; 52 std::vector<Vector> temp_vectors;53 52 std::string::iterator olditerspace = line.begin(); 54 53 std::string::iterator olditercomma = line.begin(); … … 63 62 std::istringstream stream(std::string(componentiter, olditercomma)); 64 63 stream >> coord; 65 temp [counter++] = coord;64 temp_element[counter++] = coord; 66 65 olditercomma = componentiter; 67 66 } … … 70 69 std::istringstream stream(std::string(olditercomma, vectoriter)); 71 70 stream >> coord; 72 temp [counter++] = coord;71 temp_element[counter++] = coord; 73 72 } 74 if (World::getInstance().getDomain().isValid(temp ))75 temp _vectors.push_back(temp);73 if (World::getInstance().getDomain().isValid(temp_element)) 74 temp.push_back(temp_element); 76 75 olditerspace = vectoriter; 77 76 } 78 77 } 79 tmp.set(temp_vectors);78 param.set(temp); 80 79 81 80 return true; -
src/UIElements/TextUI/TextDialog.cpp
r30cd0d r9d5531 38 38 } 39 39 40 void TextDialog::queryBoolean(Parameter<bool> & param, const char* title, std::string description){41 registerQuery(new BooleanTextQuery( param, title,description));40 void TextDialog::queryBoolean(Parameter<bool> &_param, const char* title, std::string description){ 41 registerQuery(new BooleanTextQuery(_param, title,description)); 42 42 } 43 43 44 void TextDialog::queryInt(Parameter<int> & param, const char* title, std::string description){45 registerQuery(new IntTextQuery( param, title,description));44 void TextDialog::queryInt(Parameter<int> &_param, const char* title, std::string description){ 45 registerQuery(new IntTextQuery(_param, title,description)); 46 46 } 47 47 48 void TextDialog::queryInts(Parameter<std::vector<int> > & param, const char* title, std::string description){49 registerQuery(new IntsTextQuery( param, title,description));48 void TextDialog::queryInts(Parameter<std::vector<int> > &_param, const char* title, std::string description){ 49 registerQuery(new IntsTextQuery(_param, title,description)); 50 50 } 51 51 52 void TextDialog::queryUnsignedInt(Parameter<unsigned int> & param, const char* title, std::string description){53 registerQuery(new UnsignedIntTextQuery( param, title,description));52 void TextDialog::queryUnsignedInt(Parameter<unsigned int> &_param, const char* title, std::string description){ 53 registerQuery(new UnsignedIntTextQuery(_param, title,description)); 54 54 } 55 55 56 void TextDialog::queryUnsignedInts(Parameter<std::vector<unsigned int> > & param, const char* title, std::string description){57 registerQuery(new UnsignedIntsTextQuery( param, title,description));56 void TextDialog::queryUnsignedInts(Parameter<std::vector<unsigned int> > &_param, const char* title, std::string description){ 57 registerQuery(new UnsignedIntsTextQuery(_param, title,description)); 58 58 } 59 59 60 void TextDialog::queryDouble(Parameter<double> & param, const char* title, std::string description){61 registerQuery(new DoubleTextQuery( param, title,description));60 void TextDialog::queryDouble(Parameter<double> &_param, const char* title, std::string description){ 61 registerQuery(new DoubleTextQuery(_param, title,description)); 62 62 } 63 63 64 void TextDialog::queryDoubles(Parameter<std::vector<double> > & param, const char* title, std::string description){65 registerQuery(new DoublesTextQuery( param, title,description));64 void TextDialog::queryDoubles(Parameter<std::vector<double> > &_param, const char* title, std::string description){ 65 registerQuery(new DoublesTextQuery(_param, title,description)); 66 66 } 67 67 68 void TextDialog::queryString(Parameter<std::string> & param, const char* title, std::string description){69 registerQuery(new StringTextQuery( param, title,description));68 void TextDialog::queryString(Parameter<std::string> &_param, const char* title, std::string description){ 69 registerQuery(new StringTextQuery(_param, title,description)); 70 70 } 71 71 72 void TextDialog::queryStrings(Parameter<std::vector<std::string> > & param, const char* title, std::string description){73 registerQuery(new StringsTextQuery( param, title,description));72 void TextDialog::queryStrings(Parameter<std::vector<std::string> > &_param, const char* title, std::string description){ 73 registerQuery(new StringsTextQuery(_param, title,description)); 74 74 } 75 75 76 void TextDialog::queryAtom(Parameter<const atom *> & param, const char* title, std::string description) {77 registerQuery(new AtomTextQuery( param, title,description));76 void TextDialog::queryAtom(Parameter<const atom *> &_param, const char* title, std::string description) { 77 registerQuery(new AtomTextQuery(_param, title,description)); 78 78 } 79 79 80 void TextDialog::queryAtoms(Parameter<std::vector<const atom *> > & param, const char* title, std::string description) {81 registerQuery(new AtomsTextQuery( param, title,description));80 void TextDialog::queryAtoms(Parameter<std::vector<const atom *> > &_param, const char* title, std::string description) { 81 registerQuery(new AtomsTextQuery(_param, title,description)); 82 82 } 83 83 84 void TextDialog::queryMolecule(Parameter<const molecule *> & param, const char* title, std::string description) {85 registerQuery(new MoleculeTextQuery( param, title,description));84 void TextDialog::queryMolecule(Parameter<const molecule *> &_param, const char* title, std::string description) { 85 registerQuery(new MoleculeTextQuery(_param, title,description)); 86 86 } 87 87 88 void TextDialog::queryMolecules(Parameter<std::vector<const molecule *> > & param, const char* title, std::string description) {89 registerQuery(new MoleculesTextQuery( param, title,description));88 void TextDialog::queryMolecules(Parameter<std::vector<const molecule *> > &_param, const char* title, std::string description) { 89 registerQuery(new MoleculesTextQuery(_param, title,description)); 90 90 } 91 91 92 void TextDialog::queryVector(Parameter<Vector> & param, const char* title, bool check, std::string description) {93 registerQuery(new VectorTextQuery( param, title,check,description));92 void TextDialog::queryVector(Parameter<Vector> &_param, const char* title, std::string description) { 93 registerQuery(new VectorTextQuery(_param, title,description)); 94 94 } 95 95 96 void TextDialog::queryVectors(Parameter<std::vector<Vector> > & param, const char* title, bool check, std::string description) {97 registerQuery(new VectorsTextQuery( param, title,check,description));96 void TextDialog::queryVectors(Parameter<std::vector<Vector> > &_param, const char* title, std::string description) { 97 registerQuery(new VectorsTextQuery(_param, title,description)); 98 98 } 99 99 100 void TextDialog::queryRealSpaceMatrix(Parameter<RealSpaceMatrix> & param, const char* title, std::string description) {101 registerQuery(new RealSpaceMatrixTextQuery( param, title,description));100 void TextDialog::queryRealSpaceMatrix(Parameter<RealSpaceMatrix> &_param, const char* title, std::string description) { 101 registerQuery(new RealSpaceMatrixTextQuery(_param, title,description)); 102 102 } 103 103 104 void TextDialog::queryElement(Parameter<const element *> & param, const char* title, std::string description){105 registerQuery(new ElementTextQuery( param, title,description));104 void TextDialog::queryElement(Parameter<const element *> &_param, const char* title, std::string description){ 105 registerQuery(new ElementTextQuery(_param, title,description)); 106 106 } 107 107 108 void TextDialog::queryElements(Parameter<std::vector<const element *> > & param, const char* title, std::string description){109 registerQuery(new ElementsTextQuery( param, title,description));108 void TextDialog::queryElements(Parameter<std::vector<const element *> > &_param, const char* title, std::string description){ 109 registerQuery(new ElementsTextQuery(_param, title,description)); 110 110 } 111 111 112 void TextDialog::queryFile(Parameter<boost::filesystem::path> & param, const char* title, std::string description){113 registerQuery(new FileTextQuery( param, title,description));112 void TextDialog::queryFile(Parameter<boost::filesystem::path> &_param, const char* title, std::string description){ 113 registerQuery(new FileTextQuery(_param, title,description)); 114 114 } 115 115 116 void TextDialog::queryFiles(Parameter<std::vector< boost::filesystem::path> > & param, const char* title, std::string description){117 registerQuery(new FilesTextQuery( param, title,description));116 void TextDialog::queryFiles(Parameter<std::vector< boost::filesystem::path> > &_param, const char* title, std::string description){ 117 registerQuery(new FilesTextQuery(_param, title,description)); 118 118 } 119 119 120 void TextDialog::queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> & param, const char* title, std::string description){121 registerQuery(new RandomNumberDistribution_ParametersTextQuery( param, title,description));120 void TextDialog::queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &_param, const char* title, std::string description){ 121 registerQuery(new RandomNumberDistribution_ParametersTextQuery(_param, title,description)); 122 122 } 123 123 124 124 125 /************************** Query Infrastructure ************************/ -
src/UIElements/TextUI/TextDialog.hpp
r30cd0d r9d5531 45 45 virtual void queryMolecule(Parameter<const molecule *> &, const char*,std::string = ""); 46 46 virtual void queryMolecules(Parameter<std::vector<const molecule *> > &, const char*,std::string = ""); 47 virtual void queryVector(Parameter<Vector> &, const char*, bool,std::string = "");48 virtual void queryVectors(Parameter<std::vector<Vector> > &, const char*, bool,std::string = "");47 virtual void queryVector(Parameter<Vector> &, const char*, std::string = ""); 48 virtual void queryVectors(Parameter<std::vector<Vector> > &, const char*, std::string = ""); 49 49 virtual void queryRealSpaceMatrix(Parameter<RealSpaceMatrix> &, const char*, std::string = ""); 50 50 virtual void queryElement(Parameter<const element *> &, const char*, std::string = "");
Note:
See TracChangeset
for help on using the changeset viewer.