Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/Presentation_HS17_merge/src/modules/dialog/Question.cc @ 11776

Last change on this file since 11776 was 11750, checked in by landauf, 7 years ago

[Dialog_HS17] cleanup XMLPort collection getters

File size: 2.1 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      ...
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "Question.h"
30#include "core/CoreIncludes.h"
31
32namespace orxonox
33{
34
35        RegisterClass(Question);
36
37        Question::Question(Context* context) : BaseObject(context)
38        {
39                RegisterObject(Question);
40        }
41
42        void Question::XMLPort(Element& xmlement, XMLPort::Mode mode)
43        {
44                SUPER(Question, XMLPort, xmlement, mode);
45
46                XMLPortParam(Question, "question", setQuestion, getQuestion, xmlement, mode);
47                XMLPortParam(Question, "Id", setQuestionId, getQuestionId, xmlement, mode);
48
49                XMLPortObject(Question, AnswerId, "answerIds", addAnswerId, getAnswerId, xmlement, mode);
50        }
51
52        void Question::setQuestionId(const std::string& Id)
53        {
54                this->questionId_ = Id;
55        }
56
57        const std::string& Question::getQuestionId() const
58        {
59                return this->questionId_;
60        }
61
62        void Question::setQuestion(const std::string& question)
63        {
64                this->question_ = question;
65        }
66
67        const std::string& Question::getQuestion() const
68        {
69                return this->question_;
70        }
71
72        void Question::addAnswerId(AnswerId* answerId)
73        {
74                this->answerIds_.push_back(answerId->getId());
75        }
76
77        AnswerId* Question::getAnswerId(unsigned int index) const
78        {
79                return nullptr;
80        }
81
82        const std::vector<std::string>& Question::getAnswerIds() const
83        {
84                return this->answerIds_;
85        }
86       
87}
Note: See TracBrowser for help on using the repository browser.