Planeshift
PendingQuestion Class Reference

"Questions" are general requests of information from user. More...

#include <questionmanager.h>

Public Member Functions

virtual void HandleAnswer (const csString &answer)
 This is called when user sends answer to this question, or when the question times out (because the user didn't respond in time) More...
 
virtual void HandleTimeout ()
 
 PendingQuestion ()
 
 PendingQuestion (int clientnum, const csString &question, psQuestionMessage::questionType_t type)
 
virtual ~PendingQuestion ()
 

Public Attributes

int clientnum
 
psQuestionCancelEvent * event
 
unsigned id
 
bool ok
 
csString question
 Holds data that will be somehow displayed to user. More...
 
psQuestionMessage::questionType_t type
 type of question - clients handles each question type differently More...
 

Static Public Attributes

static unsigned nextID
 

Detailed Description

"Questions" are general requests of information from user.

The lifetime of a question: 1) It is sent to some client 2) Client shows appropriate GUI to present the question to user 3) User chooses answer from the GUI 4) Answer is sent to server which somehow reacts to user's decision

Unanswered questions automatically time out after some time

  • the are removed from questionmanager and from user's GUI.

The questioning framework can be extended to support any forms of questions: e.g. plain text, XML, images If you want to create a new kind of questioning GUI on the client, you will need to add a new question type and write its handler on client side.

One common use for questions are invites - see invitemanager.h This class is the superclass for all questions, If you need a new kind of question (for example new handler of answers), inherit from this class.

Definition at line 66 of file questionmanager.h.

Constructor & Destructor Documentation

PendingQuestion::PendingQuestion ( )
inline

Definition at line 84 of file questionmanager.h.

PendingQuestion::PendingQuestion ( int  clientnum,
const csString &  question,
psQuestionMessage::questionType_t  type 
)
virtual PendingQuestion::~PendingQuestion ( )
inlinevirtual

Definition at line 89 of file questionmanager.h.

Member Function Documentation

virtual void PendingQuestion::HandleAnswer ( const csString &  answer)
inlinevirtual

This is called when user sends answer to this question, or when the question times out (because the user didn't respond in time)

Override this method to react to the answers sent by questioned users

Reimplemented in PendingInvite.

Definition at line 97 of file questionmanager.h.

virtual void PendingQuestion::HandleTimeout ( )
inlinevirtual

Reimplemented in PendingInvite.

Definition at line 98 of file questionmanager.h.

Member Data Documentation

int PendingQuestion::clientnum

Definition at line 81 of file questionmanager.h.

psQuestionCancelEvent* PendingQuestion::event

Definition at line 82 of file questionmanager.h.

unsigned PendingQuestion::id

Definition at line 69 of file questionmanager.h.

unsigned PendingQuestion::nextID
static

Definition at line 70 of file questionmanager.h.

bool PendingQuestion::ok

Definition at line 71 of file questionmanager.h.

csString PendingQuestion::question

Holds data that will be somehow displayed to user.

  • can be anything, plain text, XML, encoded bitmap. Client will interpret it according to 'type'

Definition at line 79 of file questionmanager.h.

psQuestionMessage::questionType_t PendingQuestion::type

type of question - clients handles each question type differently

Definition at line 74 of file questionmanager.h.


The documentation for this class was generated from the following file: