Changes

Jump to: navigation, search

Project R0.1 20133 - OOP344

3,059 bytes added, 12:00, 16 October 2013
How to Compile
* [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
* [https://github.com/adaniele87/AssignTesting/blob/master/cio_tester.cpp Simple test main]
*: Note: this does not check for 100% completion of the assignment but does allow you to have a simple screen that utilizes the methods and overloads you create for the assignment
=Due Dates=
* Wednesday Oct 9th, 23:59
=Help=
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.
 
* Instead of returning an ostream operator why << and >> operators return console by reference here??
*[http://dimpleamin204.blogspot.ca/2013/10/need-help-for-operators.html Dimple's Bolgs]
 
 
==Blog Posts==
*Issues when compiling cio_test object.
:[http://thatdude22.wordpress.com/2013/10/09/submission-issues/ The error]
 
*Cannot use printf and cout function Problem.
*:[http://mikesayhi.wordpress.com/2013/09/27/cannot-print-any-text/ Sehui's Code]
*:'''Possible solution''': Include iostream library (#include <iostream>) ―[[User:Justin Sean Wilkin|Justin Sean Wilkin]]
*:'''By the way''': printf is located in cstdio (#include <cstdio>) ―[[User:Jingwei Sun|Luke Jingwei Sun]]
*:'''Solution''':[http://mikesayhi.wordpress.com/2013/09/28/solution-cannot-use-print-any-text/ Sehui's solution]
 
*Ran into some issues with the compiler not being able to find the "ncurses.h" file. This might help if anyone is experiencing the same issue on linux.
*:[http://codegenetix.blogspot.ca/2013/09/fatal-error-ncursesh-no-such-file-or.html Haysean's Blog]
 
*I seem to not be able to get past test 4.10 (RESOLVED) - check blog for more info
*:[http://bradc14.wordpress.com/2013/10/04/test-4-10/ Brad's Blog]
 
*For some reason the compiler is not accepting the static deceleration in the cpp file and is saying "It's a non static member"
*:[http://sgrybas.wordpress.com/2013/10/07/declaring-static-variables Saul's Blog]
 
*Test #4.2 and #4.17 look the same except their return key. 4.2 wants to error be fixed and return 'RETURN' key whereas, 4.17 wants the same error be fixed and return '0'. Any idea about that?
*:[http://m-aryafar.blogspot.ca/2013/10/assignment-1-ciotester-test-42-vs-417.html Mohammad's Blog]
 
*Test 4.2 - What are we suppose to be checking for? Also mild display issues
*:[http://sgrybas.wordpress.com/2013/10/09/keep-failing-test-4-02 Saul's Blog]
 
* submit trouble. After I've passed all of test, I can't send a mail.- solved (use extern)
*:[http://mikesayhi.wordpress.com/2013/10/09/linux-makes-me-sick/ Sehui's Blog]
 
*Having trouble passing tests 4.17 and 4.18. The tester is giving me conflicting information (RESOLVED)
*:[http://codegenetix.blogspot.ca/2013/10/test-4.html Haysean's Blog]
=Learning Outcome=
==Specifications==
Your submission consists of a class called Console that is to be inherited from BConsole in a namespace called '''cio'''. Your application module is fully portable across Borland C++5.5 on windows, Linux GNU C++, Viusual Visual 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 (i.e. the global instance of Console) 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 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:
void display(const char* str, int row, int col, int fieldLen=0, int curpos = -1);
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) and positions the cursor at "curpos" location relative to "col", only if it is greater or equal to zero.<!--If the value of curpos is placing the cursor after the last character of str, then the value is ignored and the cursor is placed right after the last character of str. (Joseph: is this needed?)-->
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 entire string, followed by enough trailing spaces to fill out the field completely.
<big><pre>
int edit(char *str, int row, int col, int fieldLength, int maxStrLength,
int* strOffset=_stroff(int*)0, int* curPosition=_curpos(int*)0,
bool InTextEditor = false, bool ReadOnly = false, bool& insertMode=_insertMode );
</pre></big>
''Ignore the two arguments '''(InTextEditor and ReadOnly)''' 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 is a reference to a bool variable that holds stores the current editing mode (insert mode of the stringor over-strike). The By default, this parameter insertMode receives holds the address reference of a variable that stores static bool attribute of the Console class (i.e. _insertMode) which globalizes the current editing insert/over-strike mode - insert or overwritebetween all instances of '''Console'''. 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.
* '''''Initial Corrections'''''
*:Do the following initial corrections before you engage in editing the string at the very beginning of the method.
*: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. 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. (to do this have a local variable for the offset that holds zero to be pointed instead of an external variable)
*: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.(like the offset, to do this have a local variable for the cursor position that holds zero to be pointed instead of an external variable)
====Step two====
''First run your program with [https://github.com/Seneca-OOP344/20133notes/blob/master/cio/cio_test.cpp cio_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:
=====InTextEditor=====
Console& operator<<(Console& cn, const char* str);
print the string '''str''' on the screen where the cursor is using '''cn''' and return the cn reference
 
=Submission=
*: ''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 .senecacollege.ca (only use putty with the setting stated at [[#Notes|Notes]]) run:
<big><pre>
$ ~fardad.soleimanloo/cio_test
</pre></big> -->
==How to Compile==
Compile and test your code with the [https://github.com/Seneca-OOP344/20133notes/blob/master/cio/cio_test.cpp test-main], in the following command-line environments and visual studio.
Local PC: Borland 5.5
bcc32 bconsole.cpp console.cpp coi_testcio_test.cpp
Local Mac: (use -lcurses to link curses library)
c++ bconsole.cpp console.cpp coi_testcio_test.cpp -lcurses -Wno-write-strings
matrix: GNU (use -lncurses to link ncurses library)
Local PC: Visual Studio.net
=== Tester Program ===
<!--*Tester program is at : '''git://@github.com/:Seneca-OOP344/20132notes20133notes.git (Notes repository) in '''TesterPrograms''' directory, in /cio/cio_test.cpp *repo path:<br[https:/>/github.com/Seneca-OOP344/20133notes/tree/master/cio cio]*:[https://github.com/Seneca-OOP344/20132notes.git 20132notes]20133notes/blob/master/TesterProgramscio/cio_test.cpp -->cio_test.cpp]
==How to submit==
TBA<!--For submission , ; first your solution must compile, link, and run without errors /warnings in each environmentall environments.
First pull the changes of the two files bconsole.cpp and bconsole.h to version 1.03 (jun 1, 2013) from the conui directory in notes repository of your section. Test your program with cio_test.cpp from the same conui cio directory stated abovein 20133Notes repository on GitHub (V0.95.2). When your program passed all the tests; log on to matrix.senecacollege.ca (using putty), and create a directory and copy all the source files (console.cpp, console.h, bconsole.cpp, bconsole.h) into it. Then change the working directory to the newly created directory (CD to the new directory). Then issue the following command by copy cio_test.o from "and pasting it to the putty terminal screen:<big><pre>cp ~fardad.soleimanloo" and then compile your code with your 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 Fardad automatically with your source code (console; c++ bconsole.h and cpp console.cpp) attached to itcio_test.o -lncurses -Wno-write-strings 2>result.txt; cat result.txt</pre></big>
to This will copy the cio_test.o execute the following on matrix.<br />From the tester object file to current directory containing all source files: $cp ~fardad.soleimanloo/cio_test.o .to , compile the your code:and dump any possible error/warning $ g++ bconsole.cpp consolemessages into the file result.cpp cio_testtxt.o -lncurses -Wno-write-strings<br />
This should not generate any warnings.<br />
To run the test (with automatic submission), execute: $ a.out TeamNameWithNoSpaces Team Member names separated with commas X <ENTER>Examplewhere X is your section, so if you are in section B it would be: $ a.out Team-X Fardad Soleimanloo, Joseph Hughes, Homer Simpson, Apu Nahasapeemapetilon B <ENTER>-->Run the test to the end and if everything is ok, an email will be sent to your professor with your assignment files, and compile result attached.

Navigation menu