Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 15, 2018, 11:18:38 PM (7 years ago)
Author:
landauf
Message:

[Dialog_HS17] cleanup XMLPort collection getters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Presentation_HS17_merge/src/modules/dialog/Dialog.cc

    r11749 r11750  
    8989        }
    9090
    91         const Question* Dialog::getQuestion() const // returned nichts
     91        Question* Dialog::getQuestion(unsigned int index) const
    9292        {
    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;
    94101        }
    95102
     
    99106        }
    100107
    101         const Answer* Dialog::getAnswer(unsigned int index) const       //returned sting der Antwort zur Id.
     108        Answer* Dialog::getAnswer(unsigned int index) const
    102109        {
    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;
    104118        }
    105119
    106120
    107         const std::vector<std::string>* Dialog::getAnswerIds() // returned vector mit allen momentanen AntwortenIds
     121        const std::vector<std::string>& Dialog::getAnswerIds() const // returned vector mit allen momentanen AntwortenIds
    108122        {
    109123               
    110124                Question* question = (this->questions_.find(this->currentQuestionId_))->second;
    111                 const std::vector<std::string>* answers = question->getAnswerIds();
    112                 return answers;
     125                return question->getAnswerIds();
    113126               
    114127        }
     
    145158        }
    146159
    147         const std::string& Dialog::getAnswerString(std::string answerId)
     160        const std::string& Dialog::getAnswerString(const std::string& answerId)
    148161        {
    149162                return this->answers_.find(answerId)->second->getAnswer();
Note: See TracChangeset for help on using the changeset viewer.