Changes

Jump to: navigation, search

Line Editing Facility - OOP344 20113

272 bytes added, 21:17, 27 September 2011
no edit summary
=Due Dates=
* display() method is due on Tuesday, Sep 20, 23:59
* Complete Console 2.0 is due on Tuesday, Sep 27th, 23:59
 
=Hints=
*If want to put more hints in to help other, please update the time and date also. So everyone will know it is recently updated.<br/>
[[Hints for OOP344 Assignment 1]] Updated 7:41 Sept 27
 
=Help Needed=
* I have problem with matrix compiler http://ryandang-cpa.blogspot.com/2011/09/issue-with-matrix-compiler.html
=Line Editing Facility =
*a line editor
*an application that uses your line editor
==Diagram==
 
Diagram link: http://i282.photobucket.com/albums/kk241/Kamunist/oop_diagram.png
==Specifications==
void display(const char *str, int row, int col, int fieldLen = 0)
This method outputs the C-style, null-terminated string pointed to by str starting at row row and column col of the screen in a field of fieldLen characters. Row value 0 refers to the top row, and column value 0 refers to the left-most column. If the string is longer than fieldLen, your function displays the first fieldLen characters. If the string is shorter than fieldLen, your function displays the portion of the entire string that fits on the screen, followed by enough trailing spaces to fill out the field completely. If fieldLen is 0 or less, your function displays the portion of the entire string that fits on the screen with no trailing spaces. Your function positions the cursor after the last character displayed, but excluding any added trailing spaces, if the last character is not in the last column of the screen; otherwise, your function positions the cursor under the last character on the screen. Your function does not flush the output buffer. The results are undefined if the starting position of the string is not within the dimensions of the screen.
===edit() function===
<big><pre> int edit(char *str, int row, int col, int fieldLength, int maxStrLength, bool* insertMode, int* strOffset, int* curPosition)</pre></big>
This methods edits the C-style, null-terminated string pointed to by str. The parameter row holds the row (0 is the top row) of the string on the screen. The parameter col holds the starting column (0 is the left-most column) on the screen. The parameter fieldLength holds the length of the editable field. The string may be larger than the field itself, in which case part of the string is hidden from view. The parameter maxStrLength holds the maximum length of the string, excluding the null byte. The parameter insertMode points to a bool variable that holds the current insert mode of the string. The parameter insertMode receives the address of a variable that stores the current editing mode - insert or overwrite. The parameter strOffset points to an int variable that holds the initial offset of the string within the field; that is, the index of the character in the string that initially occupies the first character position in the field. The parameter curPosition points to an int variable that holds the initial cursor position within the field; that is, the index of the character in the field at which the cursor is initially placed.
If the initial offset is beyond the end of the string, your function resets the offset to the length of the string; that is, to the index of the character immediately beyond the end of the string. <span style="color:#FF0000">If no offset variable is pointed to; that is, if the address of the variable is NULL, your function sets the offset to the index of the first character in the string; that is, to 0. (Need clarification, can't give a value to a NULL pointer. See below...)</span><br /><code>if(strOffset == NULL) *strOffset = 0;</code>
If the initial cursor position is beyond the end of the field, your function resets the position to the last character in the field. If the position is beyond the end of the string, your function resets the position to that immediately beyond the end of the string. If no cursor position variable is pointed to; that is, if the address of the variable is NULL, your function sets the cursor position to the first position in the field; that is, to position 0.
You may assume that it is the calling program's responsibility to ensure that the string array is large enough to handle maxStrLength characters and that the starting screen position provides enough room (on the screen) for the field, etc.
 
===Tester Program===
===Grading===
===Submission===
Compile and test your upgrade with your test main a1test.cpp in the following three command-line environments:
Local PC: Borland 5.5 bcc32 console.cpp yourtestprogram.cpp
Local PC: Microsoft .net
 matrix: GNU(use -lncurses to link ncurses library) g++ console.cpp yourtestprogram.cpp -lncurses
For submission purposes, your solution must compile, link, and run without errors in each environment.
ZIP (ZIP only) keys.h, console.h, console.cpp, yourtestprogram.cpp into one file and email it to:[mailto:fardad.soleimanloo@senecac.on.ca?subject=OOP344-display console2.0 fardad.soleimanloo@senecac.on.ca]
(To be completed....)
1
edit

Navigation menu