Open main menu

CDOT Wiki β

Changes

OOP344 Assignment Two

1,831 bytes added, 02:45, 5 November 2009
m
IO_Vedit
==IO_Vedit==
Inherit IO_Edit to a Validated line editor called IO_Vedit.
IO_Vedit, works exactly like an IO_Edit, with two differences.
IO_Vedit has two extra attributes that are pointers to Validation and Help functions:
<big><pre>
void (*_Help)(MessageStatus, IO_Form&);
bool (*_Validate)(const char*, IO_Form&);
</pre></big>
 
===Constructors===
<big><pre>
IO_Vedit(int row, int col, int fieldlen,
int maxdatalen, int* insertmode,
bool framed = false,
bool (*Validate)(const char* , IO_Form&) = NO_VFUNC,
void (*Help)(MessageStatus, IO_Form&) = NO_FUNC,
const char* frameChars = (const char*)0);
IO_Vedit(char* str, int row, int col, int fieldlen,
int maxdatalen, int* insertmode,
bool framed = false,
bool (*Validate)(const char*, IO_Form&) = NO_VFUNC,
void (*Help)(MessageStatus, IO_Form&) = NO_FUNC,
const char* frameChars = (const char*)0);
</pre></big>
 
These two constructors pass all the information directly to IO_Edit's constructor and then set the "function pointers" attributes to their corresponding arguments.
 
===Public Function===
 
<big><pre>
int edit();
</pre></big>
 
* if '''_owner''' of IO_Vedit is null, then it simply calls the IO_Edit's '''edit()''' and terminates (returning the same value as IO_Edit::edit())
* if '''_owner''' is not null
* if the help function pointer attribute is not NULL, it will call it passing '''SetMesssage'' , and '''*_owner''' as arguments
* if the validation function pointer is not null then it will call the IO_Edit::edit() and validate the data with it by keep repeating the IO_Edit::edit() until either validation function return true or the IO_Edit::edit() was terminated by a non navigation key.
* Navigation keys are: '''UP_KEY DOWN_KEY TAB_KEY and ENTER_KEY'''
* IO_Vedit::edit() will return the return value of IO_Eidt::edit().
 
==IO_CheckList==