| 1 | #include "Question.h" |
|---|
| 2 | #include "core/CoreIncludes.h" |
|---|
| 3 | |
|---|
| 4 | namespace orxonox |
|---|
| 5 | { |
|---|
| 6 | |
|---|
| 7 | RegisterClass(Question); |
|---|
| 8 | |
|---|
| 9 | Question::Question(Context* context) : BaseObject(context) |
|---|
| 10 | { |
|---|
| 11 | RegisterObject(Question); |
|---|
| 12 | } |
|---|
| 13 | |
|---|
| 14 | void Question::XMLPort(Element& xmlement, XMLPort::Mode mode) |
|---|
| 15 | { |
|---|
| 16 | SUPER(Question, XMLPort, xmlement, mode); |
|---|
| 17 | |
|---|
| 18 | XMLPortParam(Question, "question", setQuestion, getQuestion, xmlement, mode); |
|---|
| 19 | XMLPortParam(Question, "Id", setQuestionId, getQuestionId, xmlement, mode); |
|---|
| 20 | |
|---|
| 21 | XMLPortObject(Question, AnswerId, "answerIds", addAnswerId, getAnswerId, xmlement, mode); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | void Question::setQuestionId(const std::string& Id) |
|---|
| 25 | { |
|---|
| 26 | this->questionId_ = Id; |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | const std::string& Question::getQuestionId() const |
|---|
| 30 | { |
|---|
| 31 | return this->questionId_; |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | void Question::setQuestion(const std::string& question) |
|---|
| 35 | { |
|---|
| 36 | this->question_ = question; |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | const std::string& Question::getQuestion() const |
|---|
| 40 | { |
|---|
| 41 | return this->question_; |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | void Question::addAnswerId(AnswerId* answerId) |
|---|
| 45 | { |
|---|
| 46 | this->answerIds_.push_back(answerId->getId()); |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | const AnswerId* Question::getAnswerId() const |
|---|
| 50 | { |
|---|
| 51 | return nullptr; |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | const std::vector<std::string>* Question::getAnswerIds() |
|---|
| 55 | { |
|---|
| 56 | return &(this->answerIds_); |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | } |
|---|