C# Class Tachycardia.Tools.Commands.Command

Implements command engine.
In child classes: 1. Write argumets callbacks; 2. Implement RegisterArgs method: 2.1. Register every callback with RegisterArg method. Argument name should be long name. Shorter names should be avaible thought aliases; 2.2. Register every subargument with RegisterSubArg method. Not registered subargs will not be passed to callback; 2.3. Register aliases to callback to shorter typing time;
Inheritance: ConsoleParser.ICommand
显示文件 Open project: secred/Tachycardia

Public Methods

Method Description
Command ( string name ) : System
OnInvoke ( CommandEvent e ) : void
OnTab ( CommandEvent e ) : string

Protected Methods

Method Description
Dummy ( ArgEvent e ) : void
ParseBool ( string str, bool &param ) : bool?

Parse str as bool value, update param and return previous param value.

Can parse 'on' and 'off' strings as (respectively) true and false.

ParseFloat ( string str, float &param ) : float?

Parse str as float value, update param and return previous param value.

If the first character of str is '+' or '-', the value of str will be added/substracted to/from param, otherwise value of param will be exactly as in string.

ParseInt ( string str, int &param ) : int?

Parse str as int value, update param and return previous param value.

If the first character of str is '+' or '-', the value of str will be added/substracted to/from param, otherwise value of param will be exactly as in string.

ParseVector2 ( List list, Mogre &param ) : Mogre.Vector2?

Parse list as Mogre::Vector2 value, update param and return previous param value.

If the first character of string is '+' or '-', the value of this field will be added/substracted to/from param, otherwise value of param field will be exactly as in string.

ParseVector3 ( List list, Mogre &value ) : Mogre.Vector3?

Parse list as Mogre::Vector3 value, update param and return previous param value.

If the first character of string is '+' or '-', the value of this field will be added/substracted to/from param, otherwise value of param field will be exactly as in string.

ParseVector4 ( List list, Mogre &value ) : Mogre.Vector4?

Parse list as Mogre::Vector4 value, update param and return previous param value.

If the first character of string is '+' or '-', the value of this field will be added/substracted to/from param, otherwise value of param field will be exactly as in string.

RegisterAlias ( string argName, string aliasName ) : void
RegisterArg ( string argName, ArgCall call ) : void
RegisterArg ( string argName, ArgCall call, string helpString ) : void
RegisterArgs ( ) : void
RegisterSubArg ( string argName, string subArgName ) : void

Private Methods

Method Description
OnHelp ( ) : void
OnInvokeParseArg ( CommandEvent &e, int &i ) : void
OnInvokeParseSubArg ( CommandEvent &e, int &i, ArgEvent &evt, string argName ) : void
OnTabGetLastArg ( CommandEvent &e ) : string

Method Details

Command() public method

public Command ( string name ) : System
name string
return System

Dummy() protected method

protected Dummy ( ArgEvent e ) : void
e ArgEvent
return void

OnInvoke() public method

public OnInvoke ( CommandEvent e ) : void
e CommandEvent
return void

OnTab() public method

public OnTab ( CommandEvent e ) : string
e CommandEvent
return string

ParseBool() protected method

Parse str as bool value, update param and return previous param value.
Can parse 'on' and 'off' strings as (respectively) true and false.
protected ParseBool ( string str, bool &param ) : bool?
str string String to parse.
param bool Reference to bool value to update with str content. If parsing fails, this param is not changed.
return bool?

ParseFloat() protected method

Parse str as float value, update param and return previous param value.
If the first character of str is '+' or '-', the value of str will be added/substracted to/from param, otherwise value of param will be exactly as in string.
protected ParseFloat ( string str, float &param ) : float?
str string String to parse.
param float
return float?

ParseInt() protected method

Parse str as int value, update param and return previous param value.
If the first character of str is '+' or '-', the value of str will be added/substracted to/from param, otherwise value of param will be exactly as in string.
protected ParseInt ( string str, int &param ) : int?
str string String to parse.
param int Reference to int value to update with str content. If parsing fails, this param is not changed.
return int?

ParseVector2() protected method

Parse list as Mogre::Vector2 value, update param and return previous param value.
If the first character of string is '+' or '-', the value of this field will be added/substracted to/from param, otherwise value of param field will be exactly as in string.
protected ParseVector2 ( List list, Mogre &param ) : Mogre.Vector2?
list List List of strings with float values to parse. If list lenght is less than 2 parse fails. If list lenght is greater than 2, additional strings will be ignored.
param Mogre Reference to Mogre::Vector2 value to update with list content. If parsing fails, this param is not changed.
return Mogre.Vector2?

ParseVector3() protected method

Parse list as Mogre::Vector3 value, update param and return previous param value.
If the first character of string is '+' or '-', the value of this field will be added/substracted to/from param, otherwise value of param field will be exactly as in string.
protected ParseVector3 ( List list, Mogre &value ) : Mogre.Vector3?
list List List of strings with float values to parse. If list lenght is less than 3 parse fails. If list lenght is greater than 3, additional strings will be ignored.
value Mogre
return Mogre.Vector3?

ParseVector4() protected method

Parse list as Mogre::Vector4 value, update param and return previous param value.
If the first character of string is '+' or '-', the value of this field will be added/substracted to/from param, otherwise value of param field will be exactly as in string.
protected ParseVector4 ( List list, Mogre &value ) : Mogre.Vector4?
list List List of strings with float values to parse. If list lenght is less than 4 parse fails. If list lenght is greater than 4, additional strings will be ignored.
value Mogre
return Mogre.Vector4?

RegisterAlias() protected method

protected RegisterAlias ( string argName, string aliasName ) : void
argName string
aliasName string
return void

RegisterArg() protected method

protected RegisterArg ( string argName, ArgCall call ) : void
argName string
call ArgCall
return void

RegisterArg() protected method

protected RegisterArg ( string argName, ArgCall call, string helpString ) : void
argName string
call ArgCall
helpString string
return void

RegisterArgs() protected abstract method

protected abstract RegisterArgs ( ) : void
return void

RegisterSubArg() protected method

protected RegisterSubArg ( string argName, string subArgName ) : void
argName string
subArgName string
return void