Changeset 11750
- Timestamp:
- Feb 15, 2018, 11:18:38 PM (7 years ago)
- Location:
- code/branches/Presentation_HS17_merge/src/modules/dialog
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Presentation_HS17_merge/src/modules/dialog/Dialog.cc
r11749 r11750 89 89 } 90 90 91 const Question* Dialog::getQuestion() const // returned nichts91 Question* Dialog::getQuestion(unsigned int index) const 92 92 { 93 return nullptr; 93 unsigned int i = 0; 94 for (auto entry : this->questions_) 95 { 96 if (i == index) 97 return entry.second; 98 ++i; 99 } 100 return nullptr; 94 101 } 95 102 … … 99 106 } 100 107 101 const Answer* Dialog::getAnswer(unsigned int index) const //returned sting der Antwort zur Id.108 Answer* Dialog::getAnswer(unsigned int index) const 102 109 { 103 return nullptr; 110 unsigned int i = 0; 111 for (auto entry : this->answers_) 112 { 113 if (i == index) 114 return entry.second; 115 ++i; 116 } 117 return nullptr; 104 118 } 105 119 106 120 107 const std::vector<std::string> * Dialog::getAnswerIds()// returned vector mit allen momentanen AntwortenIds121 const std::vector<std::string>& Dialog::getAnswerIds() const // returned vector mit allen momentanen AntwortenIds 108 122 { 109 123 110 124 Question* question = (this->questions_.find(this->currentQuestionId_))->second; 111 const std::vector<std::string>* answers = question->getAnswerIds(); 112 return answers; 125 return question->getAnswerIds(); 113 126 114 127 } … … 145 158 } 146 159 147 const std::string& Dialog::getAnswerString( std::stringanswerId)160 const std::string& Dialog::getAnswerString(const std::string& answerId) 148 161 { 149 162 return this->answers_.find(answerId)->second->getAnswer(); -
code/branches/Presentation_HS17_merge/src/modules/dialog/Dialog.h
r11749 r11750 68 68 69 69 void addQuestion(Question* question); //xmlPort-Funktion, adds question to map 70 const Question* getQuestion() const; //xmlPort-Funktion, returns nullptr70 Question* getQuestion(unsigned int index) const; //xmlPort-Funktion 71 71 72 72 void addAnswer(Answer* answer); //xmlPort-Funktion, adds answer to map 73 const Answer* getAnswer(unsigned int index) const; //xmlPort-Funktion, returns nullptr73 Answer* getAnswer(unsigned int index) const; //xmlPort-Funktion 74 74 75 75 /** … … 80 80 pointer to answerId array of question 81 81 */ 82 const std::vector<std::string> * getAnswerIds();82 const std::vector<std::string>& getAnswerIds() const; 83 83 84 84 /** … … 133 133 sting with answer 134 134 */ 135 const std::string& getAnswerString( std::stringanswerId);135 const std::string& getAnswerString(const std::string& answerId); 136 136 137 137 private: -
code/branches/Presentation_HS17_merge/src/modules/dialog/DialogManager.cc
r11749 r11750 45 45 { 46 46 this->currentTalk_ = dialog; 47 answerIds_ = currentTalk_->getAnswerIds();47 answerIds_ = ¤tTalk_->getAnswerIds(); 48 48 } 49 49 … … 86 86 { 87 87 this->currentTalk_->update(answerIds_->at(index)); 88 answerIds_ = this->currentTalk_->getAnswerIds();88 answerIds_ = &this->currentTalk_->getAnswerIds(); 89 89 } 90 90 } -
code/branches/Presentation_HS17_merge/src/modules/dialog/Question.cc
r11749 r11750 75 75 } 76 76 77 const AnswerId* Question::getAnswerId() const77 AnswerId* Question::getAnswerId(unsigned int index) const 78 78 { 79 79 return nullptr; 80 80 } 81 81 82 const std::vector<std::string> * Question::getAnswerIds()82 const std::vector<std::string>& Question::getAnswerIds() const 83 83 { 84 return &(this->answerIds_);84 return this->answerIds_; 85 85 } 86 86 -
code/branches/Presentation_HS17_merge/src/modules/dialog/Question.h
r11749 r11750 63 63 64 64 void addAnswerId(AnswerId* answerId); //xmlPort-Funktion, nimmt AnswerIds von entsprechenden Objekten und fuegt sie in List ein. 65 const AnswerId* getAnswerId() const; //xmlPort-Funktion, gibt nichts zuruek65 AnswerId* getAnswerId(unsigned int index) const; //xmlPort-Funktion, gibt nichts zuruek 66 66 67 67 /** … … 72 72 returns pointer to the array with ids of possible pc textoptions 73 73 */ 74 const std::vector<std::string> * getAnswerIds(); //returnt Pointer auf Vektor mit allen Ids74 const std::vector<std::string>& getAnswerIds() const; //returnt Pointer auf Vektor mit allen Ids 75 75 76 76
Note: See TracChangeset
for help on using the changeset viewer.