Difference between revisions of "OOP344 Assignment Two"

From CDOT Wiki
Jump to: navigation, search
(IO_Frame)
m (Mandatory Classes)
Line 32: Line 32:
 
[[ OOP344_Temporary | Team Temporary Name ]]
 
[[ OOP344_Temporary | Team Temporary Name ]]
  
 +
==General Definition Header file==
 +
create a file called: '''io_def.h'''. This file will any nessecary definitions or inclusions
 
==Mandatory Classes==
 
==Mandatory Classes==
 
As the first part of your project this semester, you are to create few classes to encapsulate [[OOP344 Assignment One|Console Input Output Library]]
 
As the first part of your project this semester, you are to create few classes to encapsulate [[OOP344 Assignment One|Console Input Output Library]]

Revision as of 10:54, 19 October 2009

OOP344 - OOP344 Student List - OOP344 Teams - OOP344 Assignment One - OOP344 Assignment Two
Under construction...


File Names

Save your work in separate files for each class. Name the files to the same name as the classes. Each class should have a header file and a code file.

For example for the class IOField, create iofield.h and iofield.cpp. The header file should hold the class declaration and any other possible declaration related to the class. the "cpp" file should hold the definition (implementation) of the class and its methods and possible functions.

Create a Make file to build your project with respect to dependencies of classes.

How to reuse your C code in C++ programs

Include your already existing C code into your C++ code as follows:

extern "C"{
#include "ciol.h"
};

This tells to C++ compiler, the included header file contains C functions and should be complied and called as such. Remember, you do not need and should not rename your ciol.c to ciol.cpp, since the compiler is already aware of the C functions in ciol.c.

Team Project Wiki Pages

Add a link to your Team project Wiki pages here:

BITE

Team ++ website

Team #3

Team Temporary Name

General Definition Header file

create a file called: io_def.h. This file will any nessecary definitions or inclusions

Mandatory Classes

As the first part of your project this semester, you are to create few classes to encapsulate Console Input Output Library

IO_Field

IO_Field is the base class for all different types of Fields on a Form.

class IO_Form;  // forward declaration
class IO_Field{
protected:
  void* _data;
  int _row;
  int _col;
public:
  IO_Field(int row, int col);
  void* Data();
  virtual void Display() = 0;
  virtual int Edit(IO_Form* Owner=NULL)= 0;
  virtual bool Editable() = 0;
  virtual void Set(const void *) = 0;
  virtual ~IO_Field();
};

IO_Field(int row, int col);

This constructor set the corresponding attributes to the values of incoming arguments and sets the data attribute to NULL.

void* Data();

Returns the value of the data attribute.

virtual ~IOField();

An empty destructor (the body of the method is blank)

virtual void Display() = 0;
virtual int Edit(Screen *Owner=NULL)= 0;
virtual bool Editable() = 0;
virtual void Set(const void *) = 0;


These are pure virtual methods enforcing the creation of the identical methods in the derived classes. This make the IO_Field class an abstract class. Note: The purpose of passing a IO_Form pointer to the Edit method, is to make the future Edit methods capable of sending a message (errors and help messages)to the Screen they are being Edited on.

IO_Frame

IO_Frame class, encapsulates a frame. It Draws a frame at left top cornder of col and row with specified width and height.

A Frame can be instatiated as follows:

IO_Frame(int row, int col, int width, int height, const char* frameChars = (const char*)0);

the frameChars are characters used to draw the frame, charachters in order are:

  1. left side
  2. left top corner
  3. top side
  4. top right corner
  5. right side
  6. right buttom corner
  7. buttom side
  8. buttom left conrner

So to draw this:

  /--------\
  |        |
  |        |  
  |        |
  \--------/

frame chars should be:

"|/-\|/-\"

If however, the frameChars argument is missing (it is NULL) then a defaut, defined value in "io_def.h"; _FRAMW_CHARS should be used.

void Display(void);

Display(), displays the frame with the specified coordinates and size in its constructor

IO_Form

IO_Label

IO_Edit

IO_CheckList

IO_Radio

IO_Menu

IO_MenuBar

IO_TextEdit

The Text Editor