Zend Framework  3.0
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
WindowsAnsicon Class Reference

MS Windows with ANSICON console adapter. More...

Public Member Functions

 getWidth ()
 Determine and return current console width.
 
 getHeight ()
 Determine and return current console height.
 
 isUtf8 ()
 Check if console is UTF-8 compatible.
 
 getTitle ()
 Return current console window title.
 
 clear ()
 Clear console screen.
 
 clearLine ()
 Clear line at cursor position.
 
 setCharset (CharsetInterface $charset)
 Set Console charset to use.
 
 getCharset ()
 Get charset currently in use by this adapter.
 
 getDefaultCharset ()
 
 readChar ($mask=null)
 Read a single character from the console input.
 
- Public Member Functions inherited from Posix
 writeLine ($text="", $color=null, $bgColor=null)
 Write a single line of text to console and advance cursor to the next line.
 
 getWidth ()
 Determine and return current console width.
 
 getHeight ()
 Determine and return current console height.
 
 isUtf8 ()
 Check if console is UTF-8 compatible.
 
 showCursor ()
 Show console cursor.
 
 hideCursor ()
 Hide console cursor.
 
 setPos ($x, $y)
 Set cursor position.
 
 colorize ($string, $color=null, $bgColor=null)
 Prepare a string that will be rendered in color.
 
 setColor ($color)
 Change current drawing color.
 
 setBgColor ($bgColor)
 Change current drawing background color.
 
 resetColor ()
 Reset color to console default.
 
 setCharset (Charset\CharsetInterface $charset)
 Set Console charset to use.
 
 getCharset ()
 Get charset currently in use by this adapter.
 
 getDefaultCharset ()
 
 readChar ($mask=null)
 Read a single character from the console input.
 
 clear ()
 Reset color to console default.
 
- Public Member Functions inherited from AbstractAdapter
 write ($text, $color=null, $bgColor=null)
 Write a chunk of text to console.
 
 writeText ($text, $color=null, $bgColor=null)
 Alias for write()
 
 writeLine ($text="", $color=null, $bgColor=null)
 Write a single line of text to console and advance cursor to the next line.
 
 writeAt ($text, $x, $y, $color=null, $bgColor=null)
 Write a piece of text at the coordinates of $x and $y.
 
 writeBox ($x1, $y1, $x2, $y2, $lineStyle=self::LINE_SINGLE, $fillStyle=self::FILL_NONE, $color=null, $bgColor=null, $fillColor=null, $fillBgColor=null)
 Write a box at the specified coordinates.
 
 writeTextBlock ($text, $width, $height=null, $x=0, $y=0, $color=null, $bgColor=null)
 Write a block of text at the given coordinates, matching the supplied width and height.
 
 getWidth ()
 Determine and return current console width.
 
 getHeight ()
 Determine and return current console height.
 
 getSize ()
 Determine and return current console width and height.
 
 isUtf8 ()
 Check if console is UTF-8 compatible.
 
 setPos ($x, $y)
 Set cursor position.
 
 showCursor ()
 Show console cursor.
 
 hideCursor ()
 Hide console cursor.
 
 getTitle ()
 Return current console window title.
 
 colorize ($string, $color=null, $bgColor=null)
 Prepare a string that will be rendered in color.
 
 setColor ($color)
 Change current drawing color.
 
 setBgColor ($color)
 Change current drawing background color.
 
 resetColor ()
 Reset color to console default.
 
 setCharset (Charset\CharsetInterface $charset)
 Set Console charset to use.
 
 getCharset ()
 Get charset currently in use by this adapter.
 
 getDefaultCharset ()
 
 clear ()
 Clear console screen.
 
 clearLine ()
 Clear line at cursor position.
 
 clearScreen ()
 Clear console screen.
 
 readLine ($maxLength=2048)
 Read a single line from the console input.
 
 readChar ($mask=null)
 Read a single character from the console input.
 
 encodeText ($text)
 Encode a text to match console encoding.
 

Protected Member Functions

 runModeCommand ()
 Run and cache results of mode command.
 
- Protected Member Functions inherited from Posix
 runModeCommand ()
 Run a mode command and store results.
 
 restoreTTYMode ()
 Restore TTY (Console) mode to previous value.
 
 setTTYMode ($mode)
 Change TTY (Console) mode.
 
 getColorCode ($color, $type= 'fg')
 Get the final color code and throw exception on error.
 

Protected Attributes

 $modeResult
 
- Protected Attributes inherited from Posix
 $charset
 
 $lastTTYMode = null
 
- Protected Attributes inherited from AbstractAdapter
 $charset
 
 $posX
 
 $posY
 

Static Protected Attributes

static $hasMBString
 
- Static Protected Attributes inherited from Posix
static $hasMBString
 
static $ansiColorMap
 
- Static Protected Attributes inherited from AbstractAdapter
static $hasMBString
 

Additional Inherited Members

- Public Attributes inherited from AdapterInterface
const LINE_NONE = 1
 
const LINE_SINGLE = 2
 
const LINE_DOUBLE = 3
 
const LINE_BLOCK = 4
 
const FILL_NONE = 0
 
const FILL_SHADE_LIGHT = 1
 
const FILL_SHADE_MEDIUM = 2
 
const FILL_SHADE_DARK = 3
 
const FILL_BLOCK = 10
 

Detailed Description

MS Windows with ANSICON console adapter.

This adapter requires ANSICON extension to be installed. It can be obtained from: https://github.com/adoxa/ansicon

ANSICON has to be loaded and enabled before using this adapter. It's best to install it using following command: ansicon -I

Console should not run in UTF8 code page (65001), because ANSICON does not behave well with it. It's best to use non-unicode code page 437, 850, 851, 852 or similar. Run "help mode" for more information on how to change Windows console code page.

Member Function Documentation

clear ( )

Clear console screen.

Implements AdapterInterface.

clearLine ( )

Clear line at cursor position.

Implements AdapterInterface.

getCharset ( )

Get charset currently in use by this adapter.

Returns
CharsetInterface $charset

Implements AdapterInterface.

getDefaultCharset ( )
Returns
Charset

Implements AdapterInterface.

getHeight ( )

Determine and return current console height.

Returns
false|int

Implements AdapterInterface.

getTitle ( )

Return current console window title.

Returns
string

Implements AdapterInterface.

getWidth ( )

Determine and return current console width.

Returns
int

Implements AdapterInterface.

isUtf8 ( )

Check if console is UTF-8 compatible.

Returns
bool

Implements AdapterInterface.

readChar (   $mask = null)

Read a single character from the console input.

Parameters
string | null$maskA list of allowed chars
Returns
string
Exceptions
Exception\RuntimeException

Implements AdapterInterface.

runModeCommand ( )
protected

Run and cache results of mode command.

Returns
void
setCharset ( CharsetInterface  $charset)

Set Console charset to use.

Parameters
CharsetInterface$charset

Implements AdapterInterface.

Member Data Documentation

$hasMBString
staticprotected
$modeResult
protected