amath
1.8.5
Simple command line calculator
|
ANSI console controller. More...
#include <aengine.h>
Public Member Functions | |
AnsiConoleEngine (const char *prompt, CharValidator *validator) | |
~AnsiConoleEngine () | |
void | StartInput () |
bool | InputDone () const |
const char * | GetLine () const |
void | SetPrompt (const char *string) |
const char * | ProcessChar (const unsigned char character) |
void | Enable () |
void | Disable () |
Private Member Functions | |
void | CopyLine () |
void | ShowLast () |
void | ShowNext () |
Private Attributes | |
char * | prompt |
bool | enabled |
char ** | lines |
CharBuffer * | linebuf |
CharValidator * | validator |
unsigned int | len |
char * | cursor |
char * | endpos |
int | curline |
int | showline |
bool | lineswap |
char * | editline |
bool | escmode |
bool | csimode |
bool | delmode |
bool | linedone |
CharBuffer * | out |
Static Private Attributes | |
static const int | maxLines = 100 |
static const int | lineSize = 1024 |
ANSI console controller.
More info on the ANSI console is available at Wikipedia: https://wikipedia.org/wiki/ANSI_escape_code
AnsiConoleEngine::AnsiConoleEngine | ( | const char * | prompt, |
CharValidator * | validator | ||
) |
Definition at line 44 of file aengine.cpp.
References AllocAndCopy(), CharBuffer::CharBuffer(), curline, editline, enabled, linebuf, lines, maxLines, out, prompt, and validator.
AnsiConoleEngine::~AnsiConoleEngine | ( | ) |
|
private |
Definition at line 268 of file aengine.cpp.
References AllocAndCopy(), curline, editline, CharBuffer::GetString(), linebuf, lines, and maxLines.
Referenced by ProcessChar().
void AnsiConoleEngine::Disable | ( | ) |
Definition at line 84 of file aengine.cpp.
References enabled.
void AnsiConoleEngine::Enable | ( | ) |
Definition at line 79 of file aengine.cpp.
References enabled.
const char * AnsiConoleEngine::GetLine | ( | ) | const |
Definition at line 385 of file aengine.cpp.
References CharBuffer::GetString(), and linebuf.
bool AnsiConoleEngine::InputDone | ( | ) | const |
Definition at line 380 of file aengine.cpp.
References linedone.
const char * AnsiConoleEngine::ProcessChar | ( | const unsigned char | character | ) |
Definition at line 104 of file aengine.cpp.
References CharBuffer::Append(), CharBuffer::buf, CopyLine(), csimode, cursor, delmode, CharBuffer::Empty(), enabled, endpos, CharBuffer::EnsureGrowth(), escmode, CharBuffer::GetString(), len, linebuf, linedone, lineSize, out, CharBuffer::ptr, ShowLast(), ShowNext(), CharValidator::Validate(), and validator.
void AnsiConoleEngine::SetPrompt | ( | const char * | string | ) |
Definition at line 390 of file aengine.cpp.
References AllocAndCopy(), and prompt.
|
private |
Definition at line 292 of file aengine.cpp.
References AllocAndCopy(), CharBuffer::Append(), CharBuffer::buf, curline, cursor, editline, CharBuffer::Empty(), endpos, CharBuffer::EnsureSize(), CharBuffer::GetString(), len, linebuf, lines, lineSize, lineswap, out, prompt, showline, and StrLen().
Referenced by ProcessChar().
|
private |
Definition at line 337 of file aengine.cpp.
References CharBuffer::Append(), CharBuffer::buf, curline, cursor, editline, CharBuffer::Empty(), endpos, CharBuffer::EnsureGrowth(), CharBuffer::EnsureSize(), CharBuffer::GetString(), len, linebuf, lines, lineSize, lineswap, out, prompt, showline, and StrLen().
Referenced by ProcessChar().
void AnsiConoleEngine::StartInput | ( | ) |
Definition at line 89 of file aengine.cpp.
References CharBuffer::buf, CharBuffer::ClearAndAlloc(), csimode, cursor, delmode, endpos, escmode, len, linebuf, linedone, lineSize, and lineswap.
|
private |
Definition at line 84 of file aengine.h.
Referenced by ProcessChar(), and StartInput().
|
private |
Definition at line 78 of file aengine.h.
Referenced by AnsiConoleEngine(), CopyLine(), ShowLast(), and ShowNext().
|
private |
Definition at line 75 of file aengine.h.
Referenced by ProcessChar(), ShowLast(), ShowNext(), and StartInput().
|
private |
Definition at line 85 of file aengine.h.
Referenced by ProcessChar(), and StartInput().
|
private |
Definition at line 81 of file aengine.h.
Referenced by AnsiConoleEngine(), CopyLine(), ShowLast(), and ShowNext().
|
private |
Definition at line 67 of file aengine.h.
Referenced by AnsiConoleEngine(), Disable(), Enable(), and ProcessChar().
|
private |
Definition at line 76 of file aengine.h.
Referenced by ProcessChar(), ShowLast(), ShowNext(), and StartInput().
|
private |
Definition at line 83 of file aengine.h.
Referenced by ProcessChar(), and StartInput().
|
private |
Definition at line 74 of file aengine.h.
Referenced by ProcessChar(), ShowLast(), ShowNext(), and StartInput().
|
private |
Definition at line 72 of file aengine.h.
Referenced by AnsiConoleEngine(), CopyLine(), GetLine(), ProcessChar(), ShowLast(), ShowNext(), StartInput(), and ~AnsiConoleEngine().
|
private |
Definition at line 86 of file aengine.h.
Referenced by InputDone(), ProcessChar(), and StartInput().
|
private |
Definition at line 71 of file aengine.h.
Referenced by AnsiConoleEngine(), CopyLine(), ShowLast(), ShowNext(), and ~AnsiConoleEngine().
|
staticprivate |
Definition at line 70 of file aengine.h.
Referenced by ProcessChar(), ShowLast(), ShowNext(), and StartInput().
|
private |
Definition at line 80 of file aengine.h.
Referenced by ShowLast(), ShowNext(), and StartInput().
|
staticprivate |
Definition at line 69 of file aengine.h.
Referenced by AnsiConoleEngine(), CopyLine(), and ~AnsiConoleEngine().
|
private |
Definition at line 87 of file aengine.h.
Referenced by AnsiConoleEngine(), ProcessChar(), ShowLast(), ShowNext(), and ~AnsiConoleEngine().
|
private |
Definition at line 66 of file aengine.h.
Referenced by AnsiConoleEngine(), SetPrompt(), ShowLast(), ShowNext(), and ~AnsiConoleEngine().
|
private |
Definition at line 79 of file aengine.h.
Referenced by ShowLast(), and ShowNext().
|
private |
Definition at line 73 of file aengine.h.
Referenced by AnsiConoleEngine(), and ProcessChar().