Changes

Jump to: navigation, search

Project A2 20141 - OOP344

4,508 bytes added, 20:28, 15 March 2014
Tester: Added binaries.
== Custom Additions ==
You may add functions to your design of this assignment as long as they stay true to the "spirit" of the assignment. For example, adding a protected function in CFrame that returns whether the frame is currently in fullscreen mode or not. This function can then be used by all functions that care about whether the frame is currently fullscreen (eg width, height).
 
= Tester =
Please use [https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2testing_mar092014.zip this updated tester package] for testing. It includes an updated a2tester.cpp, cdialog.h, cdialog.cpp. There are 4 testing levels. You can change which level you are testing at by changing the '''TEST_NO''' #define at the top of a2test.cpp. It may be any one of 0,1,2,3,4.
 
Additionally, here are 5 official example windows binaries. These are compiled versions of assignment 2, compiled with the tester setting set to 0,1,2,3, and 4 respectively.
* [https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test0_mar152014.exe a2_test0_mar152014.exe]
* [https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test1_mar152014.exe a2_test1_mar152014.exe]
* [https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test2_mar152014.exe a2_test2_mar152014.exe]
* [https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test3_mar152014.exe a2_test3_mar152014.exe]
* [https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test4_mar152014.exe a2_test4_mar152014.exe]
 
Here are the same binaries compiled on matrix. Download them to your matrix with the wget command. Usage is wget --no-check-certificate address_of_thing_to_download. Note the --no-check-certificate flag. This is because Seneca's HTTPS certificate is out of date and we have to force wget to ignore that fact. Make sure to set the execute bit using chmod.
* [https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test0_mar152014.out https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test0_mar152014.out]
* [https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test1_mar152014.out https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test1_mar152014.out]
* [https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test2_mar152014.out https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test2_mar152014.out]
* [https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test3_mar152014.out https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test3_mar152014.out]
* [https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test4_mar152014.out https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2_test4_mar152014.out]
 
Your assignment is ready for submission when your assignment produces behaviour that is consistent with the above binaries. However, to get 100%, ensure that your assignment meets all of the criteria in the spec/amended spec.
 
== Test 0: A1 Test ==
This test is a direct copy of the A1 tester. It is here to ensure that your display/edit functions work at a minimal level. While your A1 code will not affect your A2 mark, it will be more difficult for you to finish A2 if your A1 is in bad shape so this tester is present as a convenience to help you sort through that.
 
== Test 1: CFrame Test ==
* '''Frame Notes''':
** Frame may overwrite '''but not exceed''' the top line of the screen
** In turn, be sure that the move message overwrites the frame itself on the top line if the frame is currently occupying the top line while the message is displayed <br/>
* '''Inner Frame Notes''':
** Be sure that inner frames '''do not''' overwrite any part of their parent's frame if the parent has a frame
= Spec Code Amendments =
== CFrame ==
=== Functions to be Updated ===
The following functions should be made ==== absrow, abscol ====Please make them '''public''' or '''protected''':. * CFrame::absRow==== width, height ====* CFrame::absColPlease ensure that if the object is in fullscreen mode width returns the width of the screen and height returns the height of the screen.
=== Functions to be Removed ===
* void** data()
* const void* pdata() const
* void display(int offset)
** Remove CField::display since it has no place as we use '''draw''' to print to screen. If you've written any code in the display function of CField, CLine, CLabel, CButton, then migrate it to the respective draw function. By the end of this fix, CField::display should '''no longer exist'''.
=== Functions to be Added ===
== CLine ==
=== Constructors ===
* Both constructors should '''cause memory to be allocated dynamically'''.<br/><br/>In the BTP300 spec, it mentions that the first constructor "passes the address of the data string directly to the CField constructor without allocating any further memory". Please '''ignore that remark''' and allocate memory dynamically anyway and '''copy''' the contents of the incoming data string '''into''' the memory that you are dynamically allocating.<br/><br/>For the rest of the spec, you can now '''assume''' that your CLine object will have dynamically allocated memory.<br/><br/> * Both constructors should accept a '''<u>bool*</u>''' and '''NOT''' a <u>bool</u> for '''insert mode'''. Updated descriptions follow:
==== Constructor 1 ====
'''NOTE:''' In the assignment spec, any value in parentheses ( '''()''' ) is the '''default value''' of that particular parameter.
 
== Headers ==
In this assignment, you need to create a number of header files. You will most likely run into an issue regularly encountered by software developers which is multiple includes, chained includes, and cyclic includes (includes that end up including themselves).
 
To resolve and prevent these issues, use the following guidelines:
 
* Use header include protection. Typically this is done by using preprocessor directives to prevent a header from being included twice. For a header named '''MyHeader.h''', it looks like this:
<pre>
#ifndef __MYHEADER_H__
#define __MYHEADER_H__
 
...
// Header content
...
 
#endif
</pre>
* Try to include headers '''only''' from cpp files. While you should encounter few issues if you consistently apply the suggestion above, you can prevent even more potential problems by including headers only from cpp files.
== iFrame ==
=== Responsibilities ===
CField is responsible for implementing the data setter/getter. As described above, it should have implement the functions:
* void* data() const
* void data(void*)
These functions should do nothing more than get and set an a private void* data member. Child classes should access the data member through the data getter and setter. ==== Child Class Data Storage ====All child classes use some kind of dynamically allocated memory. CLine needs to store a pointer to a dynamically allocated string that it modifies. CLabel and CButton both need to store a pointer to a dynamically allocated string that they display. When implementing these child classes, please use the above data functions to store and retrieve the pointer. '''If you do not, you will crash the a2 tester during some tests!'''
== CLabel ==
\-----------/
</pre>
 
= Tester =
Please use [https://scs.senecac.on.ca/~hasan.kamal-al-deen/public_resources/oop344/a2testing_mar092014.zip this updated tester package] for testing. It includes an updated a2tester.cpp, cdialog.h, cdialog.cpp. There are 4 testing levels. You can change which level you are testing at by changing the '''TEST_NO''' #define at the top of a2test.cpp. It may be any one of 0,1,2,3,4.
 
The tests do not make it clear when your output is "correct" so please refer to this page and the assignment spec when determining that your output is correct.
 
== Test 0: A1 Test ==
This test is a direct copy of the A1 tester. It is here to ensure that your display/edit functions work at a minimal level. While your A1 code will not affect your A2 mark, it will be more difficult for you to finish A2 if your A1 is in bad shape so this tester is present as a convenience to help you sort through that.
 
== Test 1: CFrame Test ==
* '''Frame Notes''':
** Frame may overwrite '''but not exceed''' the top line of the screen
** In turn, be sure that the move message overwrites the frame itself on the top line if the frame is currently occupying the top line while the message is displayed <br/>
* '''Inner Frame Notes''':
** Be sure that inner frames '''do not''' overwrite any part of their parent's frame if the parent has a frame

Navigation menu