ConsoleInput Class Reference
[Command Line Interface]

Quick and light command line processer. More...

#include <ConsoleInput.hh>

List of all members.

Classes

struct  InputCommand
struct  InputSubCommand

Public Member Functions

 ConsoleInput (CmdLineInterface *i, Api *gc, bool use_readline)
bool process (bool test_mode)
 !
void processCommand (const std::string &s)
 !
void wantExit ()
 !
bool isRunning ()
 !
void stopWaiting ()
 !

Static Public Attributes

static InputCommand main_cmd_ []
static InputSubCommand print_cmd_ []
static InputSubCommand move_cmd_ []
static InputSubCommand choose_cmd_ []
static InputSubCommand place_cmd_ []
static InputSubCommand block_cmd_ []
static InputSubCommand skill_cmd_ []
static InputSubCommand action_cmd_ []

Detailed Description

Quick and light command line processer.


Member Function Documentation

bool ConsoleInput::isRunning (  ) 

!

Return true if the application is running, or false if it wanting to exit.

bool ConsoleInput::process ( bool  test_mode  ) 

!

Main loop, check input, process commands... call it frequently.

Parameters:
test_mode Set it true when running rules check. Change the behavior of who blocks and when.
Note:
Block at most 50ms.
You have to check 'isRunning' to know if user wants to exit from app (EOF, quit, etc...).
Returns:
true if a command has been processed.

References Api::canMakeRequest(), BaseApi< T >::isBusy(), Api::mustMakeChoice(), and processCommand().

void ConsoleInput::processCommand ( const std::string &  s  ) 

!

Process a command.

Parameters:
s The command line, without trailing '\n'.

References trim().

Referenced by process().

void ConsoleInput::stopWaiting (  ) 

!

Tell to process input again.

References BaseApi< T >::getTeamId().

void ConsoleInput::wantExit (  ) 

!

Wants to exit.


Member Data Documentation

