april  1.0.0
...
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
april::AprilModule Class Reference

Base class for all modules. More...

#include <aprilmodule.h>

+ Inheritance diagram for april::AprilModule:

Public Types

typedef QString(* arg0Func )(void)
 callback for functions with no arguments
typedef QString(* arg1Func )(const QString &s_arg_1, const AaToken &tk1)
 callback for functions with one argument
typedef QString(* arg0WFunc )(World *w)
 callback for functions with no arguments and world expectations
typedef QString(* arg1WFunc )(World *w, const QString &s_arg_1, const AaToken &tk1)
 callback for functions with one argument and world expectations
typedef QString(* argW2Func )(World *w, const QString &s_arg_1, const AaToken &tk1, const QString &s_arg_2, const AaToken &tk2)
 callback for functions that require a default world with 2 args
typedef QString(* argA0Func )(Actor *a)
 callback for functions with an actor as single argument
typedef QString(* argAIdFunc )(Actor *a, ID id)
 callback for functions with an actor and an ID as argument

Public Member Functions

 AprilModule (CommandMap *cmd_map)
 constructor
virtual void insertCommands (CommandMap *cm)=0
 insert all commands
virtual void removeCommands (CommandMap *cm)=0
 remove all commands
virtual QString name (void)=0
 tell your name
CommandMapcmdMap (void) const
 the CommandMap where we belong

Static Public Member Functions

static QString getCLUsage (const QString &s_name)
 get the string representing command line info for a command
static bool setUsage (const QString &s_name, const QStringList &usage, const QStringList &usage_descr, const QStringList &opts, const QList< QStringList > &opts_descr, const QStringList &obs)
 save the usage for a command
static bool getUIntArg (const AaTkString &atks, int i, QString &s_err, quint64 *val)
 parse argument i and get an unsigned integer
static void errorNumberOfArguments (QString &s_err)
static void errorOneArgumentExpected (QString &s_err)
static void errorNoAssocFile (World *w, QString &s_err)
static void errorEnergyInteger (QString &s_err)
static void errorUnknownOption (QString &s_err, const QString &s_tk)
static void errorIntegerExpected (QString &s_err, const QString &s_tk)
static void errorIdExpected (QString &s_err, const QString &s_tk)
static void errorNoCurrentWorld (QString &s_err)

Protected Member Functions

virtual ~AprilModule (void)
 destructor;

Static Protected Member Functions

static bool funcArg0 (const QString &s_cmd, const AaTkString &atks, QString &s_err, arg0Func kb)
 helper for functions with no arguments
static bool funcArg1 (const QString &s_cmd, const AaTkString &atks, QString &s_err, arg1Func kb)
 helper for functions with one argument
static bool funcArg0W (const QString &s_cmd, const AaTkString &atks, QString &s_err, arg0WFunc kb)
 helper for functions with no arguments and world expectations
static bool funcArg1W (const QString &s_cmd, const AaTkString &atks, QString &s_err, arg1WFunc kb)
 helper for functions with one argument and world expectations
static bool funcArg_W2 (const QString &s_cmd, const AaTkString &atks, QString &s_err, argW2Func kb)
 helper for functions with two arguments and world expectations
static bool funcArg_A0 (const QString &s_cmd, const AaTkString &atks, QString &s_err, argA0Func kb)
 helper for functions with an argument that is an actor index
static bool funcArg_AID (const QString &s_cmd, const AaTkString &atks, QString &s_err, argAIdFunc kb)
 helper for functions with irst argument an actor index and second an ID

Detailed Description

Base class for all modules.

Member Function Documentation

void AprilModule::errorEnergyInteger ( QString &  s_err)
static

common types of errors

void AprilModule::errorIdExpected ( QString &  s_err,
const QString &  s_tk 
)
static

common types of errors

void AprilModule::errorIntegerExpected ( QString &  s_err,
const QString &  s_tk 
)
static

common types of errors

void AprilModule::errorNoAssocFile ( World w,
QString &  s_err 
)
static

common types of errors

void AprilModule::errorNoCurrentWorld ( QString &  s_err)
static

common types of errors

void AprilModule::errorNumberOfArguments ( QString &  s_err)
static

common types of errors

void AprilModule::errorOneArgumentExpected ( QString &  s_err)
static

common types of errors

void AprilModule::errorUnknownOption ( QString &  s_err,
const QString &  s_tk 
)
static

common types of errors

QString AprilModule::getCLUsage ( const QString &  s_name)
static

get the string representing command line info for a command

Todo:
file from app settings
bool AprilModule::setUsage ( const QString &  s_name,
const QStringList &  usage,
const QStringList &  usage_descr,
const QStringList &  opts,
const QList< QStringList > &  opts_descr,
const QStringList &  obs 
)
static

save the usage for a command

Todo:
file from app settings

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