Difference between revisions of "Console UI Core Classes - OOP344 20112"
Line 36: | Line 36: | ||
==Adding Buffering logic to your iol logic== | ==Adding Buffering logic to your iol logic== | ||
Duedate: Sunday Jul 24th, 23:59; | Duedate: Sunday Jul 24th, 23:59; | ||
+ | |||
+ | = IOL General Header file (iolgh.h)= | ||
+ | The general header file holds the common setting and definition between all the Core Classes. | ||
+ | <big><syntaxhighlight lang="cpp"> | ||
+ | |||
+ | #ifndef ___IOLGH_H__ | ||
+ | #define ___IOLGH_H__ | ||
+ | |||
+ | #ifndef _CRT_SECURE_NO_DEPRECATE | ||
+ | #define _CRT_SECURE_NO_DEPRECATE | ||
+ | #endif | ||
+ | #ifndef _CRT_SECURE_NO_WARNINGS | ||
+ | #define _CRT_SECURE_NO_WARNINGS | ||
+ | #endif | ||
+ | |||
+ | #define C_MAX_NO_FIELDS 100 | ||
+ | #define C_BUTTON_HIT 1 | ||
+ | #define C_MAX_LINE_CHARS (1024u) | ||
+ | |||
+ | //#define C_REFRESH -2 | ||
+ | #define C_FULL_FRAME -1 | ||
+ | #define C_NO_FRAME 0 | ||
+ | |||
+ | #define C_BORDER_CHARS "/-\\|/-\\|" | ||
+ | enum CDirection {iol_centre, iol_left, iol_right, iol_up, iol_down}; | ||
+ | |||
+ | extern "C"{ | ||
+ | #include "iol.h" | ||
+ | }; | ||
+ | |||
+ | enum MessageStatus{ClearMessage,SetMessage}; | ||
+ | |||
+ | |||
+ | #ifdef NO_HELPFUNC | ||
+ | # undef NO_HELPFUNC | ||
+ | #endif | ||
+ | #define NO_HELPFUNC ((void(*)(MessageStatus, CDialog&))(0)) | ||
+ | #ifdef NO_VALDFUNC | ||
+ | # undef NO_VALDFUNC | ||
+ | #endif | ||
+ | #define NO_VALDFUNC ((bool(*)(const char*, CDialog&))(0)) | ||
+ | |||
+ | |||
+ | #define C_MAX_LINE_CHARS (1024u) | ||
+ | #define C_INITIAL_NUM_OF_LINES (100u) | ||
+ | |||
+ | #endif | ||
+ | </syntaxhighlight></big> | ||
+ | =File Names= | ||
+ | Use the following rules to create filenames for your class. | ||
+ | *Each class MUST have its own header file and cpp file for implementation | ||
+ | *Use the class name for the name of the file but make sure it is all lowercase. | ||
+ | *:For example '''CFrame''' class should have '''cframe.h''' and '''cframe.cpp''' files for its implementation. | ||
+ | =Hierarchy= | ||
+ | <big><pre> | ||
+ | CFrame | ||
+ | | | ||
+ | |---CDialog | ||
+ | | | ||
+ | | | ||
+ | |---CField | ||
+ | | | ||
+ | |-------- CLabel | ||
+ | | | ||
+ | | | ||
+ | |-------- CButton | ||
+ | | | ||
+ | | | ||
+ | |-------- CLineEdit | ||
+ | | | | ||
+ | | |-------CValEdit | ||
+ | | | ||
+ | |-------- CText ?? maybe | ||
+ | | | ||
+ | | | ||
+ | |-------- CCheck | ||
+ | | | ||
+ | | | ||
+ | |-------- CCheckList ?? maybe | ||
+ | | | ||
+ | | | ||
+ | |-------- CMenuItem ?? maybe | ||
+ | | | ||
+ | | | ||
+ | |-------- CMenu ?? maybe | ||
+ | </pre></big> |
Revision as of 08:57, 20 July 2011
OOP344 | Weekly Schedule | Student List | Teams | Project | Student Resources
Release 0.1
Before anything, go to YourRepository/branches/fardad/bio_additions_changes and open iol.h and iol.c.
- Replace your iol.h content with mine (if you have any custom additions to your iol.h that mine does not cover it, add your custom prototypes and definitions. (note that my iol.h covers 4 platforms [compiler/operating systems]).
- Add the memory buffering logic that prevents flickering (the first 74 lines of code) to the top of your oil.c logic; (getBufChar,setBufChar, putMemch, scrbuf, curRow, curCol, bufrows, bufcols, alocScrBufMem, clrMemScr, freeScrBufMem, iol_capture, iol_restore, iol_getCurPos, iol_freeCapture)
- Replace your platform dependent logic with mine ( line 76 to 304) that are:
- iol_init
- iol_end
- iol_rows
- iol_cols
- iol_clrscr
- iol_flush
- iol_getch
- iol_movecur
- iol_putch
- iol_prnstr
- Compile the new additions with your iolmain.c, everything should work like before.
- Instead of replacing the whole logic, you could modify your functions with my additions, but since you have only two platforms covered in your logic, It may be easier to just replace your platform dependent logic with mine.
Contents
Objective
Your objective at this stage is to create series of core classes designed to interact with the user. These Core Classes then can be used in development of any interactive application.
Please note that the class definitions here are minimum requirement for the Core Classes and you are free to add any enhancements or features you find useful. However make sure that you discuss these enhancements with your professor to make sure they are feasible before implementation.
It is highly recommended to develop the classes in the order they are stated here. You must create your won tester programs fore each class (if possible); However, close to due date of each release, a tester program is provided to help you verify the functionality of your classes. Executables of the test programs are available on matrix to show you how it is supposed to run.
Start by creating mock-up classes (class declaration and definition with empty methods that only compiles and don't do anything). Each class MUST have its own header file to hold its declaration and "cpp" file to hold its implementation. To make sure you do not do circular includes follow these simple guidelines:
- Add recompilation safeguards to all your header files.
- Always use forward declaration if possible instead of including a class header-file.
- Use includes only in files in which the actual header file code is used.
- Avoid "just in case" includes.
DueDates
Adding Buffering logic to your iol logic
Duedate: Sunday Jul 24th, 23:59;
IOL General Header file (iolgh.h)
The general header file holds the common setting and definition between all the Core Classes.
#ifndef ___IOLGH_H__
#define ___IOLGH_H__
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#define C_MAX_NO_FIELDS 100
#define C_BUTTON_HIT 1
#define C_MAX_LINE_CHARS (1024u)
//#define C_REFRESH -2
#define C_FULL_FRAME -1
#define C_NO_FRAME 0
#define C_BORDER_CHARS "/-\\|/-\\|"
enum CDirection {iol_centre, iol_left, iol_right, iol_up, iol_down};
extern "C"{
#include "iol.h"
};
enum MessageStatus{ClearMessage,SetMessage};
#ifdef NO_HELPFUNC
# undef NO_HELPFUNC
#endif
#define NO_HELPFUNC ((void(*)(MessageStatus, CDialog&))(0))
#ifdef NO_VALDFUNC
# undef NO_VALDFUNC
#endif
#define NO_VALDFUNC ((bool(*)(const char*, CDialog&))(0))
#define C_MAX_LINE_CHARS (1024u)
#define C_INITIAL_NUM_OF_LINES (100u)
#endif
File Names
Use the following rules to create filenames for your class.
- Each class MUST have its own header file and cpp file for implementation
- Use the class name for the name of the file but make sure it is all lowercase.
- For example CFrame class should have cframe.h and cframe.cpp files for its implementation.
Hierarchy
CFrame | |---CDialog | | |---CField | |-------- CLabel | | |-------- CButton | | |-------- CLineEdit | | | |-------CValEdit | |-------- CText ?? maybe | | |-------- CCheck | | |-------- CCheckList ?? maybe | | |-------- CMenuItem ?? maybe | | |-------- CMenu ?? maybe