Planeshift
questionmanager.h
Go to the documentation of this file.
1
/*
2
* questionmanager.h
3
*
4
* Copyright (C) 2005 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5
*
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation (version 2 of the License)
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
*
18
*/
19
20
#ifndef QUESTION_MANAGER_HEADER
21
#define QUESTION_MANAGER_HEADER
22
//=============================================================================
23
// Crystal Space Includes
24
//=============================================================================
25
#include <csutil/csstring.h>
26
27
//=============================================================================
28
// Project Includes
29
//=============================================================================
30
#include "
net/messages.h
"
31
32
//=============================================================================
33
// Local Includes
34
//=============================================================================
35
#include "
msgmanager.h
"
36
37
38
class
psQuestionCancelEvent;
39
66
class
PendingQuestion
67
{
68
public
:
69
unsigned
id
;
// unique id
70
static
unsigned
nextID
;
71
bool
ok
;
// Set to false to stop sending
72
74
psQuestionMessage::questionType_t
type
;
75
79
csString
question
;
80
81
int
clientnum
;
// the questioned client
82
psQuestionCancelEvent*
event
;
83
84
PendingQuestion
()
85
{
86
event
= NULL;
87
}
88
PendingQuestion
(
int
clientnum,
const
csString &question,
psQuestionMessage::questionType_t
type);
89
virtual
~PendingQuestion
() {};
90
91
97
virtual
void
HandleAnswer
(
const
csString &answer) {};
98
virtual
void
HandleTimeout
() {};
99
};
100
105
class
QuestionManager
:
public
MessageManager
<QuestionManager>
106
{
107
public
:
108
109
QuestionManager
();
110
virtual
~
QuestionManager
();
111
113
void
SendQuestion(
PendingQuestion
*
question
);
114
116
void
CancelQuestion(
PendingQuestion
* question);
117
118
protected
:
119
120
void
HandleQuestionResponse(
MsgEntry
* pMsg,
Client
* client);
121
122
csHash<PendingQuestion*>
questions
;
123
};
124
125
126
#endif
PendingQuestion::id
unsigned id
Definition:
questionmanager.h:69
messages.h
PendingQuestion::clientnum
int clientnum
Definition:
questionmanager.h:81
PendingQuestion::type
psQuestionMessage::questionType_t type
type of question - clients handles each question type differently
Definition:
questionmanager.h:74
PendingQuestion::HandleAnswer
virtual void HandleAnswer(const csString &answer)
This is called when user sends answer to this question, or when the question times out (because the u...
Definition:
questionmanager.h:97
msgmanager.h
PendingQuestion::ok
bool ok
Definition:
questionmanager.h:71
MsgEntry
The structure of 1 queue entry (pointer to a message)
Definition:
message.h:143
PendingQuestion::question
csString question
Holds data that will be somehow displayed to user.
Definition:
questionmanager.h:79
PendingQuestion::HandleTimeout
virtual void HandleTimeout()
Definition:
questionmanager.h:98
QuestionManager
QuestionManager keeps track of all the questions of any kind that are pending.
Definition:
questionmanager.h:105
PendingQuestion
"Questions" are general requests of information from user.
Definition:
questionmanager.h:66
QuestionManager::questions
csHash< PendingQuestion * > questions
Definition:
questionmanager.h:122
PendingQuestion::~PendingQuestion
virtual ~PendingQuestion()
Definition:
questionmanager.h:89
Client
This class collects data of a netclient.
Definition:
client.h:95
PendingQuestion::PendingQuestion
PendingQuestion()
Definition:
questionmanager.h:84
psQuestionMessage::questionType_t
questionType_t
Various questions that are posed to the user.
Definition:
messages.h:3726
PendingQuestion::nextID
static unsigned nextID
Definition:
questionmanager.h:70
PendingQuestion::event
psQuestionCancelEvent * event
Definition:
questionmanager.h:82
MessageManager
Provides a manager to facilitate subscriptions.
Definition:
msgmanager.h:106
server
questionmanager.h
Generated on Sat Jun 19 2021 05:00:33 for Planeshift by
1.8.11