Survey Class Reference

This plugin manages surveys. More...

#include <survey.h>

Inheritance diagram for Survey:

Plugin

List of all members.

Public Member Functions

 Survey (BotKernel *)
 Constructor.
bool launchSurvey (string, string, unsigned int, vector< string >)
 Launch a survey.
bool stopSurvey (string)
 Stop a survey.
bool vote (string, string, string)
 Vote.
vector< string > finishSurvey (string)
 Finish a survey.
vector< plugin_functiongetSurveyFunctions (string)
 Get survey's functions.
bool setSurveyFunctions (string, vector< plugin_function >)
 Set survey's functions.
plugin_function getCountDown (string)
 get countdown pointer
bool setCountDown (string, plugin_function)
 set countdown pointer

Private Member Functions

int getAnswerId (vector< string >, string)
 Get an answer's id.
bool surveyRunning (string)
 Test if a survey is running.

Private Attributes

vector< struct_surveysurveys
 Surveys storage.


Detailed Description

This plugin manages surveys.

This plugin manages surveys

Definition at line 55 of file survey.h.


Constructor & Destructor Documentation

Survey::Survey ( BotKernel b  ) 


Member Function Documentation

vector< string > Survey::finishSurvey ( string  channel  ) 

Finish a survey.

Finish the survey

Parameters:
channel Channel where finish the survey
Returns:
A vector containing results

Definition at line 80 of file survey.cpp.

References Tools::intToStr(), and surveys.

Referenced by endSurvey().

int Survey::getAnswerId ( vector< string >  answers,
string  answer 
) [private]

Get an answer's id.

Get an answer's id

Parameters:
answers Answers list
answer Answer to check
Returns:
Answer's id (-1 if not present)

Definition at line 226 of file survey.cpp.

Referenced by vote().

plugin_function Survey::getCountDown ( string  channel  ) 

get countdown pointer

Get survey's countdown

Parameters:
channel Channel's survey
Returns:
countdown pointer

Definition at line 193 of file survey.cpp.

References surveys.

Referenced by stopSurvey().

vector< plugin_function > Survey::getSurveyFunctions ( string  channel  ) 

Get survey's functions.

Get survey's functions

Parameters:
channel Channel's survey
Returns:
A vector containing functions

Definition at line 161 of file survey.cpp.

References surveys.

Referenced by endSurvey(), and stopSurvey().

bool Survey::launchSurvey ( string  channel,
string  question,
unsigned int  time,
vector< string >  answers 
)

Launch a survey.

Launch a survey on a channel

Parameters:
channel Channel where launch the survey
question Survey's question
time Survey length (in seconds)
answers Possible answers
Returns:
true is the survey has been launched, else false

Definition at line 54 of file survey.cpp.

References struct_survey::answers, struct_survey::channel, struct_survey::countDown, struct_survey::functions, struct_survey::question, struct_survey::results, surveyRunning(), surveys, struct_survey::time, and struct_survey::voters.

Referenced by launchSurvey().

bool Survey::setCountDown ( string  channel,
plugin_function  function 
)

set countdown pointer

Set survey's countdown

Parameters:
channel Channel's survey
function Countdown function
Returns:
True if "set" is OK, else false

Definition at line 209 of file survey.cpp.

References surveys.

Referenced by launchSurvey().

bool Survey::setSurveyFunctions ( string  channel,
vector< plugin_function functions 
)

Set survey's functions.

Set survey's functions

Parameters:
channel Channel's survey
functions A vector functions
Returns:
True if "set" is OK, else false

Definition at line 177 of file survey.cpp.

References surveys.

Referenced by launchSurvey().

bool Survey::stopSurvey ( string  channel  ) 

Stop a survey.

Stop a survey on a channel

Parameters:
channel Channel where stop the survey
Returns:
true if the survey has been stopped, else false

Definition at line 129 of file survey.cpp.

References surveys.

Referenced by launchSurvey(), and stopSurvey().

bool Survey::surveyRunning ( string  channel  )  [private]

Test if a survey is running.

Test if a survey is running on a channel

Parameters:
channel Channel where test if a survey is running
Returns:
true if a channel is running, else false

Definition at line 147 of file survey.cpp.

References surveys.

Referenced by launchSurvey().

bool Survey::vote ( string  channel,
string  nick,
string  answer 
)

Vote.

Register a vote for a user

Parameters:
channel Channel where the user votes
nick User's nick
answer User's answer
Returns:
true if the vote has been registered, else false

Definition at line 104 of file survey.cpp.

References getAnswerId(), Tools::isInVector(), and surveys.

Referenced by vote().


Member Data Documentation

vector<struct_survey> Survey::surveys [private]


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

Generated on Sun Aug 16 15:28:58 2009 for trustyRC by  doxygen 1.5.8