Changes

Jump to: navigation, search

Project R0.1 20132- OOP344

655 bytes added, 09:34, 24 September 2013
How to submit
{{OOP344 Index | 2013120133}}
=Release=
* 0.1
=Notes=
* Using Matrix, from windows: please use [http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe putty] only and set the keyboard to
*: Backspace = Ctrl-?
*: Home and End = Standard
*: Function keys and keypad = Linux
*: And then:
*: Connection > Data > Terminal-type string = linux (This step must be done when first connecting through putty!)
<!--*:: Or if you have already connected, type in (export TERM="linux") without brackets
** If you're still having problems do all of that AND (export TERM="linux") and it will allow you to use END and HOME, though the F keys still won't work. -->
* [https://cs.senecac.on.ca/~chris.szalwinski/resources/borland.html Guide for Using Borland 5.5]
*: Note that to change the cmd.exe window size, right click on the top bar -> Properties -> Layout Tab
 
=Due Dates=
=Help=
==Help Needed==Please blog about your problems and notes and add the link with a proper title below.<br />Reply to others blogs to help and update the blog link to indicate you replied to them.
==Blog Posts==
 
=Learning Outcome=
Upon successful completion of this first assignment, you will have demonstrated the abilities to design and code
==Specifications==
Your submission consists of a class called Console that is to be inherited from BConsole in a namespace called '''cuicio'''. Your application module is fully portable across Borland C++5.5 on windows, Linux GNU C++, Viusual C++ on Windows and Mac C++ platforms which accepts console input, and provides console output through the set of facilities available in your Console module.
The name of the library object to be created is console. The header file for the original version of this module is console.h and the implementation file for the original version is console.cpp. All of the identifiers for the library module and all upgrades to the module are defined in the cui cio namespace (short for console input output).
Your upgrade in this assignment consists of creating a class called Console, inherited from BConsole, implemented in two files; console.h and console.cpp:
In addition to all public methods of BConsole, Console must have the following two public methods and overload "<<" and ">>" operators.
===external links===
* instantiate Console, in an object called "console" in cui cio namespace and create an external linkage to in console.h===strdspdisplay() method===
void display(const char* str, int row, int col, int fieldLen=0, int curpos = -1);
Your function positions the cursor after the last character displayed if curpos is less than zero otherwise it positions the cursor at "curpos" location relative to "col". The results are undefined if the starting position of the string is not within the dimensions of the screen.
===lineeditedit() method===
<big><pre>
int lineeditedit(char *str, int row, int col, int fieldLength, int maxStrLength,
int* strOffset=_stroff, int* curPosition=_curpos,
bool InTextEditor = false, bool ReadOnly = false, bool& insertMode=_insertMode );
This method is to be written in two steps.
====Step one====
''Ignore the last two arguments of the edit method '''(IsTextEditor InTextEditor and ReadOnly)''' and for now write the method as follows:''
This method edits the C-style, null-terminated string pointed 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.
Your function uses the symbolic names for non-ASCII and special keys defined in the keys.h header file. These names are the same symbolic names as those used in the original library module.
The user terminates editing by pressing ENTER, ESCAPE, TAB, ESCAPE, UP, DOWN, PGUP, PGDN or any of the function keys F(1) through F(12) inclusive. If the user presses ESCAPE, your function aborts editing, replaces the contents of the string with the original contents upon entry into your function, and leaves the offset and cursor position values unaltered. In order to be able to revert to the original string, your function needs to allocate memory at run time.
At termination, your function passes back through the same int variables the current values of the offset and the cursor position, unless no variables were pointed to upon entry into your function; that is, unless the value of either address was NULL.
*RIGHT - moves the cursor right one character, if possible, changing the offset, if necessary.
*HOME - moves the cursor to the beginning of the string, changing the offset, if necessary.
*END - moves the cursor to the position to the right of the last character in the string, changing the offset, if necessary. <strike> If the last character is at the edge of the screen, moves the cursor to that character.</strike>
*INSERT - toggles Insert/Overstrike mode. In Insert mode, your function inserts a printable character into the string at the current cursor position, moves the remainder of the string to the right to make room for the inserted character, and positions the cursor just to the right of the inserted character. The printable characters are the characters from space (' ') to tilde ('~') inclusive in the ASCII table. In Overstrike mode, your function overwrites the character (if any) at the current cursor position with a printable character and advances the cursor just to the right of the new character. If the cursor is past the end of the string, your function appends a printable character to the string as long as the string isn't full, regardless of the mode.
*DEL - discards the character at the current cursor position and moves all characters to the right of the cursor position one position to the left.
====Step two====
''First run your program with cui_testcio_test.cpp and make sure it passes all the tests up to and including "4.16". If all tests are passed continue with step two:
=====IsTextEditorInTextEditor=====If '''IsTextEditorInTextEditor''' is true and the value of '''*strOffset''' is changed at any time, then terminate the edit function immediately and return '''0''';
======TAB key======
If '''IsTextEditorInTextEditor''' is true and TAB key is hit, then instead of terminating the function, ''Console::_tabsize'' spaces are inserted into ''str''.
=====ReadOnly=====
=Submission=
==Common Submission mistakes==
TBA<!--* Submitting the assignment with old version of cui_textcio_text.o
*: ''Make sure you copy the latest version (currently 0.94.1) from my account : $cp ~fardad.soleimanloo/cio_test.o
* Using tab character''
*: ''As mentioned in class using tab character in your text editor makes the indentation of your code different in different editors, please make sure before submission you go to the settings of your development environment and make sure it uses spaces instead of tab character.'' -->
==Tester Demo==
TBA
<!--To see how tester runs, you can run on Matrix (only use putty with the setting stated at [[#Notes|Notes]]) run:
<big><pre>
$ ~fardad.soleimanloo/cui_testcio_test
</pre></big> -->
==How to Compile==
 
Compile and test your code with the test-main, in the following command-line environments and visual studio.
Local PC: Borland 5.5
bcc32 bconsole.cpp console.cpp cui_testcoi_test.cpp
Local Mac: (use -lcurses to link curses library)
c++ bconsole.cpp console.cpp cui_testcoi_test.cpp -lcurses -Wno-write-strings
matrix: GNU (use -lncurses to link ncurses library)
g++ bconsole.cpp console.cpp cui_testcio_test.cpp -lncurses -Wno-write-strings
Local PC: Visual Studio.net
=== Tester Program ===
<!--*Tester program is at git://github.com/Seneca-OOP344/20132notes.git (Notes repository) in '''TesterPrograms''' directory.
*repo path:<br/>
*:[https://github.com/Seneca-OOP344/20132notes.git 20132notes]/TesterPrograms/cio_test.cpp -->
==How to submit==
TBA<!--For submission purposes, your solution must compile, link, and run without errors in each environment.
First pull the changes of the two files bconsole.cpp and bconsole.h to version 1.02 03 (Feb jun 1, 2013) from the console conui directory in notes repository of your section.
Test your program with cio_test.cpp from the same console conui directory stated above. When your program passed all the tests; on matrix, create a directory and copy all the source files (console.cpp, console.h, bconsole.cpp, bconsole.h) into it. Then copy cio_test.o '<big>''''V 0.94.1'''''</big> from "~fardad.soleimanloo" and then compile your code with your professors Fardad's version of cio_test (i.e cio_test.o) and run it. If all the tests are passed successfully, an email will be sent to your professor Fardad automatically with your source code (console.h and console.cpp) attached to it.
to copy the cio_test.o do execute the followingon matrix.<br />
From the directory containing all source files:
$cp ~fardad.soleimanloo/cio_test.o .
to compile the code:
$g++ bconsole.cpp console.cpp cio_test.o -lncurses-Wno-write-strings<br />
This should not generate any warnings.<br />
To run the test (with automatic submission)
$ a.out your_student_number Your Full Name as on Student Card TeamNameWithNoSpaces Team Member names separated with commas <ENTER>
Example:
$ a.out 012345678 Home Jay Team-X Fardad Soleimanloo, Joseph Hughes, Homer Simpson , Apu Nahasapeemapetilon <ENTER> -->== Tasks Distribution Suggestion===== Team of 3 ===* Programmer 1*# Tab*# Overstrike *# Insert Mode* Programmer 2*# Intial Corrections *# Home*# End*# Escape*# Right*# Left*# Enter* Programmer 3*# BackSpace*# Del*# IsTextEditor and ReadOnly*# Function keys*# operator>> int&*# operator<< char*# operator<< char**# Insert === Team of 4 ===<!--  Tab: 23Function keys: 1Overstrike: 15operator>> int& 3operator<< char 3operator<< char* 4Insert: 1  Intial Corrections: 18 Home: 4End: 7Escape: 5Right: 10Left: 4Enter: 1 BackSpace: 23Del: 3Insert Mode: 14IsTextEditor and ReadOnly 10 
-->

Navigation menu