ConsoleInput::InputSubCommand ConsoleInput::action_cmd_ [static]
Initial value:
 {
  {"move", &ConsoleInput::cmdActionMove, "<p>|Begin a move action for player <p>."},
  {"block", &ConsoleInput::cmdActionBlock, "<p>|Begin a block action for player <p>."},
  {"blitz", &ConsoleInput::cmdActionBlitz, "<p>|Begin a blitz action for player <p>."},
  {"foul", &ConsoleInput::cmdActionFoul, "<p>|Begin a foul action for player <p>."},
  {"pass", &ConsoleInput::cmdActionPass, "<p>|Begin a pass action for player <p>."},
  {"transmit", &ConsoleInput::cmdActionTransmit, "<p>|Begin a transmit action for player <p>."},
  {NULL, NULL, NULL}
}
ConsoleInput::InputSubCommand ConsoleInput::block_cmd_ [static]
Initial value:
 {
  {"", &ConsoleInput::cmdBlockBlock, "<att> <def>|Block <def> with player <att>."},
  {"dice", &ConsoleInput::cmdBlockDice, "<n>|Choose a block dice."},
  {"follow", &ConsoleInput::cmdBlockFollow, "Follow after a block."},
  {"stay", &ConsoleInput::cmdBlockStay, "Stay after a block."},
  {"push", &ConsoleInput::cmdBlockPush, "<n>|Choose a square to push the player in."},
  {NULL, NULL, NULL}
}
ConsoleInput::InputSubCommand ConsoleInput::choose_cmd_ [static]
Initial value:
 {
  {"kickoff", &ConsoleInput::cmdChooseKickoff, "Choose to kick off the ball first."},
  {"receive", &ConsoleInput::cmdChooseReceive, "Choose to receive the ball first."},
  {NULL, NULL, NULL}
}
ConsoleInput::InputCommand ConsoleInput::main_cmd_ [static]
Initial value:
 {
  {"quit", &ConsoleInput::cmdQuit, "Exit the game, CU."},
  {"help", &ConsoleInput::cmdHelp, "Print this help."},
  {"print", &ConsoleInput::cmdPrint, "<subcmd>|Print some informations. ('help print')"},
  {"say", &ConsoleInput::cmdSay, "<s>|Chat with others."},
  {"choose", &ConsoleInput::cmdChoose, "<subcmd>|Choose to kick off or receive. ('help choose')"},
  {"place", &ConsoleInput::cmdPlace, "<subcmd>|Set up team placement. ('help place')"},
  {"kickoff", &ConsoleInput::cmdKickOff, "<r> <c>|Kick off the ball to [<r> <c>]."},
  {"giveBall", &ConsoleInput::cmdGiveBall, "<p>|Give the ball to the player <p>."},
  {"illegal", &ConsoleInput::cmdIllegal, "Ask for an illegal procedure, absolutely useless."},
  {"reroll", &ConsoleInput::cmdReroll, "Reroll the dice(s) using a team reroll."},
  {"skill", &ConsoleInput::cmdSkill, "<subcmd>|Skill usage. ('help skill')"},
  {"accept", &ConsoleInput::cmdAccept, "Accept result of the dice(s)."},
  {"end", &ConsoleInput::cmdEnd, "End turn."},
  {"action", &ConsoleInput::cmdAction, "<subcmd>|Begin an action. ('help action')"},
  {"move", &ConsoleInput::cmdMove, "<subcmd>|Move something. ('help move')"},
  {"standup", &ConsoleInput::cmdStandUp, "<p>|Stand up the player <p>."},
  {"block", &ConsoleInput::cmdBlock, "<subcmd>|Block effort. ('help block')"},
  {"foul", &ConsoleInput::cmdFoul, "<p> <r> <c>|Foul player at [<r> <c>] with player <p>."},
  {"handoff", &ConsoleInput::cmdHandOff, "<p> <r> <c>|Hand ball off at [<r> <c>] with player <p>."},
  {"pass", &ConsoleInput::cmdPass, "<p> <r> <c>|Pass the ball from player <p> to [<r> <c>]."},
  {"cheat", &ConsoleInput::cmdCheat, "<n> <...>|Force next dice rolls to give these results (cheat)."},
  {"debug", &ConsoleInput::cmdDebug, "Request both server and clients to print a debug trace."},
  {"wait", &ConsoleInput::cmdWait, "<n>|Do not process input until <n> events happened."},
  {NULL, NULL, NULL}
}
ConsoleInput::InputSubCommand ConsoleInput::move_cmd_ [static]
Initial value:
 {
  {"turnmarker", &ConsoleInput::cmdMoveTurnMarker, "Move the turn marker, absolutely useless."},
  {"", &ConsoleInput::cmdMovePlayer, "<p> <r> <c>|Move player <p> to [<r> <c>]."},
  {NULL, NULL, NULL}
}
ConsoleInput::InputSubCommand ConsoleInput::place_cmd_ [static]
Initial value:
 {
  {"", &ConsoleInput::cmdPlaceField, "<p> <r> <c>|Place the player <p> at [<r> <c>]."},
  {"reserve", &ConsoleInput::cmdPlaceReserve, "<p>|Place the player <p> in the reserve."},
  {"team", &ConsoleInput::cmdPlaceReserve, "<f>|Place the team according to formation no. <f>."},
  {"end", &ConsoleInput::cmdEndPlacement, "End team placement."},
  {NULL, NULL, NULL}
}
ConsoleInput::InputSubCommand ConsoleInput::print_cmd_ [static]
Initial value:
 {
  {"global", &ConsoleInput::cmdPrintGlobal, "Print game globals."},
  {"field", &ConsoleInput::cmdPrintField, "Print field in ascii art."},
  {"history", &ConsoleInput::cmdPrintHistory, "Print events history."},
  {"players", &ConsoleInput::cmdPrintPlayers, "Print players list."},
  {"us", &ConsoleInput::cmdPrintUs, "<p>|Print info for our team player <p>."},
  {"them", &ConsoleInput::cmdPrintThem, "<p>|Print info for other team player <p>."},
  {"", &ConsoleInput::cmdPrintString, "<s>|Simply display the string <s>."},
  {NULL, NULL, NULL}
}
ConsoleInput::InputSubCommand ConsoleInput::skill_cmd_ [static]
Initial value:
 {
  {"use", &ConsoleInput::cmdUseSkill, "<s>|Use the skill <s>."},
  {"ignore", &ConsoleInput::cmdIgnoreSkill, "<s>|Ignore the skill <s>."},
  {NULL, NULL, NULL}
}

The documentation for this class was generated from the following files:
Generated on Mon Apr 5 21:17:31 2010 for Stechec/TBT by  doxygen 1.6.3