first commit
This commit is contained in:
commit
1b2bf174e8
164 files changed
+35594
No files matched your search
+106
@@ -0,0 +1,106 @@
|
|||||||
|
//##################################################################
|
||||||
|
// LAB 1
|
||||||
|
// ADVANCED PROGRAMMING IN C++
|
||||||
|
// MATRIX/ARRAY WITH DEEP COPY
|
||||||
|
//==================================================================
|
||||||
|
// array.h
|
||||||
|
// CLASS IMPLEMENTATION AND DEFINITION FOR
|
||||||
|
// THE ARRAY
|
||||||
|
// Christian Ohlsson
|
||||||
|
// Daniel Alfredsson
|
||||||
|
// Karlstad 990907
|
||||||
|
//==================================================================
|
||||||
|
|
||||||
|
#include <iostream.h>
|
||||||
|
class Array {
|
||||||
|
private:
|
||||||
|
int size; //The size of the Array
|
||||||
|
int *buffer; //Pointer to an int-buffer
|
||||||
|
public:
|
||||||
|
~Array();
|
||||||
|
Array(const int s=0);
|
||||||
|
Array(const Array &src);
|
||||||
|
void operator = (const Array &src);
|
||||||
|
Array Array::operator +(const Array &src);
|
||||||
|
int &operator [] (int index) const;
|
||||||
|
int getSize() const;
|
||||||
|
};
|
||||||
|
//################################################################
|
||||||
|
// Constructor
|
||||||
|
// Creates a new Array
|
||||||
|
//================================================================
|
||||||
|
Array::Array(const int s=0) {
|
||||||
|
buffer = new int[s];
|
||||||
|
size= s;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Constructor
|
||||||
|
// Copys an array
|
||||||
|
//================================================================
|
||||||
|
Array::Array(const Array &src) {
|
||||||
|
size = src.size;
|
||||||
|
buffer = new int[size];
|
||||||
|
for(int i=0 ; i<size ; i++)
|
||||||
|
buffer[i] = src.buffer[i];
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Allows to assign a Array to another
|
||||||
|
//================================================================
|
||||||
|
void Array::operator = (const Array &src) {
|
||||||
|
delete [] buffer;
|
||||||
|
size = src.size;
|
||||||
|
buffer = new int[size];
|
||||||
|
for(int i=0 ; i<size ; i++)
|
||||||
|
buffer[i] = src.buffer[i];
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Returns a element in the Array
|
||||||
|
//================================================================
|
||||||
|
int &Array::operator [] (int index) const{
|
||||||
|
return buffer[index];
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Allows to add a Array to another
|
||||||
|
//================================================================
|
||||||
|
Array Array::operator + (const Array &src) {
|
||||||
|
Array tmp(size);
|
||||||
|
for(int i=0 ; i<size ; i++)
|
||||||
|
tmp.buffer[i] = buffer[i] + src.buffer[i];
|
||||||
|
return (tmp);
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Destructor
|
||||||
|
// Deallocates memory, used by the Array
|
||||||
|
//================================================================
|
||||||
|
Array::~Array() {
|
||||||
|
delete [] buffer;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Allows input in the Array, using STDIN
|
||||||
|
//================================================================
|
||||||
|
istream &operator >> (istream &is, Array &v) {
|
||||||
|
for(int l=0 ; l<v.getSize() ; l++)
|
||||||
|
is >> v[l];
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Prints out an Array, using STDOUT
|
||||||
|
//================================================================
|
||||||
|
ostream &operator << (ostream &os, const Array &v) {
|
||||||
|
for(int k=0 ; k<v.getSize() ; k++)
|
||||||
|
os << v[k];
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Function getSize()
|
||||||
|
// Returns the size of the Array
|
||||||
|
//================================================================
|
||||||
|
int Array::getSize() const{
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
Binary file not shown.
@@ -0,0 +1,16 @@
|
|||||||
|
//matrix.cpp
|
||||||
|
#include "matrix.h"
|
||||||
|
int main() {
|
||||||
|
Array a (2);
|
||||||
|
Matrix b (2,2);
|
||||||
|
cout << "input Array: " << endl;
|
||||||
|
cin>>a;
|
||||||
|
cout << "input Matrix: " << endl;
|
||||||
|
cin >>b;
|
||||||
|
//b[2] = a;
|
||||||
|
b[1] = a + b[1];
|
||||||
|
Matrix c(b);
|
||||||
|
b[1][1] = a[1];
|
||||||
|
cout << "c:\n" <<c << "a:\n"<< a << "\nb:\n" << b;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+111
@@ -0,0 +1,111 @@
|
|||||||
|
//##################################################################
|
||||||
|
// LAB 1
|
||||||
|
// ADVANCED PROGRAMMING IN C++
|
||||||
|
// MATRIX/ARRAY WITH DEEP COPY
|
||||||
|
//==================================================================
|
||||||
|
// matrix.h
|
||||||
|
// CLASS IMPLEMENTATION AND DEFINITION FOR
|
||||||
|
// THE MATRIX
|
||||||
|
// Christian Ohlsson
|
||||||
|
// Daniel Alfredsson
|
||||||
|
// Karlstad 990907
|
||||||
|
//==================================================================
|
||||||
|
|
||||||
|
#include "array.h"
|
||||||
|
class Matrix {
|
||||||
|
private:
|
||||||
|
int cols, rows; //# of cols and rows in the matrix
|
||||||
|
Array *myMatrix; //Array-pointer to our matrix
|
||||||
|
public:
|
||||||
|
void Matrix::operator = (const Matrix &src);
|
||||||
|
int getCols() const { return cols;};
|
||||||
|
int getRows() const { return rows;};
|
||||||
|
Array &Matrix::operator [] (int index) const;
|
||||||
|
Matrix(const Matrix &src);
|
||||||
|
Matrix(int cols, int rows);
|
||||||
|
~Matrix();
|
||||||
|
|
||||||
|
};
|
||||||
|
//################################################################
|
||||||
|
// Constructor
|
||||||
|
// Creates a new Matrix with 'c' columns and 'r' rows
|
||||||
|
//================================================================
|
||||||
|
Matrix::Matrix(int c, int r) {
|
||||||
|
myMatrix = new Array[r];
|
||||||
|
for(int i=0; i < c; i++)
|
||||||
|
myMatrix[i] = Array(c);
|
||||||
|
cols = c;
|
||||||
|
rows = r;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Constructor
|
||||||
|
// Creates a new copy of a Matrix
|
||||||
|
//================================================================
|
||||||
|
Matrix::Matrix(const Matrix &src) {
|
||||||
|
cols = src.cols;
|
||||||
|
rows = src.rows;
|
||||||
|
int i,j;
|
||||||
|
myMatrix = new Array[rows];
|
||||||
|
for(i=0; i < cols; i++)
|
||||||
|
myMatrix[i] = Array(cols);
|
||||||
|
for(i=0 ; i < cols ; i++)
|
||||||
|
for(j=0 ; j < rows ; j++)
|
||||||
|
myMatrix[i][j] = src.myMatrix[i][j];
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Destructor
|
||||||
|
// De-allocates memory for a Matrix
|
||||||
|
//================================================================
|
||||||
|
Matrix::~Matrix() {
|
||||||
|
delete [] myMatrix;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Sets one Matrix equal to another
|
||||||
|
//================================================================
|
||||||
|
void Matrix::operator = (const Matrix &src) {
|
||||||
|
delete [] myMatrix;
|
||||||
|
cols = src.cols;
|
||||||
|
rows = src.rows;
|
||||||
|
myMatrix = new Array[rows];
|
||||||
|
for(int i=0 ; i<cols ; i++)
|
||||||
|
for(int j=0 ; j<rows ; j++)
|
||||||
|
myMatrix[i][j] = src.myMatrix[i][j];
|
||||||
|
}//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Reyurns a row in a Matrix, and checks for bad indexes.
|
||||||
|
//================================================================
|
||||||
|
Array &Matrix::operator [] (int index) const {
|
||||||
|
if(index>=rows || index<0) {
|
||||||
|
cout <<"\nIndex out of bounds! Quitting...\n";
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return myMatrix[index];
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Allow inserts in a Matrix, using STDIN
|
||||||
|
//================================================================
|
||||||
|
istream &operator >> (istream &is, Matrix &v) {
|
||||||
|
int i,j;
|
||||||
|
for(i=0 ; i<v.getCols() ; i++)
|
||||||
|
for (j=0 ; j<v.getRows() ; j++)
|
||||||
|
is >> v[i][j];
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Prints the Matrix on the screen, using STDUOT
|
||||||
|
//================================================================
|
||||||
|
ostream &operator << (ostream &os, const Matrix &v) {
|
||||||
|
int i,j;
|
||||||
|
for(i=0 ; i < v.getCols() ; i++)
|
||||||
|
for(j=0 ; j < v.getRows() ; j++)
|
||||||
|
os << i << "," << j<< " = " << v[i][j] << "\n";
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
Avancerad programmering i C++␍
|
||||||
|
==========================================␍
|
||||||
|
␍
|
||||||
|
Denna lab skapades under Linux med ␍
|
||||||
|
kommandot:␍
|
||||||
|
g++ -Wall -o lab_one *.cpp␍
|
||||||
|
I katalogen Visual finns programmet ␍
|
||||||
|
även skapat i MS Visual C++ 6.0␍
|
||||||
|
␍
|
||||||
|
==========================================␍
|
||||||
|
Christian Ohlsson, Karlstadds Universitet␍
|
||||||
|
di7chro@cse.kau.se␍
|
||||||
+130
@@ -0,0 +1,130 @@
|
|||||||
|
//##################################################################
|
||||||
|
// LAB 2
|
||||||
|
// ADVANCED PROGRAMMING IN C++
|
||||||
|
// MATRIX/ARRAY WITH SHALLOW COPY
|
||||||
|
//==================================================================
|
||||||
|
// array.h
|
||||||
|
// CLASS IMPLEMENTATION AND DEFINITION FOR
|
||||||
|
// THE ARRAY
|
||||||
|
// Christian Ohlsson
|
||||||
|
// Daniel Alfredsson
|
||||||
|
// Karlstad 990907
|
||||||
|
//==================================================================
|
||||||
|
|
||||||
|
#include <iostream.h>
|
||||||
|
#include "contract.h"
|
||||||
|
class Array {
|
||||||
|
private:
|
||||||
|
Contract *myContract;
|
||||||
|
public:
|
||||||
|
~Array();
|
||||||
|
Array(const int s=0);
|
||||||
|
Array(const Array &src);
|
||||||
|
const Array operator + (const Array &src);
|
||||||
|
void operator = (const Array &src);
|
||||||
|
const int &operator [] (int index) const;
|
||||||
|
int &operator [] (int index);
|
||||||
|
int getSize() const;
|
||||||
|
};
|
||||||
|
//################################################################
|
||||||
|
// Constructor
|
||||||
|
// Creates a new Array
|
||||||
|
//================================================================
|
||||||
|
Array::Array(const int s) {
|
||||||
|
myContract = new Contract();
|
||||||
|
myContract->size = s;
|
||||||
|
myContract->buffer = new int[s];
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Constructor
|
||||||
|
// Copys an array
|
||||||
|
//================================================================
|
||||||
|
Array::Array(const Array &src) {
|
||||||
|
src.myContract->owners++;
|
||||||
|
myContract = src.myContract;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Allows to assign a Array to another
|
||||||
|
//================================================================
|
||||||
|
void Array::operator = (const Array &src) {
|
||||||
|
if(myContract->owners>1) {
|
||||||
|
myContract->owners--;
|
||||||
|
myContract = new Contract;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
delete [] myContract->buffer;
|
||||||
|
myContract->size = src.myContract->size;
|
||||||
|
myContract->buffer = new int[src.myContract->size];
|
||||||
|
for(int i=0 ; i<src.myContract->size ; i++)
|
||||||
|
myContract->buffer[i] = src.myContract->buffer[i];
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Returns a element in the Array
|
||||||
|
//================================================================
|
||||||
|
const int &Array::operator [] (int index) const{
|
||||||
|
return (myContract->buffer[index]);
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Returns a element in the Array
|
||||||
|
//================================================================
|
||||||
|
int &Array::operator [] (int index) {
|
||||||
|
if(myContract->owners>1) {
|
||||||
|
myContract->owners--;
|
||||||
|
Contract *tmp = new Contract;
|
||||||
|
tmp->size = myContract->size;
|
||||||
|
tmp->buffer = new int[tmp->size];
|
||||||
|
for(int i=0 ; i<tmp->size ; i++)
|
||||||
|
tmp->buffer[i] = myContract->buffer[i];
|
||||||
|
}
|
||||||
|
return (myContract->buffer[index]);
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Allows to add a Array to another
|
||||||
|
//================================================================
|
||||||
|
const Array Array::operator + (const Array &src) {
|
||||||
|
Array tmp(myContract->size);
|
||||||
|
for(int i=0 ; i<myContract->size ; i++)
|
||||||
|
tmp.myContract->buffer[i] = myContract->buffer[i] + src.myContract->buffer[i];
|
||||||
|
return (tmp);
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Destructor
|
||||||
|
// Deallocates memory, used by the Array
|
||||||
|
//================================================================
|
||||||
|
Array::~Array() {
|
||||||
|
myContract->owners--;
|
||||||
|
if(myContract->owners == 0) {
|
||||||
|
delete [] myContract->buffer;
|
||||||
|
delete myContract;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Allows input in the Array, using STDIN
|
||||||
|
//================================================================
|
||||||
|
istream &operator >> (istream &is, Array &a) {
|
||||||
|
for(int l=0 ; l<a.getSize() ; l++)
|
||||||
|
is >> a[l];
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Prints out an Array, using STDOUT
|
||||||
|
//================================================================
|
||||||
|
ostream &operator << (ostream &os, const Array &a) {
|
||||||
|
for(int k=0 ; k<a.getSize() ; k++)
|
||||||
|
os << a[k];
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Function getSize()
|
||||||
|
// Returns the size of the Array
|
||||||
|
//================================================================
|
||||||
|
int Array::getSize() const{
|
||||||
|
return myContract->size;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
//##################################################################␍
|
||||||
|
// LAB 2
|
||||||
|
// ADVANCED PROGRAMMING IN C++
|
||||||
|
// MATRIX/ARRAY WITH SHALLOW COPY
|
||||||
|
//==================================================================
|
||||||
|
// contract.h
|
||||||
|
// CLASS IMPLEMENTATION AND DEFINITION FOR
|
||||||
|
// THE CONTRACT
|
||||||
|
// Christian Ohlsson
|
||||||
|
// Daniel Alfredsson
|
||||||
|
// Karlstad 990907
|
||||||
|
//==================================================================
|
||||||
|
class Contract {␍
|
||||||
|
public:␍
|
||||||
|
int *buffer;␍
|
||||||
|
int size;␍
|
||||||
|
int owners;␍
|
||||||
|
Contract() {␍
|
||||||
|
size=0;␍
|
||||||
|
owners=1;␍
|
||||||
|
buffer=NULL;␍
|
||||||
|
};␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
Binary file not shown.
@@ -0,0 +1,16 @@
|
|||||||
|
//matrix.cpp
|
||||||
|
#include "matrix.h"
|
||||||
|
int main() {
|
||||||
|
Array a (2);
|
||||||
|
Matrix b (2,2);
|
||||||
|
cout << "input Array: " << endl;
|
||||||
|
cin>>a;
|
||||||
|
cout << "input Matrix: " << endl;
|
||||||
|
cin >>b;
|
||||||
|
//b[2] = a;
|
||||||
|
b[1] = a + b[1];
|
||||||
|
Matrix c(b);
|
||||||
|
b[1][1] = a[1];
|
||||||
|
cout << "c:\n" <<c << "a:\n"<< a << "\nb:\n" << b;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+110
@@ -0,0 +1,110 @@
|
|||||||
|
//##################################################################
|
||||||
|
// LAB 1
|
||||||
|
// ADVANCED PROGRAMMING IN C++
|
||||||
|
// MATRIX/ARRAY WITH DEEP COPY
|
||||||
|
//==================================================================
|
||||||
|
// matrix.h
|
||||||
|
// CLASS IMPLEMENTATION AND DEFINITION FOR
|
||||||
|
// THE MATRIX
|
||||||
|
// Christian Ohlsson
|
||||||
|
// Daniel Alfredsson
|
||||||
|
// Karlstad 990907
|
||||||
|
//==================================================================
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "array.h"
|
||||||
|
class Matrix {
|
||||||
|
private:
|
||||||
|
int cols, rows; //# of cols and rows in the matrix
|
||||||
|
Array *myMatrix; //Array-pointer to our matrix
|
||||||
|
public:
|
||||||
|
void Matrix::operator = (const Matrix &src);
|
||||||
|
int getCols() const { return cols;};
|
||||||
|
int getRows() const { return rows;};
|
||||||
|
Array &Matrix::operator [] (int index) const;
|
||||||
|
Matrix(const Matrix &src);
|
||||||
|
Matrix(int cols, int rows);
|
||||||
|
~Matrix();
|
||||||
|
|
||||||
|
};
|
||||||
|
//################################################################
|
||||||
|
// Constructor
|
||||||
|
// Creates a new Matrix with 'c' columns and 'r' rows
|
||||||
|
//================================================================
|
||||||
|
Matrix::Matrix(int c, int r) {
|
||||||
|
myMatrix = new Array[r];
|
||||||
|
for(int i=0; i < c; i++)
|
||||||
|
myMatrix[i] = Array(c);
|
||||||
|
cols = c;
|
||||||
|
rows = r;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Constructor
|
||||||
|
// Creates a new copy of a Matrix
|
||||||
|
//================================================================
|
||||||
|
Matrix::Matrix(const Matrix &src) {
|
||||||
|
cols = src.cols;
|
||||||
|
rows = src.rows;
|
||||||
|
int i,j;
|
||||||
|
myMatrix = new Array[rows];
|
||||||
|
for(i=0; i < cols; i++)
|
||||||
|
myMatrix[i] = Array(cols);
|
||||||
|
for(i=0 ; i < cols ; i++)
|
||||||
|
for(j=0 ; j < rows ; j++)
|
||||||
|
myMatrix[i][j] = src.myMatrix[i][j];
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Destructor
|
||||||
|
// De-allocates memory for a Matrix
|
||||||
|
//================================================================
|
||||||
|
Matrix::~Matrix() {
|
||||||
|
delete [] myMatrix;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Sets one Matrix equal to another
|
||||||
|
//================================================================
|
||||||
|
void Matrix::operator = (const Matrix &src) {
|
||||||
|
delete [] myMatrix;
|
||||||
|
cols = src.cols;
|
||||||
|
rows = src.rows;
|
||||||
|
myMatrix = new Array[rows];
|
||||||
|
for(int i=0 ; i<cols ; i++)
|
||||||
|
for(int j=0 ; j<rows ; j++)
|
||||||
|
myMatrix[i][j] = src.myMatrix[i][j];
|
||||||
|
}//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Reyurns a row in a Matrix, and checks for bad indexes.
|
||||||
|
//================================================================
|
||||||
|
Array &Matrix::operator [] (int index) const {
|
||||||
|
if(index>=rows || index<0) {
|
||||||
|
cout <<"\nIndex out of bounds! Quitting...\n";
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
return myMatrix[index];
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Allow inserts in a Matrix, using STDIN
|
||||||
|
//================================================================
|
||||||
|
istream &operator >> (istream &is, Matrix &v) {
|
||||||
|
int i,j;
|
||||||
|
for(i=0 ; i<v.getCols() ; i++)
|
||||||
|
for (j=0 ; j<v.getRows() ; j++)
|
||||||
|
is >> v[i][j];
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
//################################################################
|
||||||
|
// Operator overload
|
||||||
|
// Prints the Matrix on the screen, using STDUOT
|
||||||
|
//================================================================
|
||||||
|
ostream &operator << (ostream &os, const Matrix &v) {
|
||||||
|
int i,j;
|
||||||
|
for(i=0 ; i < v.getCols() ; i++)
|
||||||
|
for(j=0 ; j < v.getRows() ; j++)
|
||||||
|
os << i << "," << j<< " = " << v[i][j] << "\n";
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Avancerad programmering i C++␍
|
||||||
|
==========================================␍
|
||||||
|
␍
|
||||||
|
Denna lab skapades under Linux med ␍
|
||||||
|
kommandot:␍
|
||||||
|
g++ -Wall -o lab_two *.cpp␍
|
||||||
|
␍
|
||||||
|
I katalogen Visual finns programmet ␍
|
||||||
|
även skapat i MS Visual C++ 6.0␍
|
||||||
|
␍
|
||||||
|
==========================================␍
|
||||||
|
Christian Ohlsson, Karlstadds Universitet␍
|
||||||
|
di7chro@cse.kau.se␍
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
//atm.h␍
|
||||||
|
#ifndef __ATM_H__␍
|
||||||
|
#define __ATM_H__␍
|
||||||
|
#include <stdlib.h>␍
|
||||||
|
#include "cashcard.h"␍
|
||||||
|
class ATM {␍
|
||||||
|
public:␍
|
||||||
|
double withDraw(Cashcard &myCard, double money) {␍
|
||||||
|
if(myCard.money < money)␍
|
||||||
|
return NULL;␍
|
||||||
|
myCard.money = (myCard.money - money);␍
|
||||||
|
return money;␍
|
||||||
|
}␍
|
||||||
|
};␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
//bank.cpp␍
|
||||||
|
#ifndef __BANK_CPP__␍
|
||||||
|
#define __BANK_CPP__␍
|
||||||
|
#include "person.h"␍
|
||||||
|
#include "bank.h"␍
|
||||||
|
Cashcard* Bank::makeCashcard(Passport &P) {␍
|
||||||
|
if(&P) {␍
|
||||||
|
Name &N = P.getPassportName();␍
|
||||||
|
Cashcard *tmp = new Cashcard(N);␍
|
||||||
|
return tmp;␍
|
||||||
|
}␍
|
||||||
|
return NULL;␍
|
||||||
|
};␍
|
||||||
|
#endif
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
//bank.h␍
|
||||||
|
#ifndef __BANK_H__␍
|
||||||
|
#define __BANK_H__␍
|
||||||
|
#include "passport.h"␍
|
||||||
|
#include "person.h"␍
|
||||||
|
class Bank {␍
|
||||||
|
public:␍
|
||||||
|
Bank(){}␍
|
||||||
|
~Bank(){}␍
|
||||||
|
Cashcard *makeCashcard(Passport &P);␍
|
||||||
|
int insertMoney(Cashcard &myCard, double money) {␍
|
||||||
|
return(myCard.money += money);␍
|
||||||
|
}␍
|
||||||
|
};␍
|
||||||
|
#endif␍
|
||||||
|
␍
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
//cashcard.h␍
|
||||||
|
#ifndef __CASHCARD_H__␍
|
||||||
|
#define __CASHCARD_H__␍
|
||||||
|
#include "name.h"␍
|
||||||
|
class ATM;␍
|
||||||
|
class Bank;␍
|
||||||
|
class Cashcard {␍
|
||||||
|
friend ATM;␍
|
||||||
|
friend Bank;␍
|
||||||
|
private:␍
|
||||||
|
Name myName;␍
|
||||||
|
double money;␍
|
||||||
|
public:␍
|
||||||
|
Cashcard(Name &N, double M=0):myName(N){money=M;}␍
|
||||||
|
~Cashcard(){}␍
|
||||||
|
void print() { myName.print(); }␍
|
||||||
|
};␍
|
||||||
|
#endif␍
|
||||||
|
␍
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
//main.cpp␍
|
||||||
|
#include "person.h"␍
|
||||||
|
␍
|
||||||
|
void main() {␍
|
||||||
|
Person myPerson(Name("Kalle !"), 20);␍
|
||||||
|
Police myStation;␍
|
||||||
|
Bank myBank;␍
|
||||||
|
ATM myATM;␍
|
||||||
|
if(myPerson.getPassport(myStation)) //Person gets a passport␍
|
||||||
|
myPerson.print();␍
|
||||||
|
if(myPerson.getCashcard(myBank)) //Person gets a cashcard␍
|
||||||
|
myPerson.print();␍
|
||||||
|
if (myPerson.insertMoney(myBank, 200)) //Person insert 200:-␍
|
||||||
|
myPerson.print();␍
|
||||||
|
if(myPerson.getMoney(myATM, 200)) //Person withdraws 200:-␍
|
||||||
|
myPerson.print();␍
|
||||||
|
}␍
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
//name.cpp␍
|
||||||
|
#ifndef __NAME_CPP__␍
|
||||||
|
#define __NAME_CPP__␍
|
||||||
|
#include <iostream.h>␍
|
||||||
|
#include <string.h>␍
|
||||||
|
#include <stdlib.h>␍
|
||||||
|
#include "name.h"␍
|
||||||
|
//##################################################␍
|
||||||
|
// Name␍
|
||||||
|
// Puts name into a buffer␍
|
||||||
|
//==================================================␍
|
||||||
|
Name::Name(char *txt) {␍
|
||||||
|
buff = new char[strlen(txt) + 1];␍
|
||||||
|
strcpy(buff, txt);␍
|
||||||
|
}␍
|
||||||
|
//##################################################␍
|
||||||
|
// Destructor␍
|
||||||
|
// Delets buffer␍
|
||||||
|
//==================================================␍
|
||||||
|
Name::~Name() {␍
|
||||||
|
delete [] buff;␍
|
||||||
|
}␍
|
||||||
|
//##################################################␍
|
||||||
|
// Operator overload␍
|
||||||
|
// Deletes buffer and makes a new one␍
|
||||||
|
// and copies the data␍
|
||||||
|
//==================================================␍
|
||||||
|
void Name::operator = (const Name &src) {␍
|
||||||
|
delete [] buff;␍
|
||||||
|
buff = new char[strlen(src.buff) + 1];␍
|
||||||
|
strcpy(buff, src.buff);␍
|
||||||
|
}␍
|
||||||
|
//##################################################␍
|
||||||
|
// Constructor␍
|
||||||
|
// Creates a new name␍
|
||||||
|
//==================================================␍
|
||||||
|
Name::Name(const Name &src) {␍
|
||||||
|
buff = new char[strlen(src.buff) + 1];␍
|
||||||
|
strcpy(buff, src.buff);␍
|
||||||
|
}␍
|
||||||
|
//##################################################␍
|
||||||
|
// Print␍
|
||||||
|
// Prints out a name␍
|
||||||
|
//==================================================␍
|
||||||
|
void Name::print() {␍
|
||||||
|
cout << buff;␍
|
||||||
|
}␍
|
||||||
|
#endif␍
|
||||||
|
␍
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
//name.h␍
|
||||||
|
#ifndef __NAME_H__␍
|
||||||
|
#define __NAME_H__␍
|
||||||
|
class Name {␍
|
||||||
|
private:␍
|
||||||
|
char* buff;␍
|
||||||
|
public:␍
|
||||||
|
Name(char* txt);␍
|
||||||
|
~Name();␍
|
||||||
|
void operator = (const Name &src);␍
|
||||||
|
Name(const Name &src);␍
|
||||||
|
void print();␍
|
||||||
|
};␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
//passport.h␍
|
||||||
|
#ifndef __PASSPORT_H__␍
|
||||||
|
#define __PASSPORT_H__␍
|
||||||
|
#include "name.h"␍
|
||||||
|
class Passport {␍
|
||||||
|
private:␍
|
||||||
|
Name myName; //The name in the passport␍
|
||||||
|
public:␍
|
||||||
|
Passport(Name &N):myName(N){}␍
|
||||||
|
~Passport(){}␍
|
||||||
|
void print() { myName.print(); }␍
|
||||||
|
Name getPassportName() {return myName;}␍
|
||||||
|
};␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
//person.h␍
|
||||||
|
#ifndef __PERSON_H__␍
|
||||||
|
#define __PERSON_H__␍
|
||||||
|
#include "police.h"␍
|
||||||
|
#include "atm.h"␍
|
||||||
|
␍
|
||||||
|
#include "cashcard.h"␍
|
||||||
|
#include "bank.h"␍
|
||||||
|
#include <stdlib.h>␍
|
||||||
|
␍
|
||||||
|
class Person {␍
|
||||||
|
private:␍
|
||||||
|
Name myName;␍
|
||||||
|
int myAge;␍
|
||||||
|
double cash;␍
|
||||||
|
Passport *myPass;␍
|
||||||
|
Cashcard *myCard;␍
|
||||||
|
public:␍
|
||||||
|
Person(Name &N, int &age):myName(N) { //Constructor␍
|
||||||
|
myPass=NULL;␍
|
||||||
|
myCard=NULL;␍
|
||||||
|
cash=0;␍
|
||||||
|
myAge=age;␍
|
||||||
|
}␍
|
||||||
|
~Person(){}␍
|
||||||
|
const Name &getName() { return myName; }␍
|
||||||
|
int getPassport(Police &myStation) {␍
|
||||||
|
if(myPass)␍
|
||||||
|
return NULL;␍
|
||||||
|
myPass = myStation.makePassport(*this);␍
|
||||||
|
};␍
|
||||||
|
int getCashcard(Bank &myBank) {␍
|
||||||
|
if(myCard)␍
|
||||||
|
return NULL;␍
|
||||||
|
myCard = myBank.makeCashcard(*myPass);␍
|
||||||
|
};␍
|
||||||
|
double getMoney(ATM &myATM, double &money) {␍
|
||||||
|
if(!myCard)␍
|
||||||
|
return NULL;␍
|
||||||
|
cash = myATM.withDraw(*myCard, money);␍
|
||||||
|
return cash;␍
|
||||||
|
};␍
|
||||||
|
int insertMoney(Bank &myBank, double &money) {␍
|
||||||
|
if(!myCard)␍
|
||||||
|
return NULL;␍
|
||||||
|
return(myBank.insertMoney(*myCard, money));␍
|
||||||
|
}␍
|
||||||
|
void print() {␍
|
||||||
|
myName.print();␍
|
||||||
|
if(myPass)␍
|
||||||
|
myPass->print();␍
|
||||||
|
};␍
|
||||||
|
};␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
//police.cpp␍
|
||||||
|
#ifndef __POLICE_CPP__␍
|
||||||
|
#define __POLICE_CPP__␍
|
||||||
|
#include "person.h"␍
|
||||||
|
#include "police.h"␍
|
||||||
|
Passport* Police::makePassport(Person &P) {␍
|
||||||
|
Name &N = P.getName();␍
|
||||||
|
Passport *tmp = new Passport(N);␍
|
||||||
|
return tmp;␍
|
||||||
|
};␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
//police.h␍
|
||||||
|
#ifndef __POLICE_H__␍
|
||||||
|
#define __POLICE_H__␍
|
||||||
|
#include "passport.h"␍
|
||||||
|
#include "person.h"␍
|
||||||
|
class Person;␍
|
||||||
|
class Police {␍
|
||||||
|
public:␍
|
||||||
|
Police(){}␍
|
||||||
|
~Police(){}␍
|
||||||
|
Passport *makePassport(Person &P);␍
|
||||||
|
};␍
|
||||||
|
#endif␍
|
||||||
|
␍
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Avancerad programmering i C++␍
|
||||||
|
==========================================␍
|
||||||
|
␍
|
||||||
|
Denna lab skapades med Borland C++ 5.0 ␍
|
||||||
|
Lägg alla .cpp i projektet.␍
|
||||||
|
Kompilera för EasyWin.␍
|
||||||
|
␍
|
||||||
|
I katalogen Visual finns programmet ␍
|
||||||
|
även skapat i MS Visual C++ 6.0␍
|
||||||
|
␍
|
||||||
|
==========================================␍
|
||||||
|
Christian Ohlsson, Karlstadds Universitet␍
|
||||||
|
di7chro@cse.kau.se␍
|
||||||
+7079
File diff suppressed because it is too large.
Load diff
+106
@@ -0,0 +1,106 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Circle; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Circle.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Circle␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Circle.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class Circle ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Circle::Circle()␍
|
||||||
|
//## begin Circle::Circle%.hasinit preserve=no␍
|
||||||
|
//## end Circle::Circle%.hasinit␍
|
||||||
|
//## begin Circle::Circle%.initialization preserve=yes␍
|
||||||
|
//## end Circle::Circle%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle::Circle%.body preserve=yes␍
|
||||||
|
//## end Circle::Circle%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
Circle::Circle (int x, int y, int r, Color color)␍
|
||||||
|
//## begin Circle::Circle%939623931.hasinit preserve=no␍
|
||||||
|
//## end Circle::Circle%939623931.hasinit␍
|
||||||
|
//## begin Circle::Circle%939623931.initialization preserve=yes␍
|
||||||
|
//## end Circle::Circle%939623931.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle::Circle%939623931.body preserve=yes␍
|
||||||
|
setColor(color);␍
|
||||||
|
center.setx(x);␍
|
||||||
|
center.sety(y);␍
|
||||||
|
radius=r;␍
|
||||||
|
//## end Circle::Circle%939623931.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Circle::~Circle()␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle::~Circle%.body preserve=yes␍
|
||||||
|
//## end Circle::~Circle%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
void Circle::draw (Graphics &g)␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle::draw%937398670.body preserve=yes␍
|
||||||
|
g.drawCircle(center, radius, getColor());␍
|
||||||
|
//## end Circle::draw%937398670.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Circle::erase (Graphics &g)␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle::erase%937398671.body preserve=yes␍
|
||||||
|
setColor(g.getBGColor());␍
|
||||||
|
draw(g);␍
|
||||||
|
//## end Circle::erase%937398671.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
Figure * Circle::clone ()␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle::clone%937398683.body preserve=yes␍
|
||||||
|
return new Circle(*this);␍
|
||||||
|
//## end Circle::clone%937398683.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin Circle.declarations preserve=yes␍
|
||||||
|
//## end Circle.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Detached code regions:␍
|
||||||
|
// WARNING: this code will be lost if code is regenerated.␍
|
||||||
|
#if 0␍
|
||||||
|
//## begin Circle::getColor%939797853.body preserve=no␍
|
||||||
|
return color;␍
|
||||||
|
//## end Circle::getColor%939797853.body␍
|
||||||
|
␍
|
||||||
|
//## begin Circle::setColor%939797854.body preserve=no␍
|
||||||
|
color=src;␍
|
||||||
|
␍
|
||||||
|
//## end Circle::setColor%939797854.body␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
+108
@@ -0,0 +1,108 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Circle; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Circle.h␍
|
||||||
|
␍
|
||||||
|
#ifndef Circle_h␍
|
||||||
|
#define Circle_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Point␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Point.h"␍
|
||||||
|
// Figure␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Figure.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: Circle␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
class Circle : public Figure //## Inherits: <unnamed>␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle.initialDeclarations preserve=yes␍
|
||||||
|
//## end Circle.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
Circle();␍
|
||||||
|
␍
|
||||||
|
//## Constructors (specified)␍
|
||||||
|
//## Operation: Circle%939623931␍
|
||||||
|
Circle (int x, int y, int r, Color color);␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~Circle();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: draw%937398670␍
|
||||||
|
void draw (Graphics &g);␍
|
||||||
|
␍
|
||||||
|
//## Operation: erase%937398671␍
|
||||||
|
void erase (Graphics &g);␍
|
||||||
|
␍
|
||||||
|
//## Operation: clone%937398683␍
|
||||||
|
Figure * clone ();␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin Circle.public preserve=yes␍
|
||||||
|
//## end Circle.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin Circle.protected preserve=yes␍
|
||||||
|
//## end Circle.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin Circle.private preserve=yes␍
|
||||||
|
//## end Circle.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Has Relationships␍
|
||||||
|
␍
|
||||||
|
//## Documentation Circle::center.has␍
|
||||||
|
//## begin Circle::center.has preserve=no private: Point {1 -> 1VO}␍
|
||||||
|
Point center;␍
|
||||||
|
//## end Circle::center.has␍
|
||||||
|
␍
|
||||||
|
// Data Members for Class Attributes␍
|
||||||
|
␍
|
||||||
|
//## Attribute: radius␍
|
||||||
|
//## begin Circle::radius.attr preserve=no private: int {U} ␍
|
||||||
|
int radius;␍
|
||||||
|
//## end Circle::radius.attr␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin Circle.implementation preserve=yes␍
|
||||||
|
//## end Circle.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin Circle.postscript preserve=yes␍
|
||||||
|
//## end Circle.postscript␍
|
||||||
|
␍
|
||||||
|
// Class Circle ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: ComplexFigure; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\CmplxFgr.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// ComplexFigure␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\CmplxFgr.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Graphic\Graphics.h"␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class ComplexFigure ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
ComplexFigure::ComplexFigure()␍
|
||||||
|
//## begin ComplexFigure::ComplexFigure%.hasinit preserve=no␍
|
||||||
|
//## end ComplexFigure::ComplexFigure%.hasinit␍
|
||||||
|
//## begin ComplexFigure::ComplexFigure%.initialization preserve=yes␍
|
||||||
|
//## end ComplexFigure::ComplexFigure%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure::ComplexFigure%.body preserve=yes␍
|
||||||
|
//## end ComplexFigure::ComplexFigure%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
ComplexFigure::~ComplexFigure()␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure::~ComplexFigure%.body preserve=yes␍
|
||||||
|
//## end ComplexFigure::~ComplexFigure%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
void ComplexFigure::draw (Graphics &g)␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure::draw%939104770.body preserve=yes␍
|
||||||
|
for(int i = 0; i < myFList.getSize(); i++)␍
|
||||||
|
{␍
|
||||||
|
FigureHolder fh = myFList.getItem(i);␍
|
||||||
|
Figure* f = fh.getFigure();␍
|
||||||
|
f->draw(g);␍
|
||||||
|
}␍
|
||||||
|
//## end ComplexFigure::draw%939104770.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void ComplexFigure::erase (Graphics &g)␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure::erase%939104771.body preserve=yes␍
|
||||||
|
//## end ComplexFigure::erase%939104771.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
Figure * ComplexFigure::clone ()␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure::clone%939104772.body preserve=yes␍
|
||||||
|
return new ComplexFigure(*this);␍
|
||||||
|
//## end ComplexFigure::clone%939104772.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void ComplexFigure::add (FigureHolder figure)␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure::add%939734506.body preserve=yes␍
|
||||||
|
myFList.add(myFList.getSize(), figure);␍
|
||||||
|
//## end ComplexFigure::add%939734506.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin ComplexFigure.declarations preserve=yes␍
|
||||||
|
//## end ComplexFigure.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
+100
@@ -0,0 +1,100 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: ComplexFigure; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\CmplxFgr.h␍
|
||||||
|
␍
|
||||||
|
#ifndef CmplxFgr_h␍
|
||||||
|
#define CmplxFgr_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Figure␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Figure.h"␍
|
||||||
|
// FList␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\FList.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: ComplexFigure␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
class ComplexFigure : public Figure //## Inherits: <unnamed>␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure.initialDeclarations preserve=yes␍
|
||||||
|
//## end ComplexFigure.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
ComplexFigure();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~ComplexFigure();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: draw%939104770␍
|
||||||
|
void draw (Graphics &g);␍
|
||||||
|
␍
|
||||||
|
//## Operation: erase%939104771␍
|
||||||
|
void erase (Graphics &g);␍
|
||||||
|
␍
|
||||||
|
//## Operation: clone%939104772␍
|
||||||
|
Figure * clone ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: add%939734506␍
|
||||||
|
void add (FigureHolder figure);␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin ComplexFigure.public preserve=yes␍
|
||||||
|
//## end ComplexFigure.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin ComplexFigure.protected preserve=yes␍
|
||||||
|
//## end ComplexFigure.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin ComplexFigure.private preserve=yes␍
|
||||||
|
//## end ComplexFigure.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Has Relationships␍
|
||||||
|
␍
|
||||||
|
//## Documentation ComplexFigure::myFList.has␍
|
||||||
|
//## begin ComplexFigure::myFList.has preserve=no public: FList {1 -> 1VO}␍
|
||||||
|
FList myFList;␍
|
||||||
|
//## end ComplexFigure::myFList.has␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin ComplexFigure.implementation preserve=yes␍
|
||||||
|
//## end ComplexFigure.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin ComplexFigure.postscript preserve=yes␍
|
||||||
|
//## end ComplexFigure.postscript␍
|
||||||
|
␍
|
||||||
|
// Class ComplexFigure ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: FigureHolder; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\FgrHlder.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// FigureHolder␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\FgrHlder.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class FigureHolder ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
FigureHolder::FigureHolder()␍
|
||||||
|
//## begin FigureHolder::FigureHolder%.hasinit preserve=no␍
|
||||||
|
//## end FigureHolder::FigureHolder%.hasinit␍
|
||||||
|
//## begin FigureHolder::FigureHolder%.initialization preserve=yes␍
|
||||||
|
//## end FigureHolder::FigureHolder%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin FigureHolder::FigureHolder%.body preserve=yes␍
|
||||||
|
//## end FigureHolder::FigureHolder%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
FigureHolder::~FigureHolder()␍
|
||||||
|
{␍
|
||||||
|
//## begin FigureHolder::~FigureHolder%.body preserve=yes␍
|
||||||
|
//## end FigureHolder::~FigureHolder%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
Figure * FigureHolder::getFigure ()␍
|
||||||
|
{␍
|
||||||
|
//## begin FigureHolder::getFigure%939734505.body preserve=yes␍
|
||||||
|
return myFigure;␍
|
||||||
|
//## end FigureHolder::getFigure%939734505.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin FigureHolder.declarations preserve=yes␍
|
||||||
|
//## end FigureHolder.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: FigureHolder; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\FgrHlder.h␍
|
||||||
|
␍
|
||||||
|
#ifndef FgrHlder_h␍
|
||||||
|
#define FgrHlder_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Figure␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Figure.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: FigureHolder␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
class FigureHolder ␍
|
||||||
|
{␍
|
||||||
|
//## begin FigureHolder.initialDeclarations preserve=yes␍
|
||||||
|
public:␍
|
||||||
|
FigureHolder(Figure& f) ␍
|
||||||
|
{␍
|
||||||
|
myFigure = f.clone();␍
|
||||||
|
}␍
|
||||||
|
//## end FigureHolder.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
FigureHolder();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~FigureHolder();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: getFigure%939734505␍
|
||||||
|
Figure * getFigure ();␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin FigureHolder.public preserve=yes␍
|
||||||
|
//## end FigureHolder.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin FigureHolder.protected preserve=yes␍
|
||||||
|
//## end FigureHolder.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin FigureHolder.private preserve=yes␍
|
||||||
|
//## end FigureHolder.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Has Relationships␍
|
||||||
|
␍
|
||||||
|
//## Documentation FigureHolder::myFigure.has␍
|
||||||
|
//## begin FigureHolder::myFigure.has preserve=no public: Figure {1 -> 1RO}␍
|
||||||
|
Figure *myFigure;␍
|
||||||
|
//## end FigureHolder::myFigure.has␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin FigureHolder.implementation preserve=yes␍
|
||||||
|
//## end FigureHolder.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin FigureHolder.postscript preserve=yes␍
|
||||||
|
//## end FigureHolder.postscript␍
|
||||||
|
␍
|
||||||
|
// Class FigureHolder ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Figure; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Figure.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Figure␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Figure.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class Figure ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Figure::Figure()␍
|
||||||
|
//## begin Figure::Figure%.hasinit preserve=no␍
|
||||||
|
//## end Figure::Figure%.hasinit␍
|
||||||
|
//## begin Figure::Figure%.initialization preserve=yes␍
|
||||||
|
//## end Figure::Figure%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Figure::Figure%.body preserve=yes␍
|
||||||
|
//## end Figure::Figure%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Figure::~Figure()␍
|
||||||
|
{␍
|
||||||
|
//## begin Figure::~Figure%.body preserve=yes␍
|
||||||
|
//## end Figure::~Figure%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
Color Figure::getColor ()␍
|
||||||
|
{␍
|
||||||
|
//## begin Figure::getColor%939623933.body preserve=yes␍
|
||||||
|
return color;␍
|
||||||
|
//## end Figure::getColor%939623933.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Figure::setColor (Color c)␍
|
||||||
|
{␍
|
||||||
|
//## begin Figure::setColor%939623934.body preserve=yes␍
|
||||||
|
color=c;␍
|
||||||
|
//## end Figure::setColor%939623934.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin Figure.declarations preserve=yes␍
|
||||||
|
//## end Figure.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
+103
@@ -0,0 +1,103 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Figure; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Figure.h␍
|
||||||
|
␍
|
||||||
|
#ifndef Figure_h␍
|
||||||
|
#define Figure_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Graphics␍
|
||||||
|
#include "Graphic\Graphics.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: Figure; Abstract␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
//## Uses: <unnamed>; Graphics { -> }␍
|
||||||
|
␍
|
||||||
|
class Figure ␍
|
||||||
|
{␍
|
||||||
|
//## begin Figure.initialDeclarations preserve=yes␍
|
||||||
|
//## end Figure.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
Figure();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~Figure();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: draw%937398679␍
|
||||||
|
virtual void draw (Graphics &g) = 0;␍
|
||||||
|
␍
|
||||||
|
//## Operation: erase%937398680␍
|
||||||
|
virtual void erase (Graphics &g) = 0;␍
|
||||||
|
␍
|
||||||
|
//## Operation: clone%937398681␍
|
||||||
|
virtual Figure * clone () = 0;␍
|
||||||
|
␍
|
||||||
|
//## Operation: getColor%939623933␍
|
||||||
|
Color getColor ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: setColor%939623934␍
|
||||||
|
void setColor (Color c);␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin Figure.public preserve=yes␍
|
||||||
|
//## end Figure.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin Figure.protected preserve=yes␍
|
||||||
|
//## end Figure.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin Figure.private preserve=yes␍
|
||||||
|
//## end Figure.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Class Attributes␍
|
||||||
|
␍
|
||||||
|
//## Attribute: color␍
|
||||||
|
//## begin Figure::color.attr preserve=no private: Color {U} ␍
|
||||||
|
Color color;␍
|
||||||
|
//## end Figure::color.attr␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin Figure.implementation preserve=yes␍
|
||||||
|
//## end Figure.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin Figure.postscript preserve=yes␍
|
||||||
|
//## end Figure.postscript␍
|
||||||
|
␍
|
||||||
|
// Class Figure ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: FList; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\FList.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// FList␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\FList.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin FList.instantiation preserve=no␍
|
||||||
|
template class List< FigureHolder >;␍
|
||||||
|
//## end FList.instantiation␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: FList; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\FList.h␍
|
||||||
|
␍
|
||||||
|
#ifndef FList_h␍
|
||||||
|
#define FList_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// List␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\List.h"␍
|
||||||
|
// FigureHolder␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\FgrHlder.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: FList; Instantiated Class␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
//## Uses: <unnamed>; FigureHolder { -> }␍
|
||||||
|
␍
|
||||||
|
typedef List< FigureHolder > FList;␍
|
||||||
|
␍
|
||||||
|
//## begin FList.postscript preserve=yes␍
|
||||||
|
//## end FList.postscript␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: DebugGraphics; Pseudo Package body␍
|
||||||
|
//## Subsystem: Graphic␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Graphic\DbgGrphc.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// DebugGraphics␍
|
||||||
|
#include "Graphic\DbgGrphc.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class DebugGraphics ␍
|
||||||
|
␍
|
||||||
|
DebugGraphics::DebugGraphics()␍
|
||||||
|
//## begin DebugGraphics::DebugGraphics%.hasinit preserve=no␍
|
||||||
|
//## end DebugGraphics::DebugGraphics%.hasinit␍
|
||||||
|
//## begin DebugGraphics::DebugGraphics%.initialization preserve=yes␍
|
||||||
|
//## end DebugGraphics::DebugGraphics%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin DebugGraphics::DebugGraphics%.body preserve=yes␍
|
||||||
|
//## end DebugGraphics::DebugGraphics%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
DebugGraphics::~DebugGraphics()␍
|
||||||
|
{␍
|
||||||
|
//## begin DebugGraphics::~DebugGraphics%.body preserve=yes␍
|
||||||
|
//## end DebugGraphics::~DebugGraphics%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
void DebugGraphics::drawCircle ()␍
|
||||||
|
{␍
|
||||||
|
//## begin DebugGraphics::drawCircle%938586296.body preserve=yes␍
|
||||||
|
//## end DebugGraphics::drawCircle%938586296.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void DebugGraphics::drawRectangle ()␍
|
||||||
|
{␍
|
||||||
|
//## begin DebugGraphics::drawRectangle%938586297.body preserve=yes␍
|
||||||
|
//## end DebugGraphics::drawRectangle%938586297.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void DebugGraphics::drawLine ()␍
|
||||||
|
{␍
|
||||||
|
//## begin DebugGraphics::drawLine%938586298.body preserve=yes␍
|
||||||
|
//## end DebugGraphics::drawLine%938586298.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin DebugGraphics.declarations preserve=yes␍
|
||||||
|
//## end DebugGraphics.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: DebugGraphics; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Graphic␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Graphic\DbgGrphc.h␍
|
||||||
|
␍
|
||||||
|
#ifndef DbgGrphc_h␍
|
||||||
|
#define DbgGrphc_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Graphics␍
|
||||||
|
#include "Graphic\Graphics.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Graphic\DbgGrphc.h"␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: DebugGraphics␍
|
||||||
|
//## Category: Graphic␍
|
||||||
|
//## Subsystem: Graphic␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
class DebugGraphics : public Graphics //## Inherits: <unnamed>␍
|
||||||
|
{␍
|
||||||
|
//## begin DebugGraphics.initialDeclarations preserve=yes␍
|
||||||
|
//## end DebugGraphics.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
DebugGraphics();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~DebugGraphics();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: drawCircle%938586296␍
|
||||||
|
void drawCircle ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: drawRectangle%938586297␍
|
||||||
|
void drawRectangle ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: drawLine%938586298␍
|
||||||
|
void drawLine ();␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin DebugGraphics.public preserve=yes␍
|
||||||
|
//## end DebugGraphics.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin DebugGraphics.protected preserve=yes␍
|
||||||
|
//## end DebugGraphics.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin DebugGraphics.private preserve=yes␍
|
||||||
|
//## end DebugGraphics.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin DebugGraphics.implementation preserve=yes␍
|
||||||
|
//## end DebugGraphics.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin DebugGraphics.postscript preserve=yes␍
|
||||||
|
//## end DebugGraphics.postscript␍
|
||||||
|
␍
|
||||||
|
// Class DebugGraphics ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Graphics; Pseudo Package body␍
|
||||||
|
//## Subsystem: Graphic␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Graphic\Graphics.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Graphics␍
|
||||||
|
#include "Graphic\Graphics.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
#include <iostream.h>␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class Graphics ␍
|
||||||
|
␍
|
||||||
|
Graphics::Graphics()␍
|
||||||
|
//## begin Graphics::Graphics%.hasinit preserve=no␍
|
||||||
|
//## end Graphics::Graphics%.hasinit␍
|
||||||
|
//## begin Graphics::Graphics%.initialization preserve=yes␍
|
||||||
|
//## end Graphics::Graphics%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics::Graphics%.body preserve=yes␍
|
||||||
|
//## end Graphics::Graphics%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Graphics::~Graphics()␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics::~Graphics%.body preserve=yes␍
|
||||||
|
//## end Graphics::~Graphics%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
void Graphics::drawCircle (Point center, int radius, Color color)␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics::drawCircle%938436810.body preserve=yes␍
|
||||||
|
cout << "\nCircle drawn with ("<<center.getx()<<","<<center.gety()<<") ,radius="<<radius<<" , color="<<color;␍
|
||||||
|
//## end Graphics::drawCircle%938436810.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Graphics::drawRectangle (Point leftTop, Point rightBottom, Color color)␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics::drawRectangle%938436812.body preserve=yes␍
|
||||||
|
cout << "\nRectangle drawn with ("<<leftTop.getx()<<","<<leftTop.gety()<<") to ("<<rightBottom.getx()<<","<<rightBottom.getx()<<"), color="<<color;␍
|
||||||
|
//## end Graphics::drawRectangle%938436812.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Graphics::drawLine (int x1, int y1, int x2, int y2, Color color)␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics::drawLine%938436813.body preserve=yes␍
|
||||||
|
cout << "\nLine drawn from ("<<x1<<","<<y1<<") to ("<<x2<<","<<y2<<"), color="<<color;␍
|
||||||
|
//## end Graphics::drawLine%938436813.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
Color Graphics::getBGColor ()␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics::getBGColor%939797852.body preserve=yes␍
|
||||||
|
return 0;␍
|
||||||
|
//## end Graphics::getBGColor%939797852.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin Graphics.declarations preserve=yes␍
|
||||||
|
//## end Graphics.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Graphics; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Graphic␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Graphic\Graphics.h␍
|
||||||
|
␍
|
||||||
|
#ifndef Graphics_h␍
|
||||||
|
#define Graphics_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
#include "Point.h"␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Point␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Point.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
typedef int Color;␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: Graphics; Abstract␍
|
||||||
|
//## Category: Graphic␍
|
||||||
|
//## Subsystem: Graphic␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
//## Uses: <unnamed>; Point { -> }␍
|
||||||
|
␍
|
||||||
|
class Graphics ␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics.initialDeclarations preserve=yes␍
|
||||||
|
//## end Graphics.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
Graphics();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~Graphics();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: drawCircle%938436810␍
|
||||||
|
void drawCircle (Point center, int radius, Color color);␍
|
||||||
|
␍
|
||||||
|
//## Operation: drawRectangle%938436812␍
|
||||||
|
void drawRectangle (Point leftTop, Point rightBottom, Color color);␍
|
||||||
|
␍
|
||||||
|
//## Operation: drawLine%938436813␍
|
||||||
|
void drawLine (int x1, int y1, int x2, int y2, Color color);␍
|
||||||
|
␍
|
||||||
|
//## Operation: getBGColor%939797852␍
|
||||||
|
Color getBGColor ();␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin Graphics.public preserve=yes␍
|
||||||
|
//## end Graphics.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin Graphics.protected preserve=yes␍
|
||||||
|
//## end Graphics.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin Graphics.private preserve=yes␍
|
||||||
|
//## end Graphics.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin Graphics.implementation preserve=yes␍
|
||||||
|
//## end Graphics.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin Graphics.postscript preserve=yes␍
|
||||||
|
//## end Graphics.postscript␍
|
||||||
|
␍
|
||||||
|
// Class Graphics ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
+120
@@ -0,0 +1,120 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Line; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Line.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Line␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Line.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
#include <iostream.h>␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class Line ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Line::Line (int x1, int y1, int x2, int y2, Color color)␍
|
||||||
|
//## begin Line::Line%939623930.hasinit preserve=no␍
|
||||||
|
//## end Line::Line%939623930.hasinit␍
|
||||||
|
//## begin Line::Line%939623930.initialization preserve=yes␍
|
||||||
|
//## end Line::Line%939623930.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Line::Line%939623930.body preserve=yes␍
|
||||||
|
setColor(color);␍
|
||||||
|
␍
|
||||||
|
Point start, end;␍
|
||||||
|
start.setx(x1);␍
|
||||||
|
start.sety(y1);␍
|
||||||
|
end.setx(x2);␍
|
||||||
|
end.sety(y2);␍
|
||||||
|
myPoints.add(myPoints.getSize(), start);␍
|
||||||
|
myPoints.add(myPoints.getSize(), end);␍
|
||||||
|
//## end Line::Line%939623930.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Line::~Line()␍
|
||||||
|
{␍
|
||||||
|
//## begin Line::~Line%.body preserve=yes␍
|
||||||
|
//## end Line::~Line%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
void Line::draw (Graphics &g)␍
|
||||||
|
{␍
|
||||||
|
//## begin Line::draw%937398668.body preserve=yes␍
|
||||||
|
Point start,end;␍
|
||||||
|
int i = 0;␍
|
||||||
|
if(!myPoints.isEmpty()) ␍
|
||||||
|
start = myPoints.getItem(i++);␍
|
||||||
|
while(i < myPoints.getSize())␍
|
||||||
|
{␍
|
||||||
|
end = myPoints.getItem(i++);␍
|
||||||
|
g.drawLine(start.getx(),start.gety(),end.getx(),end.gety(),getColor());␍
|
||||||
|
start = end;␍
|
||||||
|
}␍
|
||||||
|
//## end Line::draw%937398668.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Line::erase (Graphics &g)␍
|
||||||
|
{␍
|
||||||
|
//## begin Line::erase%937398669.body preserve=yes␍
|
||||||
|
setColor(g.getBGColor());␍
|
||||||
|
draw(g);␍
|
||||||
|
//## end Line::erase%937398669.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
Figure * Line::clone ()␍
|
||||||
|
{␍
|
||||||
|
//## begin Line::clone%937398682.body preserve=yes␍
|
||||||
|
return new Line(*this);␍
|
||||||
|
//## end Line::clone%937398682.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Line::add (int x, int y)␍
|
||||||
|
{␍
|
||||||
|
//## begin Line::add%939734504.body preserve=yes␍
|
||||||
|
Point start;␍
|
||||||
|
start.setx(x);␍
|
||||||
|
start.sety(y);␍
|
||||||
|
myPoints.add(myPoints.getSize(), start);␍
|
||||||
|
//## end Line::add%939734504.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin Line.declarations preserve=yes␍
|
||||||
|
//## end Line.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Detached code regions:␍
|
||||||
|
// WARNING: this code will be lost if code is regenerated.␍
|
||||||
|
#if 0␍
|
||||||
|
//## begin Line::setColor%939797857.body preserve=no␍
|
||||||
|
color=src;␍
|
||||||
|
␍
|
||||||
|
//## end Line::setColor%939797857.body␍
|
||||||
|
␍
|
||||||
|
//## begin Line::getColor%939797858.body preserve=no␍
|
||||||
|
return color;␍
|
||||||
|
//## end Line::getColor%939797858.body␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
+101
@@ -0,0 +1,101 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Line; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Line.h␍
|
||||||
|
␍
|
||||||
|
#ifndef Line_h␍
|
||||||
|
#define Line_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// pList␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\pList.h"␍
|
||||||
|
// Figure␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Figure.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: Line␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
class Line : public Figure //## Inherits: <unnamed>␍
|
||||||
|
{␍
|
||||||
|
//## begin Line.initialDeclarations preserve=yes␍
|
||||||
|
//## end Line.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (specified)␍
|
||||||
|
//## Operation: Line%939623930␍
|
||||||
|
Line (int x1, int y1, int x2, int y2, Color color);␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~Line();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: draw%937398668␍
|
||||||
|
void draw (Graphics &g);␍
|
||||||
|
␍
|
||||||
|
//## Operation: erase%937398669␍
|
||||||
|
void erase (Graphics &g);␍
|
||||||
|
␍
|
||||||
|
//## Operation: clone%937398682␍
|
||||||
|
Figure * clone ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: add%939734504␍
|
||||||
|
void add (int x, int y);␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin Line.public preserve=yes␍
|
||||||
|
//## end Line.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin Line.protected preserve=yes␍
|
||||||
|
//## end Line.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin Line.private preserve=yes␍
|
||||||
|
//## end Line.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Has Relationships␍
|
||||||
|
␍
|
||||||
|
//## Documentation Line::myPoints.has␍
|
||||||
|
//## begin Line::myPoints.has preserve=no private: pList {1 -> 1VO}␍
|
||||||
|
pList myPoints;␍
|
||||||
|
//## end Line::myPoints.has␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin Line.implementation preserve=yes␍
|
||||||
|
//## end Line.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin Line.postscript preserve=yes␍
|
||||||
|
//## end Line.postscript␍
|
||||||
|
␍
|
||||||
|
// Class Line ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: List; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\List.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// List␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\List.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
#include <stdio.h>␍
|
||||||
|
#include <iostream.h>␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Parameterized Class List ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
template <class T>␍
|
||||||
|
List<T>::List()␍
|
||||||
|
//## begin List::List%.hasinit preserve=no␍
|
||||||
|
: size(0)␍
|
||||||
|
//## end List::List%.hasinit␍
|
||||||
|
//## begin List::List%.initialization preserve=yes␍
|
||||||
|
//## end List::List%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin List::List%.body preserve=yes␍
|
||||||
|
head=NULL;␍
|
||||||
|
//## end List::List%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
template <class T>␍
|
||||||
|
List<T>::~List()␍
|
||||||
|
{␍
|
||||||
|
//## begin List::~List%.body preserve=yes␍
|
||||||
|
delete head;␍
|
||||||
|
//## end List::~List%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
template <class T>␍
|
||||||
|
void List<T>::add (int position, T item)␍
|
||||||
|
{␍
|
||||||
|
//## begin List::add%937398674.body preserve=yes␍
|
||||||
|
␍
|
||||||
|
size++; ␍
|
||||||
|
Node<T>* newPtr = new Node<T>(item); ␍
|
||||||
|
␍
|
||||||
|
if (position==0) {␍
|
||||||
|
newPtr->next=head;␍
|
||||||
|
head=newPtr;␍
|
||||||
|
}␍
|
||||||
|
else {␍
|
||||||
|
Node<T>* prev=head;␍
|
||||||
|
for (int i=0;i<position-1;i++)␍
|
||||||
|
prev=prev->next;␍
|
||||||
|
newPtr->next=prev->next;␍
|
||||||
|
prev->next=newPtr;␍
|
||||||
|
}␍
|
||||||
|
//## end List::add%937398674.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
template <class T>␍
|
||||||
|
void List<T>::del (int position)␍
|
||||||
|
{␍
|
||||||
|
//## begin List::del%937398675.body preserve=yes␍
|
||||||
|
Node<T>* trav=head;␍
|
||||||
|
Node<T>* cur;␍
|
||||||
|
size--;␍
|
||||||
|
if (position == 0) {␍
|
||||||
|
cur = head;␍
|
||||||
|
head = head -> next;␍
|
||||||
|
}␍
|
||||||
|
else {␍
|
||||||
|
for (int i=0 ; i<position-1 ; i++)␍
|
||||||
|
trav = trav -> next;␍
|
||||||
|
cur = trav -> next;␍
|
||||||
|
trav -> next = cur ->next;␍
|
||||||
|
}␍
|
||||||
|
cur -> next = NULL;␍
|
||||||
|
delete cur;␍
|
||||||
|
cur = NULL;␍
|
||||||
|
␍
|
||||||
|
//## end List::del%937398675.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
template <class T>␍
|
||||||
|
bool List<T>::isEmpty ()␍
|
||||||
|
{␍
|
||||||
|
//## begin List::isEmpty%937398676.body preserve=yes␍
|
||||||
|
return (size==0);␍
|
||||||
|
//## end List::isEmpty%937398676.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
template <class T>␍
|
||||||
|
int List<T>::getSize ()␍
|
||||||
|
{␍
|
||||||
|
//## begin List::getSize%937398677.body preserve=yes␍
|
||||||
|
return size;␍
|
||||||
|
//## end List::getSize%937398677.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
template <class T>␍
|
||||||
|
T List<T>::getItem (int position)␍
|
||||||
|
{␍
|
||||||
|
//## begin List::getItem%937398678.body preserve=yes␍
|
||||||
|
Node<T>* cur=head; ␍
|
||||||
|
for(int i=0 ; i<position ; i++) ␍
|
||||||
|
cur=cur->next;␍
|
||||||
|
return (cur->data);␍
|
||||||
|
␍
|
||||||
|
//## end List::getItem%937398678.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin List.declarations preserve=yes␍
|
||||||
|
//## end List.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
+111
@@ -0,0 +1,111 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: List; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\List.h␍
|
||||||
|
␍
|
||||||
|
#ifndef List_h␍
|
||||||
|
#define List_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Node␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Node.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: List; Parameterized Class␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
template <class T>␍
|
||||||
|
class List ␍
|
||||||
|
{␍
|
||||||
|
//## begin List.initialDeclarations preserve=yes␍
|
||||||
|
//## end List.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
List();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~List();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: add%937398674␍
|
||||||
|
// Denna sätter in grejjer i listan...␍
|
||||||
|
void add (int position, T item);␍
|
||||||
|
␍
|
||||||
|
//## Operation: del%937398675␍
|
||||||
|
void del (int position);␍
|
||||||
|
␍
|
||||||
|
//## Operation: isEmpty%937398676␍
|
||||||
|
bool isEmpty ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: getSize%937398677␍
|
||||||
|
int getSize ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: getItem%937398678␍
|
||||||
|
T getItem (int position);␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin List.public preserve=yes␍
|
||||||
|
//## end List.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin List.protected preserve=yes␍
|
||||||
|
//## end List.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin List.private preserve=yes␍
|
||||||
|
//## end List.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Has Relationships␍
|
||||||
|
␍
|
||||||
|
//## Documentation List::head.has␍
|
||||||
|
//## begin List::head.has preserve=yes private: Node {1 -> 1RO}␍
|
||||||
|
Node<T> *head;␍
|
||||||
|
//## end List::head.has␍
|
||||||
|
␍
|
||||||
|
// Data Members for Class Attributes␍
|
||||||
|
␍
|
||||||
|
//## Attribute: size␍
|
||||||
|
//## begin List::size.attr preserve=no private: int {U} 0␍
|
||||||
|
int size;␍
|
||||||
|
//## end List::size.attr␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin List.implementation preserve=yes␍
|
||||||
|
//## end List.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin List.postscript preserve=yes␍
|
||||||
|
//## end List.postscript␍
|
||||||
|
␍
|
||||||
|
// Parameterized Class List ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
#include "list.cpp"␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
//#␍
|
||||||
|
//# main.c␍
|
||||||
|
//#␍
|
||||||
|
//# =======================================================␍
|
||||||
|
//# Lab i Avacerad C++␍
|
||||||
|
//# 4. Figures␍
|
||||||
|
//#␍
|
||||||
|
//#␍
|
||||||
|
//# Christian Ohlsson ␍
|
||||||
|
//# Daniel Alfredsson␍
|
||||||
|
//# Karlstads universitet␍
|
||||||
|
//# 991013␍
|
||||||
|
//# =======================================================␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#include <iostream.h>␍
|
||||||
|
#include "Graphic\Graphics.h"␍
|
||||||
|
#include "line.h"␍
|
||||||
|
#include "rectngle.h"␍
|
||||||
|
#include "circle.h"␍
|
||||||
|
#include "flist.h"␍
|
||||||
|
#include "CmplxFgr.h"␍
|
||||||
|
␍
|
||||||
|
void main(void) {␍
|
||||||
|
ComplexFigure cf;␍
|
||||||
|
FList myList;␍
|
||||||
|
Graphics g;␍
|
||||||
|
␍
|
||||||
|
Line l(0,0,0,10, 9);␍
|
||||||
|
l.add(20,20);␍
|
||||||
|
␍
|
||||||
|
Rectangle r(5,5,25,25,8);␍
|
||||||
|
Circle c(100, 100, 50, 14);␍
|
||||||
|
␍
|
||||||
|
cf.add(FigureHolder(c));␍
|
||||||
|
cf.add(FigureHolder(l));␍
|
||||||
|
␍
|
||||||
|
myList.add(0,FigureHolder(l));␍
|
||||||
|
myList.add(1,FigureHolder(r));␍
|
||||||
|
myList.add(2,FigureHolder(c));␍
|
||||||
|
myList.add(3,FigureHolder(cf));␍
|
||||||
|
␍
|
||||||
|
cout <<"\n1";␍
|
||||||
|
for(int i = 0; i < myList.getSize(); i++) {␍
|
||||||
|
FigureHolder fh = myList.getItem(i);␍
|
||||||
|
Figure* f = fh.getFigure();␍
|
||||||
|
f->draw(g);␍
|
||||||
|
}␍
|
||||||
|
l.erase(g);␍
|
||||||
|
r.erase(g); ␍
|
||||||
|
c.erase(g);␍
|
||||||
|
␍
|
||||||
|
cout <<"\n2";␍
|
||||||
|
for(i = 0; i < myList.getSize(); i++) {␍
|
||||||
|
FigureHolder fh = myList.getItem(i);␍
|
||||||
|
Figure* f = fh.getFigure();␍
|
||||||
|
f->draw(g);␍
|
||||||
|
}␍
|
||||||
|
char x;␍
|
||||||
|
cin >> x;␍
|
||||||
|
}␍
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Node; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Node.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Node␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Node.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Parameterized Class Node ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
template <class T>␍
|
||||||
|
Node<T>::Node()␍
|
||||||
|
//## begin Node::Node%.hasinit preserve=no␍
|
||||||
|
//## end Node::Node%.hasinit␍
|
||||||
|
//## begin Node::Node%.initialization preserve=yes␍
|
||||||
|
//## end Node::Node%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Node::Node%.body preserve=yes␍
|
||||||
|
//## end Node::Node%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
template <class T>␍
|
||||||
|
Node<T>::~Node()␍
|
||||||
|
{␍
|
||||||
|
//## begin Node::~Node%.body preserve=yes␍
|
||||||
|
if(next) delete next ;␍
|
||||||
|
//## end Node::~Node%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin Node.declarations preserve=yes␍
|
||||||
|
#include "list.h"␍
|
||||||
|
//## end Node.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Detached code regions:␍
|
||||||
|
// WARNING: this code will be lost if code is regenerated.␍
|
||||||
|
#if 0␍
|
||||||
|
//## begin Node::getData%939104773.body preserve=no␍
|
||||||
|
return *this;␍
|
||||||
|
//## end Node::getData%939104773.body␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
+97
@@ -0,0 +1,97 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Node; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Node.h␍
|
||||||
|
␍
|
||||||
|
#ifndef Node_h␍
|
||||||
|
#define Node_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: Node; Parameterized Class␍
|
||||||
|
// detta är lite dokumentation␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
template <class T>␍
|
||||||
|
class Node ␍
|
||||||
|
{␍
|
||||||
|
//## begin Node.initialDeclarations preserve=yes␍
|
||||||
|
public:␍
|
||||||
|
Node(T theData):data(theData){next = (Node<T>*)0;}␍
|
||||||
|
//## end Node.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
Node();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~Node();␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin Node.public preserve=yes␍
|
||||||
|
Node *next;␍
|
||||||
|
T data;␍
|
||||||
|
//## end Node.public␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin Node.protected preserve=yes␍
|
||||||
|
//## end Node.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin Node.private preserve=yes␍
|
||||||
|
//## end Node.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Has Relationships␍
|
||||||
|
␍
|
||||||
|
//## Documentation Node::next.has␍
|
||||||
|
//## begin Node::next.has preserve=yes public: Node {1 -> 1RO}␍
|
||||||
|
// Node *next;␍
|
||||||
|
//## end Node::next.has␍
|
||||||
|
␍
|
||||||
|
// Data Members for Class Attributes␍
|
||||||
|
␍
|
||||||
|
//## Attribute: data␍
|
||||||
|
// detta haldlar om datafältet␍
|
||||||
|
//## begin Node::data.attr preserve=yes public: T {U} ␍
|
||||||
|
// T data;␍
|
||||||
|
//## end Node::data.attr␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin Node.implementation preserve=yes␍
|
||||||
|
//## end Node.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin Node.postscript preserve=yes␍
|
||||||
|
␍
|
||||||
|
#include "node.cpp"␍
|
||||||
|
//## end Node.postscript␍
|
||||||
|
␍
|
||||||
|
// Parameterized Class Node ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: pList; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\pList.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// pList␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\pList.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin pList.instantiation preserve=no␍
|
||||||
|
template class List< Point >;␍
|
||||||
|
//## end pList.instantiation␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: pList; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\pList.h␍
|
||||||
|
␍
|
||||||
|
#ifndef pList_h␍
|
||||||
|
#define pList_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// List␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\List.h"␍
|
||||||
|
// Point␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Point.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: pList; Instantiated Class␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
//## Uses: <unnamed>; Point { -> }␍
|
||||||
|
␍
|
||||||
|
typedef List< Point > pList;␍
|
||||||
|
␍
|
||||||
|
//## begin pList.postscript preserve=yes␍
|
||||||
|
//## end pList.postscript␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Point; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Point.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Point␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Point.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class Point ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Point::Point()␍
|
||||||
|
//## begin Point::Point%.hasinit preserve=no␍
|
||||||
|
//## end Point::Point%.hasinit␍
|
||||||
|
//## begin Point::Point%.initialization preserve=yes␍
|
||||||
|
//## end Point::Point%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Point::Point%.body preserve=yes␍
|
||||||
|
//## end Point::Point%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Point::~Point()␍
|
||||||
|
{␍
|
||||||
|
//## begin Point::~Point%.body preserve=yes␍
|
||||||
|
//## end Point::~Point%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
int Point::getx ()␍
|
||||||
|
{␍
|
||||||
|
//## begin Point::getx%937398664.body preserve=yes␍
|
||||||
|
return x;␍
|
||||||
|
//## end Point::getx%937398664.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
int Point::gety ()␍
|
||||||
|
{␍
|
||||||
|
//## begin Point::gety%937398665.body preserve=yes␍
|
||||||
|
return y;␍
|
||||||
|
//## end Point::gety%937398665.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Point::setx (int src)␍
|
||||||
|
{␍
|
||||||
|
//## begin Point::setx%937398666.body preserve=yes␍
|
||||||
|
x=src;␍
|
||||||
|
//## end Point::setx%937398666.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Point::sety (int src)␍
|
||||||
|
{␍
|
||||||
|
//## begin Point::sety%937398667.body preserve=yes␍
|
||||||
|
y=src;␍
|
||||||
|
//## end Point::sety%937398667.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin Point.declarations preserve=yes␍
|
||||||
|
//## end Point.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
+101
@@ -0,0 +1,101 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Point; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Point.h␍
|
||||||
|
␍
|
||||||
|
#ifndef Point_h␍
|
||||||
|
#define Point_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: Point␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
class Point ␍
|
||||||
|
{␍
|
||||||
|
//## begin Point.initialDeclarations preserve=yes␍
|
||||||
|
//## end Point.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
Point();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~Point();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: getx%937398664␍
|
||||||
|
int getx ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: gety%937398665␍
|
||||||
|
int gety ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: setx%937398666␍
|
||||||
|
void setx (int src);␍
|
||||||
|
␍
|
||||||
|
//## Operation: sety%937398667␍
|
||||||
|
void sety (int src);␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin Point.public preserve=yes␍
|
||||||
|
//## end Point.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin Point.protected preserve=yes␍
|
||||||
|
//## end Point.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin Point.private preserve=yes␍
|
||||||
|
//## end Point.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Class Attributes␍
|
||||||
|
␍
|
||||||
|
//## Attribute: x␍
|
||||||
|
//## begin Point::x.attr preserve=no private: int {U} ␍
|
||||||
|
int x;␍
|
||||||
|
//## end Point::x.attr␍
|
||||||
|
␍
|
||||||
|
//## Attribute: y␍
|
||||||
|
//## begin Point::y.attr preserve=no private: int {U} ␍
|
||||||
|
int y;␍
|
||||||
|
//## end Point::y.attr␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin Point.implementation preserve=yes␍
|
||||||
|
//## end Point.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin Point.postscript preserve=yes␍
|
||||||
|
//## end Point.postscript␍
|
||||||
|
␍
|
||||||
|
// Class Point ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Rectangle; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Rectngle.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Rectangle␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Rectngle.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
#include <iostream.h>␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class Rectangle ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Rectangle::Rectangle()␍
|
||||||
|
//## begin Rectangle::Rectangle%.hasinit preserve=no␍
|
||||||
|
//## end Rectangle::Rectangle%.hasinit␍
|
||||||
|
//## begin Rectangle::Rectangle%.initialization preserve=yes␍
|
||||||
|
//## end Rectangle::Rectangle%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Rectangle::Rectangle%.body preserve=yes␍
|
||||||
|
//## end Rectangle::Rectangle%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
Rectangle::Rectangle (int x1, int y1, int x2, int y2, Color color)␍
|
||||||
|
//## begin Rectangle::Rectangle%939623932.hasinit preserve=no␍
|
||||||
|
//## end Rectangle::Rectangle%939623932.hasinit␍
|
||||||
|
//## begin Rectangle::Rectangle%939623932.initialization preserve=yes␍
|
||||||
|
//## end Rectangle::Rectangle%939623932.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Rectangle::Rectangle%939623932.body preserve=yes␍
|
||||||
|
setColor(color);␍
|
||||||
|
leftTop.setx(x1);␍
|
||||||
|
leftTop.sety(y1);␍
|
||||||
|
rightBottom.setx(x2);␍
|
||||||
|
rightBottom.sety(y2);␍
|
||||||
|
//## end Rectangle::Rectangle%939623932.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Rectangle::~Rectangle()␍
|
||||||
|
{␍
|
||||||
|
//## begin Rectangle::~Rectangle%.body preserve=yes␍
|
||||||
|
//## end Rectangle::~Rectangle%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
void Rectangle::draw (Graphics &g)␍
|
||||||
|
{␍
|
||||||
|
//## begin Rectangle::draw%937398672.body preserve=yes␍
|
||||||
|
g.drawRectangle(leftTop, rightBottom, getColor());␍
|
||||||
|
//## end Rectangle::draw%937398672.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Rectangle::erase (Graphics &g)␍
|
||||||
|
{␍
|
||||||
|
//## begin Rectangle::erase%937398673.body preserve=yes␍
|
||||||
|
setColor(g.getBGColor());␍
|
||||||
|
draw(g);␍
|
||||||
|
//## end Rectangle::erase%937398673.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
Figure * Rectangle::clone ()␍
|
||||||
|
{␍
|
||||||
|
//## begin Rectangle::clone%937398684.body preserve=yes␍
|
||||||
|
return new Rectangle(*this);␍
|
||||||
|
//## end Rectangle::clone%937398684.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin Rectangle.declarations preserve=yes␍
|
||||||
|
//## end Rectangle.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Detached code regions:␍
|
||||||
|
// WARNING: this code will be lost if code is regenerated.␍
|
||||||
|
#if 0␍
|
||||||
|
//## begin Rectangle::setColor%939797855.body preserve=no␍
|
||||||
|
color=src;␍
|
||||||
|
//## end Rectangle::setColor%939797855.body␍
|
||||||
|
␍
|
||||||
|
//## begin Rectangle::getColor%939797856.body preserve=no␍
|
||||||
|
return color;␍
|
||||||
|
//## end Rectangle::getColor%939797856.body␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
+106
@@ -0,0 +1,106 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Rectangle; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Rectngle.h␍
|
||||||
|
␍
|
||||||
|
#ifndef Rectngle_h␍
|
||||||
|
#define Rectngle_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Point␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Point.h"␍
|
||||||
|
// Figure␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab4\Rose\Figure.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: Rectangle␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
class Rectangle : public Figure //## Inherits: <unnamed>␍
|
||||||
|
{␍
|
||||||
|
//## begin Rectangle.initialDeclarations preserve=yes␍
|
||||||
|
//## end Rectangle.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
Rectangle();␍
|
||||||
|
␍
|
||||||
|
//## Constructors (specified)␍
|
||||||
|
//## Operation: Rectangle%939623932␍
|
||||||
|
Rectangle (int x1, int y1, int x2, int y2, Color color);␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~Rectangle();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: draw%937398672␍
|
||||||
|
void draw (Graphics &g);␍
|
||||||
|
␍
|
||||||
|
//## Operation: erase%937398673␍
|
||||||
|
void erase (Graphics &g);␍
|
||||||
|
␍
|
||||||
|
//## Operation: clone%937398684␍
|
||||||
|
Figure * clone ();␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin Rectangle.public preserve=yes␍
|
||||||
|
//## end Rectangle.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin Rectangle.protected preserve=yes␍
|
||||||
|
//## end Rectangle.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin Rectangle.private preserve=yes␍
|
||||||
|
//## end Rectangle.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Has Relationships␍
|
||||||
|
␍
|
||||||
|
//## Documentation Rectangle::leftTop.has␍
|
||||||
|
//## begin Rectangle::leftTop.has preserve=no private: Point {1 -> 1VO}␍
|
||||||
|
Point leftTop;␍
|
||||||
|
//## end Rectangle::leftTop.has␍
|
||||||
|
␍
|
||||||
|
//## Documentation Rectangle::rightBottom.has␍
|
||||||
|
//## begin Rectangle::rightBottom.has preserve=no private: Point {1 -> 1VO}␍
|
||||||
|
Point rightBottom;␍
|
||||||
|
//## end Rectangle::rightBottom.has␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin Rectangle.implementation preserve=yes␍
|
||||||
|
//## end Rectangle.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin Rectangle.postscript preserve=yes␍
|
||||||
|
//## end Rectangle.postscript␍
|
||||||
|
␍
|
||||||
|
// Class Rectangle ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
+196
@@ -0,0 +1,196 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="Rose" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=Rose - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "Rose.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "Rose.mak" CFG="Rose - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "Rose - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "Rose - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "Rose - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD BASE RSC /l 0x41d /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x41d /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "Rose - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0x41d /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x41d /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "Rose - Win32 Release"
|
||||||
|
# Name "Rose - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Circle.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\CmplxFgr.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Graphic\DbgGrphc.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\FgrHlder.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Figure.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Flist.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Graphic\Graphics.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Line.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\main.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\pList.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Point.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Rectngle.cpp
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Circle.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\CmplxFgr.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Graphic\DbgGrphc.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\FgrHlder.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Figure.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Flist.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Graphic\Graphics.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Line.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\List.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Node.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\pList.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Point.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Rectngle.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "Rose"=".\Rose.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
+118
@@ -0,0 +1,118 @@
|
|||||||
|
//##################################################################␍
|
||||||
|
// LAB 5␍
|
||||||
|
// ADVANCED PROGRAMMING IN C++␍
|
||||||
|
// MATRIX/ARRAY WITH TRY-CATCH␍
|
||||||
|
//==================================================================␍
|
||||||
|
// array.h␍
|
||||||
|
// CLASS IMPLEMENTATION AND DEFINITION FOR␍
|
||||||
|
// THE ARRAY␍
|
||||||
|
// Christian Ohlsson␍
|
||||||
|
// Daniel Alfredsson␍
|
||||||
|
// Karlstad 990927␍
|
||||||
|
//==================================================================␍
|
||||||
|
␍
|
||||||
|
#include <iostream.h>␍
|
||||||
|
class Array {␍
|
||||||
|
private:␍
|
||||||
|
int size; //The size of the Array␍
|
||||||
|
int *buffer; //Pointer to an int-buffer␍
|
||||||
|
public:␍
|
||||||
|
~Array();␍
|
||||||
|
Array(const int s=0);␍
|
||||||
|
Array(const Array &src);␍
|
||||||
|
void operator = (const Array &src);␍
|
||||||
|
Array Array::operator +(const Array &src);␍
|
||||||
|
int &operator [] (int index) const;␍
|
||||||
|
int getSize() const;␍
|
||||||
|
};␍
|
||||||
|
//################################################################␍
|
||||||
|
// Constructor ␍
|
||||||
|
// Creates a new Array␍
|
||||||
|
//================================================================␍
|
||||||
|
Array::Array(const int s) { ␍
|
||||||
|
try {␍
|
||||||
|
buffer = new int[s];␍
|
||||||
|
}catch(MemoryError &e){ e.Print(); }␍
|
||||||
|
size= s;␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Constructor␍
|
||||||
|
// Copys an array␍
|
||||||
|
//================================================================␍
|
||||||
|
Array::Array(const Array &src) {␍
|
||||||
|
size = src.size;␍
|
||||||
|
try {␍
|
||||||
|
buffer = new int[size];␍
|
||||||
|
}catch(MemoryError &e){ e.Print(); }␍
|
||||||
|
for(int i=0 ; i<size ; i++)␍
|
||||||
|
buffer[i] = src.buffer[i];␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Operator overload␍
|
||||||
|
// Allows to assign a Array to another␍
|
||||||
|
//================================================================␍
|
||||||
|
void Array::operator = (const Array &src) {␍
|
||||||
|
delete [] buffer;␍
|
||||||
|
size = src.size;␍
|
||||||
|
try {␍
|
||||||
|
buffer = new int[size];␍
|
||||||
|
}catch(MemoryError &e){ e.Print(); }␍
|
||||||
|
␍
|
||||||
|
for(int i=0 ; i<size ; i++)␍
|
||||||
|
buffer[i] = src.buffer[i];␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Operator overload␍
|
||||||
|
// Returns a element in the Array␍
|
||||||
|
//================================================================␍
|
||||||
|
int &Array::operator [] (int index) const{␍
|
||||||
|
if (index<0 || index >= size)␍
|
||||||
|
throw RangeError();␍
|
||||||
|
return buffer[index];␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Operator overload␍
|
||||||
|
// Allows to add a Array to another␍
|
||||||
|
//================================================================␍
|
||||||
|
Array Array::operator + (const Array &src) {␍
|
||||||
|
if(src.size != getSize())␍
|
||||||
|
throw SizeError();␍
|
||||||
|
Array tmp(size);␍
|
||||||
|
for(int i=0 ; i<size ; i++)␍
|
||||||
|
tmp.buffer[i] = buffer[i] + src.buffer[i];␍
|
||||||
|
return (tmp);␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Destructor␍
|
||||||
|
// Deallocates memory, used by the Array␍
|
||||||
|
//================================================================␍
|
||||||
|
Array::~Array() {␍
|
||||||
|
delete [] buffer;␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Operator overload␍
|
||||||
|
// Allows input in the Array, using STDIN␍
|
||||||
|
//================================================================␍
|
||||||
|
istream &operator >> (istream &is, Array &v) {␍
|
||||||
|
for(int l=0 ; l<v.getSize() ; l++)␍
|
||||||
|
is >> v[l];␍
|
||||||
|
return is;␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Operator overload␍
|
||||||
|
// Prints out an Array, using STDOUT␍
|
||||||
|
//================================================================␍
|
||||||
|
ostream &operator << (ostream &os, const Array &v) {␍
|
||||||
|
for(int k=0 ; k<v.getSize() ; k++)␍
|
||||||
|
os << v[k];␍
|
||||||
|
return os;␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Function getSize()␍
|
||||||
|
// Returns the size of the Array␍
|
||||||
|
//================================================================␍
|
||||||
|
int Array::getSize() const{␍
|
||||||
|
return size;␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
//##################################################################␍
|
||||||
|
// LAB 5␍
|
||||||
|
// ADVANCED PROGRAMMING IN C++␍
|
||||||
|
// MATRIX/ARRAY WITH TRY-CATCH␍
|
||||||
|
//==================================================================␍
|
||||||
|
// except.h␍
|
||||||
|
// CLASS IMPLEMENTATION AND DEFINITION FOR␍
|
||||||
|
// ALL ERRORS␍
|
||||||
|
// Christian Ohlsson␍
|
||||||
|
// Daniel Alfredsson␍
|
||||||
|
// Karlstad 990927␍
|
||||||
|
//==================================================================␍
|
||||||
|
␍
|
||||||
|
#ifndef _EXCEPT_H_␍
|
||||||
|
#define _EXCEPT_H_␍
|
||||||
|
#include <iostream.h>␍
|
||||||
|
␍
|
||||||
|
class Error{␍
|
||||||
|
public:␍
|
||||||
|
virtual void Print() = 0;␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
class RangeError:public Error{␍
|
||||||
|
public:␍
|
||||||
|
RangeError() {};␍
|
||||||
|
void Print() { cout<<"Index out of range.\n"; }␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
class MemoryError:public Error{␍
|
||||||
|
public:␍
|
||||||
|
MemoryError() {};␍
|
||||||
|
void Print() { cout<<"Could not create object.\n"; }␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
class SizeError:public Error{␍
|
||||||
|
public:␍
|
||||||
|
SizeError() {};␍
|
||||||
|
void Print() { cout<<"Size doesnt match.\n"; }␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
#endif
|
||||||
+112
@@ -0,0 +1,112 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="Lab5" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=Lab5 - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "Lab5.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "Lab5.mak" CFG="Lab5 - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "Lab5 - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "Lab5 - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "Lab5 - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD BASE RSC /l 0x41d /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x41d /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "Lab5 - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0x41d /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x41d /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "Lab5 - Win32 Release"
|
||||||
|
# Name "Lab5 - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\matrix.cpp
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\array.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\except.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\matrix.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "Lab5"=".\Lab5.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
//matrix.cpp␍
|
||||||
|
#include "matrix.h"␍
|
||||||
|
int main() {␍
|
||||||
|
Array a(2); //Sätt till 3 om du vill ha SizeError␍
|
||||||
|
Matrix b (2,2);␍
|
||||||
|
cout << "input Array: " << endl;␍
|
||||||
|
cin>>a;␍
|
||||||
|
cout << "input Matrix: " << endl;␍
|
||||||
|
cin >>b;␍
|
||||||
|
␍
|
||||||
|
try {␍
|
||||||
|
// b[2] = a; //Ta med om du vill ha RangeError␍
|
||||||
|
b[1] = a + b[1];␍
|
||||||
|
} catch(Error &e) { e.Print(); }␍
|
||||||
|
␍
|
||||||
|
Matrix c(b);␍
|
||||||
|
␍
|
||||||
|
try {␍
|
||||||
|
b[1][1] = a[1];␍
|
||||||
|
} catch(Error &e) { e.Print(); }␍
|
||||||
|
␍
|
||||||
|
cout << "c:\n" <<c << "a:\n"<< a << "\nb:\n" << b;␍
|
||||||
|
return 0;␍
|
||||||
|
}␍
|
||||||
+120
@@ -0,0 +1,120 @@
|
|||||||
|
//##################################################################␍
|
||||||
|
// LAB 5␍
|
||||||
|
// ADVANCED PROGRAMMING IN C++␍
|
||||||
|
// MATRIX/ARRAY WITH TRY-CATCH␍
|
||||||
|
//==================================================================␍
|
||||||
|
// matrix.h␍
|
||||||
|
// CLASS IMPLEMENTATION AND DEFINITION FOR␍
|
||||||
|
// THE MATRIX␍
|
||||||
|
// Christian Ohlsson␍
|
||||||
|
// Daniel Alfredsson␍
|
||||||
|
// Karlstad 990907␍
|
||||||
|
//==================================================================␍
|
||||||
|
␍
|
||||||
|
#include <stdlib.h>␍
|
||||||
|
#include "except.h"␍
|
||||||
|
#include "array.h"␍
|
||||||
|
␍
|
||||||
|
class Matrix {␍
|
||||||
|
private:␍
|
||||||
|
int cols, rows; //# of cols and rows in the matrix␍
|
||||||
|
Array *myMatrix; //Array-pointer to our matrix␍
|
||||||
|
public:␍
|
||||||
|
void Matrix::operator = (const Matrix &src); ␍
|
||||||
|
int getCols() const { return cols;};␍
|
||||||
|
int getRows() const { return rows;};␍
|
||||||
|
Array &Matrix::operator [] (int index) const;␍
|
||||||
|
Matrix(const Matrix &src);␍
|
||||||
|
Matrix(int cols, int rows);␍
|
||||||
|
~Matrix();␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
//################################################################␍
|
||||||
|
// Constructor␍
|
||||||
|
// Creates a new Matrix with 'c' columns and 'r' rows ␍
|
||||||
|
//================================================================␍
|
||||||
|
Matrix::Matrix(int c, int r) {␍
|
||||||
|
try {␍
|
||||||
|
myMatrix = new Array[r];␍
|
||||||
|
}catch(MemoryError &e){ e.Print(); }␍
|
||||||
|
␍
|
||||||
|
for(int i=0; i < c; i++)␍
|
||||||
|
myMatrix[i] = Array(c);␍
|
||||||
|
cols = c;␍
|
||||||
|
rows = r;␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Constructor␍
|
||||||
|
// Creates a new copy of a Matrix ␍
|
||||||
|
//================================================================␍
|
||||||
|
Matrix::Matrix(const Matrix &src) {␍
|
||||||
|
cols = src.cols;␍
|
||||||
|
rows = src.rows;␍
|
||||||
|
int i,j;␍
|
||||||
|
try {␍
|
||||||
|
myMatrix = new Array[rows];␍
|
||||||
|
}catch(MemoryError &e){ e.Print(); }␍
|
||||||
|
␍
|
||||||
|
for(i=0; i < cols; i++)␍
|
||||||
|
myMatrix[i] = Array(cols);␍
|
||||||
|
for(i=0 ; i < cols ; i++)␍
|
||||||
|
for(j=0 ; j < rows ; j++)␍
|
||||||
|
myMatrix[i][j] = src.myMatrix[i][j];␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Destructor␍
|
||||||
|
// De-allocates memory for a Matrix␍
|
||||||
|
//================================================================␍
|
||||||
|
Matrix::~Matrix() {␍
|
||||||
|
delete [] myMatrix;␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Operator overload␍
|
||||||
|
// Sets one Matrix equal to another␍
|
||||||
|
//================================================================␍
|
||||||
|
void Matrix::operator = (const Matrix &src) {␍
|
||||||
|
delete [] myMatrix;␍
|
||||||
|
cols = src.cols;␍
|
||||||
|
rows = src.rows;␍
|
||||||
|
try {␍
|
||||||
|
myMatrix = new Array[rows];␍
|
||||||
|
}catch(MemoryError &e){ e.Print(); }␍
|
||||||
|
␍
|
||||||
|
for(int i=0 ; i<cols ; i++)␍
|
||||||
|
for(int j=0 ; j<rows ; j++)␍
|
||||||
|
myMatrix[i][j] = src.myMatrix[i][j];␍
|
||||||
|
}//################################################################␍
|
||||||
|
// Operator overload␍
|
||||||
|
// Reyurns a row in a Matrix, and checks for bad indexes.␍
|
||||||
|
//================================================================␍
|
||||||
|
Array &Matrix::operator [] (int index) const {␍
|
||||||
|
if(index>=rows || index<0) ␍
|
||||||
|
throw RangeError();␍
|
||||||
|
return myMatrix[index];␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Operator overload␍
|
||||||
|
// Allow inserts in a Matrix, using STDIN␍
|
||||||
|
//================================================================␍
|
||||||
|
istream &operator >> (istream &is, Matrix &v) {␍
|
||||||
|
int i,j;␍
|
||||||
|
for(i=0 ; i<v.getCols() ; i++)␍
|
||||||
|
for (j=0 ; j<v.getRows() ; j++)␍
|
||||||
|
is >> v[i][j];␍
|
||||||
|
return is;␍
|
||||||
|
}␍
|
||||||
|
//################################################################␍
|
||||||
|
// Operator overload␍
|
||||||
|
// Prints the Matrix on the screen, using STDUOT␍
|
||||||
|
//================================================================␍
|
||||||
|
ostream &operator << (ostream &os, const Matrix &v) {␍
|
||||||
|
int i,j;␍
|
||||||
|
for(i=0 ; i < v.getCols() ; i++)␍
|
||||||
|
for(j=0 ; j < v.getRows() ; j++)␍
|
||||||
|
os << i << "," << j<< " = " << v[i][j] << "\n";␍
|
||||||
|
return os;␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
+7910
File diff suppressed because it is too large.
Load diff
+105
@@ -0,0 +1,105 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Circle; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: Circle.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Circle␍
|
||||||
|
#include "Circle.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class Circle ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Circle::Circle()␍
|
||||||
|
//## begin Circle::Circle%.hasinit preserve=no␍
|
||||||
|
//## end Circle::Circle%.hasinit␍
|
||||||
|
//## begin Circle::Circle%.initialization preserve=yes␍
|
||||||
|
//## end Circle::Circle%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle::Circle%.body preserve=yes␍
|
||||||
|
//## end Circle::Circle%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
Circle::Circle (int x, int y, int r, Color color)␍
|
||||||
|
//## begin Circle::Circle%939623931.hasinit preserve=no␍
|
||||||
|
//## end Circle::Circle%939623931.hasinit␍
|
||||||
|
//## begin Circle::Circle%939623931.initialization preserve=yes␍
|
||||||
|
//## end Circle::Circle%939623931.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle::Circle%939623931.body preserve=yes␍
|
||||||
|
setColor(color);␍
|
||||||
|
center.setx(x);␍
|
||||||
|
center.sety(y);␍
|
||||||
|
radius=r;␍
|
||||||
|
//## end Circle::Circle%939623931.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Circle::~Circle()␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle::~Circle%.body preserve=yes␍
|
||||||
|
//## end Circle::~Circle%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
void Circle::draw (Graphics &g)␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle::draw%937398670.body preserve=yes␍
|
||||||
|
g.drawCircle(center, radius, getColor());␍
|
||||||
|
//## end Circle::draw%937398670.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Circle::erase (Graphics &g)␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle::erase%937398671.body preserve=yes␍
|
||||||
|
setColor(g.getBGColor());␍
|
||||||
|
draw(g);␍
|
||||||
|
//## end Circle::erase%937398671.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
Figure * Circle::clone ()␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle::clone%937398683.body preserve=yes␍
|
||||||
|
return new Circle(*this);␍
|
||||||
|
//## end Circle::clone%937398683.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin Circle.declarations preserve=yes␍
|
||||||
|
//## end Circle.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Detached code regions:␍
|
||||||
|
// WARNING: this code will be lost if code is regenerated.␍
|
||||||
|
#if 0␍
|
||||||
|
//## begin Circle::getColor%939797853.body preserve=no␍
|
||||||
|
return color;␍
|
||||||
|
//## end Circle::getColor%939797853.body␍
|
||||||
|
␍
|
||||||
|
//## begin Circle::setColor%939797854.body preserve=no␍
|
||||||
|
color=src;␍
|
||||||
|
␍
|
||||||
|
//## end Circle::setColor%939797854.body␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
+116
@@ -0,0 +1,116 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Circle; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: Circle.h␍
|
||||||
|
␍
|
||||||
|
#ifndef Circle_h␍
|
||||||
|
#define Circle_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Point␍
|
||||||
|
#include "Point.h"␍
|
||||||
|
// Figure␍
|
||||||
|
#include "Figure.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: Circle␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
class Circle : virtual public Figure //## Inherits: <unnamed>␍
|
||||||
|
{␍
|
||||||
|
//## begin Circle.initialDeclarations preserve=yes␍
|
||||||
|
//## end Circle.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
Circle();␍
|
||||||
|
␍
|
||||||
|
//## Constructors (specified)␍
|
||||||
|
//## Operation: Circle%939623931␍
|
||||||
|
Circle (int x, int y, int r, Color color);␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~Circle();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: draw%937398670␍
|
||||||
|
void draw (Graphics &g);␍
|
||||||
|
␍
|
||||||
|
//## Operation: erase%937398671␍
|
||||||
|
void erase (Graphics &g);␍
|
||||||
|
␍
|
||||||
|
//## Operation: clone%937398683␍
|
||||||
|
Figure * clone ();␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin Circle.public preserve=yes␍
|
||||||
|
const Point& getCenter() const {return center;}␍
|
||||||
|
void setCenter(int x, int y){center.setx(x), center.sety(y);}␍
|
||||||
|
const int getRad() const {return radius;}␍
|
||||||
|
void setRad(int value) { radius=value;}␍
|
||||||
|
Color getColor() {return Figure::getColor();}␍
|
||||||
|
void setColor(Color c) {Figure::setColor(c);}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## end Circle.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin Circle.protected preserve=yes␍
|
||||||
|
//## end Circle.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin Circle.private preserve=yes␍
|
||||||
|
//## end Circle.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Has Relationships␍
|
||||||
|
␍
|
||||||
|
//## Documentation Circle::center.has␍
|
||||||
|
//## begin Circle::center.has preserve=no private: Point {1 -> 1VO}␍
|
||||||
|
Point center;␍
|
||||||
|
//## end Circle::center.has␍
|
||||||
|
␍
|
||||||
|
// Data Members for Class Attributes␍
|
||||||
|
␍
|
||||||
|
//## Attribute: radius␍
|
||||||
|
//## begin Circle::radius.attr preserve=no private: int {U} ␍
|
||||||
|
int radius;␍
|
||||||
|
//## end Circle::radius.attr␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin Circle.implementation preserve=yes␍
|
||||||
|
//## end Circle.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin Circle.postscript preserve=yes␍
|
||||||
|
//## end Circle.postscript␍
|
||||||
|
␍
|
||||||
|
// Class Circle ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: ComplexFigure; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: CmplxFgr.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// ComplexFigure␍
|
||||||
|
#include "CmplxFgr.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
#include "Graphics.h"␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class ComplexFigure ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
ComplexFigure::ComplexFigure()␍
|
||||||
|
//## begin ComplexFigure::ComplexFigure%.hasinit preserve=no␍
|
||||||
|
//## end ComplexFigure::ComplexFigure%.hasinit␍
|
||||||
|
//## begin ComplexFigure::ComplexFigure%.initialization preserve=yes␍
|
||||||
|
//## end ComplexFigure::ComplexFigure%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure::ComplexFigure%.body preserve=yes␍
|
||||||
|
//## end ComplexFigure::ComplexFigure%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
ComplexFigure::~ComplexFigure()␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure::~ComplexFigure%.body preserve=yes␍
|
||||||
|
//## end ComplexFigure::~ComplexFigure%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
void ComplexFigure::draw (Graphics &g)␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure::draw%939104770.body preserve=yes␍
|
||||||
|
for(int i = 0; i < myFList.getSize(); i++)␍
|
||||||
|
{␍
|
||||||
|
FigureHolder fh = myFList.getItem(i);␍
|
||||||
|
Figure* f = fh.getFigure();␍
|
||||||
|
f->draw(g);␍
|
||||||
|
}␍
|
||||||
|
//## end ComplexFigure::draw%939104770.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void ComplexFigure::erase (Graphics &g)␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure::erase%939104771.body preserve=yes␍
|
||||||
|
//## end ComplexFigure::erase%939104771.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
Figure * ComplexFigure::clone ()␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure::clone%939104772.body preserve=yes␍
|
||||||
|
return new ComplexFigure(*this);␍
|
||||||
|
//## end ComplexFigure::clone%939104772.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void ComplexFigure::add (FigureHolder figure)␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure::add%939734506.body preserve=yes␍
|
||||||
|
myFList.add(myFList.getSize(), figure);␍
|
||||||
|
//## end ComplexFigure::add%939734506.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin ComplexFigure.declarations preserve=yes␍
|
||||||
|
//## end ComplexFigure.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
+100
@@ -0,0 +1,100 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: ComplexFigure; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: CmplxFgr.h␍
|
||||||
|
␍
|
||||||
|
#ifndef CmplxFgr_h␍
|
||||||
|
#define CmplxFgr_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Figure␍
|
||||||
|
#include "Figure.h"␍
|
||||||
|
// FList␍
|
||||||
|
#include "FList.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: ComplexFigure␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
class ComplexFigure : public Figure //## Inherits: <unnamed>␍
|
||||||
|
{␍
|
||||||
|
//## begin ComplexFigure.initialDeclarations preserve=yes␍
|
||||||
|
//## end ComplexFigure.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
ComplexFigure();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~ComplexFigure();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: draw%939104770␍
|
||||||
|
void draw (Graphics &g);␍
|
||||||
|
␍
|
||||||
|
//## Operation: erase%939104771␍
|
||||||
|
void erase (Graphics &g);␍
|
||||||
|
␍
|
||||||
|
//## Operation: clone%939104772␍
|
||||||
|
Figure * clone ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: add%939734506␍
|
||||||
|
void add (FigureHolder figure);␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin ComplexFigure.public preserve=yes␍
|
||||||
|
//## end ComplexFigure.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin ComplexFigure.protected preserve=yes␍
|
||||||
|
//## end ComplexFigure.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin ComplexFigure.private preserve=yes␍
|
||||||
|
//## end ComplexFigure.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Has Relationships␍
|
||||||
|
␍
|
||||||
|
//## Documentation ComplexFigure::myFList.has␍
|
||||||
|
//## begin ComplexFigure::myFList.has preserve=no public: FList {1 -> 1VO}␍
|
||||||
|
FList myFList;␍
|
||||||
|
//## end ComplexFigure::myFList.has␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin ComplexFigure.implementation preserve=yes␍
|
||||||
|
//## end ComplexFigure.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin ComplexFigure.postscript preserve=yes␍
|
||||||
|
//## end ComplexFigure.postscript␍
|
||||||
|
␍
|
||||||
|
// Class ComplexFigure ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: DebugGraphics; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: DbgGrphc.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// DebugGraphics␍
|
||||||
|
#include "DbgGrphc.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class DebugGraphics ␍
|
||||||
|
␍
|
||||||
|
DebugGraphics::DebugGraphics()␍
|
||||||
|
//## begin DebugGraphics::DebugGraphics%.hasinit preserve=no␍
|
||||||
|
//## end DebugGraphics::DebugGraphics%.hasinit␍
|
||||||
|
//## begin DebugGraphics::DebugGraphics%.initialization preserve=yes␍
|
||||||
|
//## end DebugGraphics::DebugGraphics%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin DebugGraphics::DebugGraphics%.body preserve=yes␍
|
||||||
|
//## end DebugGraphics::DebugGraphics%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
DebugGraphics::~DebugGraphics()␍
|
||||||
|
{␍
|
||||||
|
//## begin DebugGraphics::~DebugGraphics%.body preserve=yes␍
|
||||||
|
//## end DebugGraphics::~DebugGraphics%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
void DebugGraphics::drawCircle ()␍
|
||||||
|
{␍
|
||||||
|
//## begin DebugGraphics::drawCircle%938586296.body preserve=yes␍
|
||||||
|
//## end DebugGraphics::drawCircle%938586296.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void DebugGraphics::drawRectangle ()␍
|
||||||
|
{␍
|
||||||
|
//## begin DebugGraphics::drawRectangle%938586297.body preserve=yes␍
|
||||||
|
//## end DebugGraphics::drawRectangle%938586297.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void DebugGraphics::drawLine ()␍
|
||||||
|
{␍
|
||||||
|
//## begin DebugGraphics::drawLine%938586298.body preserve=yes␍
|
||||||
|
//## end DebugGraphics::drawLine%938586298.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin DebugGraphics.declarations preserve=yes␍
|
||||||
|
//## end DebugGraphics.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: DebugGraphics; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: DbgGrphc.h␍
|
||||||
|
␍
|
||||||
|
#ifndef DbgGrphc_h␍
|
||||||
|
#define DbgGrphc_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Graphics␍
|
||||||
|
#include "Graphics.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
#include "DbgGrphc.h"␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: DebugGraphics␍
|
||||||
|
//## Category: Graphic␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
class DebugGraphics : public Graphics //## Inherits: <unnamed>␍
|
||||||
|
{␍
|
||||||
|
//## begin DebugGraphics.initialDeclarations preserve=yes␍
|
||||||
|
//## end DebugGraphics.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
DebugGraphics();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~DebugGraphics();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: drawCircle%938586296␍
|
||||||
|
void drawCircle ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: drawRectangle%938586297␍
|
||||||
|
void drawRectangle ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: drawLine%938586298␍
|
||||||
|
void drawLine ();␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin DebugGraphics.public preserve=yes␍
|
||||||
|
//## end DebugGraphics.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin DebugGraphics.protected preserve=yes␍
|
||||||
|
//## end DebugGraphics.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin DebugGraphics.private preserve=yes␍
|
||||||
|
//## end DebugGraphics.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin DebugGraphics.implementation preserve=yes␍
|
||||||
|
//## end DebugGraphics.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin DebugGraphics.postscript preserve=yes␍
|
||||||
|
//## end DebugGraphics.postscript␍
|
||||||
|
␍
|
||||||
|
// Class DebugGraphics ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: FigureHolder; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: FgrHlder.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// FigureHolder␍
|
||||||
|
#include "FgrHlder.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class FigureHolder ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
FigureHolder::FigureHolder()␍
|
||||||
|
//## begin FigureHolder::FigureHolder%.hasinit preserve=no␍
|
||||||
|
//## end FigureHolder::FigureHolder%.hasinit␍
|
||||||
|
//## begin FigureHolder::FigureHolder%.initialization preserve=yes␍
|
||||||
|
//## end FigureHolder::FigureHolder%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin FigureHolder::FigureHolder%.body preserve=yes␍
|
||||||
|
//## end FigureHolder::FigureHolder%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
FigureHolder::~FigureHolder()␍
|
||||||
|
{␍
|
||||||
|
//## begin FigureHolder::~FigureHolder%.body preserve=yes␍
|
||||||
|
//## end FigureHolder::~FigureHolder%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
Figure * FigureHolder::getFigure ()␍
|
||||||
|
{␍
|
||||||
|
//## begin FigureHolder::getFigure%939734505.body preserve=yes␍
|
||||||
|
return myFigure;␍
|
||||||
|
//## end FigureHolder::getFigure%939734505.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin FigureHolder.declarations preserve=yes␍
|
||||||
|
//## end FigureHolder.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: FigureHolder; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: FgrHlder.h␍
|
||||||
|
␍
|
||||||
|
#ifndef FgrHlder_h␍
|
||||||
|
#define FgrHlder_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Figure␍
|
||||||
|
#include "Figure.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: FigureHolder␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
class FigureHolder ␍
|
||||||
|
{␍
|
||||||
|
//## begin FigureHolder.initialDeclarations preserve=yes␍
|
||||||
|
public:␍
|
||||||
|
FigureHolder(Figure& f) ␍
|
||||||
|
{␍
|
||||||
|
myFigure = f.clone();␍
|
||||||
|
}␍
|
||||||
|
//## end FigureHolder.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
FigureHolder();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~FigureHolder();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: getFigure%939734505␍
|
||||||
|
Figure * getFigure ();␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin FigureHolder.public preserve=yes␍
|
||||||
|
//## end FigureHolder.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin FigureHolder.protected preserve=yes␍
|
||||||
|
//## end FigureHolder.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin FigureHolder.private preserve=yes␍
|
||||||
|
//## end FigureHolder.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Has Relationships␍
|
||||||
|
␍
|
||||||
|
//## Documentation FigureHolder::myFigure.has␍
|
||||||
|
//## begin FigureHolder::myFigure.has preserve=no public: Figure {1 -> 1RO}␍
|
||||||
|
Figure *myFigure;␍
|
||||||
|
//## end FigureHolder::myFigure.has␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin FigureHolder.implementation preserve=yes␍
|
||||||
|
//## end FigureHolder.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin FigureHolder.postscript preserve=yes␍
|
||||||
|
//## end FigureHolder.postscript␍
|
||||||
|
␍
|
||||||
|
// Class FigureHolder ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Figure; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: Figure.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Figure␍
|
||||||
|
#include "Figure.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class Figure ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Figure::Figure()␍
|
||||||
|
//## begin Figure::Figure%.hasinit preserve=no␍
|
||||||
|
//## end Figure::Figure%.hasinit␍
|
||||||
|
//## begin Figure::Figure%.initialization preserve=yes␍
|
||||||
|
//## end Figure::Figure%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Figure::Figure%.body preserve=yes␍
|
||||||
|
//## end Figure::Figure%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Figure::~Figure()␍
|
||||||
|
{␍
|
||||||
|
//## begin Figure::~Figure%.body preserve=yes␍
|
||||||
|
//## end Figure::~Figure%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
Color Figure::getColor ()␍
|
||||||
|
{␍
|
||||||
|
//## begin Figure::getColor%939623933.body preserve=yes␍
|
||||||
|
return color;␍
|
||||||
|
//## end Figure::getColor%939623933.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Figure::setColor (Color c)␍
|
||||||
|
{␍
|
||||||
|
//## begin Figure::setColor%939623934.body preserve=yes␍
|
||||||
|
color=c;␍
|
||||||
|
//## end Figure::setColor%939623934.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin Figure.declarations preserve=yes␍
|
||||||
|
//## end Figure.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
+103
@@ -0,0 +1,103 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Figure; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: Figure.h␍
|
||||||
|
␍
|
||||||
|
#ifndef Figure_h␍
|
||||||
|
#define Figure_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Graphics␍
|
||||||
|
#include "Graphics.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: Figure; Abstract␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
//## Uses: <unnamed>; Graphics { -> }␍
|
||||||
|
␍
|
||||||
|
class Figure ␍
|
||||||
|
{␍
|
||||||
|
//## begin Figure.initialDeclarations preserve=yes␍
|
||||||
|
//## end Figure.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
Figure();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
virtual ~Figure();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: draw%937398679␍
|
||||||
|
virtual void draw (Graphics &g) = 0;␍
|
||||||
|
␍
|
||||||
|
//## Operation: erase%937398680␍
|
||||||
|
virtual void erase (Graphics &g) = 0;␍
|
||||||
|
␍
|
||||||
|
//## Operation: clone%937398681␍
|
||||||
|
virtual Figure * clone () = 0;␍
|
||||||
|
␍
|
||||||
|
//## Operation: getColor%939623933␍
|
||||||
|
Color getColor ();␍
|
||||||
|
␍
|
||||||
|
//## Operation: setColor%939623934␍
|
||||||
|
void setColor (Color c);␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin Figure.public preserve=yes␍
|
||||||
|
//## end Figure.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin Figure.protected preserve=yes␍
|
||||||
|
//## end Figure.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin Figure.private preserve=yes␍
|
||||||
|
//## end Figure.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Data Members for Class Attributes␍
|
||||||
|
␍
|
||||||
|
//## Attribute: color␍
|
||||||
|
//## begin Figure::color.attr preserve=no private: Color {U} ␍
|
||||||
|
Color color;␍
|
||||||
|
//## end Figure::color.attr␍
|
||||||
|
␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin Figure.implementation preserve=yes␍
|
||||||
|
//## end Figure.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin Figure.postscript preserve=yes␍
|
||||||
|
//## end Figure.postscript␍
|
||||||
|
␍
|
||||||
|
// Class Figure ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: FList; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: FList.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// FList␍
|
||||||
|
#include "FList.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin FList.instantiation preserve=no␍
|
||||||
|
template class List< FigureHolder >;␍
|
||||||
|
//## end FList.instantiation␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: FList; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: FList.h␍
|
||||||
|
␍
|
||||||
|
#ifndef FList_h␍
|
||||||
|
#define FList_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// List␍
|
||||||
|
#include "List.h"␍
|
||||||
|
// FigureHolder␍
|
||||||
|
#include "FgrHlder.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: FList; Instantiated Class␍
|
||||||
|
//## Category: Figures␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
//## Uses: <unnamed>; FigureHolder { -> }␍
|
||||||
|
␍
|
||||||
|
typedef List< FigureHolder > FList;␍
|
||||||
|
␍
|
||||||
|
//## begin FList.postscript preserve=yes␍
|
||||||
|
//## end FList.postscript␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: fstream; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab6\fstream.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// fstream␍
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab6\fstream.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class fstream ␍
|
||||||
|
␍
|
||||||
|
fstream::fstream()␍
|
||||||
|
//## begin fstream::fstream%.hasinit preserve=no␍
|
||||||
|
//## end fstream::fstream%.hasinit␍
|
||||||
|
//## begin fstream::fstream%.initialization preserve=yes␍
|
||||||
|
//## end fstream::fstream%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin fstream::fstream%.body preserve=yes␍
|
||||||
|
//## end fstream::fstream%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
fstream::~fstream()␍
|
||||||
|
{␍
|
||||||
|
//## begin fstream::~fstream%.body preserve=yes␍
|
||||||
|
//## end fstream::~fstream%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin fstream.declarations preserve=yes␍
|
||||||
|
//## end fstream.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: fstream; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab6\fstream.h␍
|
||||||
|
␍
|
||||||
|
#ifndef fstream_h␍
|
||||||
|
#define fstream_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: fstream␍
|
||||||
|
//## Category: Persist␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
class fstream ␍
|
||||||
|
{␍
|
||||||
|
//## begin fstream.initialDeclarations preserve=yes␍
|
||||||
|
//## end fstream.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
fstream();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~fstream();␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin fstream.public preserve=yes␍
|
||||||
|
//## end fstream.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin fstream.protected preserve=yes␍
|
||||||
|
//## end fstream.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin fstream.private preserve=yes␍
|
||||||
|
//## end fstream.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin fstream.implementation preserve=yes␍
|
||||||
|
//## end fstream.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin fstream.postscript preserve=yes␍
|
||||||
|
//## end fstream.postscript␍
|
||||||
|
␍
|
||||||
|
// Class fstream ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Graphics; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: Graphics.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Graphics␍
|
||||||
|
#include "Graphics.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
#include <iostream.h>␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
// Class Graphics ␍
|
||||||
|
␍
|
||||||
|
Graphics::Graphics()␍
|
||||||
|
//## begin Graphics::Graphics%.hasinit preserve=no␍
|
||||||
|
//## end Graphics::Graphics%.hasinit␍
|
||||||
|
//## begin Graphics::Graphics%.initialization preserve=yes␍
|
||||||
|
//## end Graphics::Graphics%.initialization␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics::Graphics%.body preserve=yes␍
|
||||||
|
//## end Graphics::Graphics%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
Graphics::~Graphics()␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics::~Graphics%.body preserve=yes␍
|
||||||
|
//## end Graphics::~Graphics%.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (implementation)␍
|
||||||
|
void Graphics::drawCircle (Point center, int radius, Color color)␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics::drawCircle%938436810.body preserve=yes␍
|
||||||
|
cout << "\nCircle drawn with ("<<center.getx()<<","<<center.gety()<<") ,radius="<<radius<<" , color="<<color;␍
|
||||||
|
//## end Graphics::drawCircle%938436810.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Graphics::drawRectangle (Point leftTop, Point rightBottom, Color color)␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics::drawRectangle%938436812.body preserve=yes␍
|
||||||
|
cout << "\nRectangle drawn with ("<<leftTop.getx()<<","<<leftTop.gety()<<") to ("<<rightBottom.getx()<<","<<rightBottom.getx()<<"), color="<<color;␍
|
||||||
|
//## end Graphics::drawRectangle%938436812.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
void Graphics::drawLine (int x1, int y1, int x2, int y2, Color color)␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics::drawLine%938436813.body preserve=yes␍
|
||||||
|
cout << "\nLine drawn from ("<<x1<<","<<y1<<") to ("<<x2<<","<<y2<<"), color="<<color;␍
|
||||||
|
//## end Graphics::drawLine%938436813.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
Color Graphics::getBGColor ()␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics::getBGColor%939802930.body preserve=yes␍
|
||||||
|
return 0;␍
|
||||||
|
//## end Graphics::getBGColor%939802930.body␍
|
||||||
|
}␍
|
||||||
|
␍
|
||||||
|
// Additional Declarations␍
|
||||||
|
//## begin Graphics.declarations preserve=yes␍
|
||||||
|
//## end Graphics.declarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: Graphics; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: Graphics.h␍
|
||||||
|
␍
|
||||||
|
#ifndef Graphics_h␍
|
||||||
|
#define Graphics_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
#include "Point.h"␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// Point␍
|
||||||
|
#include "Point.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
typedef int Color;␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: Graphics; Abstract␍
|
||||||
|
//## Category: Graphic␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
//## Uses: <unnamed>; Point { -> }␍
|
||||||
|
␍
|
||||||
|
class Graphics ␍
|
||||||
|
{␍
|
||||||
|
//## begin Graphics.initialDeclarations preserve=yes␍
|
||||||
|
//## end Graphics.initialDeclarations␍
|
||||||
|
␍
|
||||||
|
public:␍
|
||||||
|
//## Constructors (generated)␍
|
||||||
|
Graphics();␍
|
||||||
|
␍
|
||||||
|
//## Destructor (generated)␍
|
||||||
|
~Graphics();␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Other Operations (specified)␍
|
||||||
|
//## Operation: drawCircle%938436810␍
|
||||||
|
void drawCircle (Point center, int radius, Color color);␍
|
||||||
|
␍
|
||||||
|
//## Operation: drawRectangle%938436812␍
|
||||||
|
void drawRectangle (Point leftTop, Point rightBottom, Color color);␍
|
||||||
|
␍
|
||||||
|
//## Operation: drawLine%938436813␍
|
||||||
|
void drawLine (int x1, int y1, int x2, int y2, Color color);␍
|
||||||
|
␍
|
||||||
|
//## Operation: getBGColor%939802930␍
|
||||||
|
Color getBGColor ();␍
|
||||||
|
␍
|
||||||
|
// Additional Public Declarations␍
|
||||||
|
//## begin Graphics.public preserve=yes␍
|
||||||
|
//## end Graphics.public␍
|
||||||
|
␍
|
||||||
|
protected:␍
|
||||||
|
// Additional Protected Declarations␍
|
||||||
|
//## begin Graphics.protected preserve=yes␍
|
||||||
|
//## end Graphics.protected␍
|
||||||
|
␍
|
||||||
|
private:␍
|
||||||
|
// Additional Private Declarations␍
|
||||||
|
//## begin Graphics.private preserve=yes␍
|
||||||
|
//## end Graphics.private␍
|
||||||
|
␍
|
||||||
|
private: //## implementation␍
|
||||||
|
// Additional Implementation Declarations␍
|
||||||
|
//## begin Graphics.implementation preserve=yes␍
|
||||||
|
//## end Graphics.implementation␍
|
||||||
|
␍
|
||||||
|
};␍
|
||||||
|
␍
|
||||||
|
//## begin Graphics.postscript preserve=yes␍
|
||||||
|
//## end Graphics.postscript␍
|
||||||
|
␍
|
||||||
|
// Class Graphics ␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
Pcircle::Pcircle(int xPos, int yPos, int _radius, Color _color)
|
||||||
|
//## begin Pcircle::Pcircle%.hasinit preserve=no
|
||||||
|
//## end Pcircle::Pcircle%.hasinit
|
||||||
|
//## begin Pcircle::Pcircle%.initialization preserve=yes
|
||||||
|
//## end Pcircle::Pcircle%.initialization
|
||||||
|
{
|
||||||
|
//## begin Pcircle::Pcircle%.body preserve=yes
|
||||||
|
// Circle::Circle(xPos, yPos, _radius, _color);
|
||||||
|
|
||||||
|
_pobj = Persistent::addType("Pcircle", new Pcircle);
|
||||||
|
set_center(xPos, yPos);
|
||||||
|
set_radius(_radius);
|
||||||
|
set_color(_color);
|
||||||
|
//## end Pcircle::Pcircle%.body
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: InstMap; Pseudo Package body␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: InstMap.cpp␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// InstMap␍
|
||||||
|
#include "InstMap.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin InstMap.instantiation preserve=no␍
|
||||||
|
template class Mapfake< Str,Persistent* >;␍
|
||||||
|
//## end InstMap.instantiation␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
//## begin module.cm preserve=no␍
|
||||||
|
// %X% %Q% %Z% %W%␍
|
||||||
|
//## end module.cm␍
|
||||||
|
␍
|
||||||
|
//## begin module.cp preserve=no␍
|
||||||
|
//## end module.cp␍
|
||||||
|
␍
|
||||||
|
//## Module: InstMap; Pseudo Package specification␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Source file: InstMap.h␍
|
||||||
|
␍
|
||||||
|
#ifndef InstMap_h␍
|
||||||
|
#define InstMap_h 1␍
|
||||||
|
␍
|
||||||
|
//## begin module.additionalIncludes preserve=no␍
|
||||||
|
//## end module.additionalIncludes␍
|
||||||
|
␍
|
||||||
|
//## begin module.includes preserve=yes␍
|
||||||
|
#include "str.h"␍
|
||||||
|
//## end module.includes␍
|
||||||
|
␍
|
||||||
|
// MapFake␍
|
||||||
|
#include "MapFake.h"␍
|
||||||
|
// Persistent␍
|
||||||
|
//#include "Prsstent.h"␍
|
||||||
|
//## begin module.additionalDeclarations preserve=yes␍
|
||||||
|
//## end module.additionalDeclarations␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## Class: InstMap; Instantiated Class␍
|
||||||
|
//## Category: Persist␍
|
||||||
|
//## Subsystem: Figures␍
|
||||||
|
//## Persistence: Transient␍
|
||||||
|
//## Cardinality/Multiplicity: n␍
|
||||||
|
␍
|
||||||
|
//## Uses: <unnamed>; Persistent { -> }␍
|
||||||
|
class Persistent;␍
|
||||||
|
typedef Mapfake< Str,Persistent* > InstMap;␍
|
||||||
|
␍
|
||||||
|
//## begin InstMap.postscript preserve=yes␍
|
||||||
|
//## end InstMap.postscript␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
//## begin module.epilog preserve=yes␍
|
||||||
|
//## end module.epilog␍
|
||||||
|
␍
|
||||||
|
␍
|
||||||
|
#endif␍
|
||||||
+272
@@ -0,0 +1,272 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="lab6" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=lab6 - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "lab6.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "lab6.mak" CFG="lab6 - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "lab6 - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "lab6 - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "lab6 - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD BASE RSC /l 0x41d /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x41d /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "lab6 - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /W1 /Gm /vmg /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0x41d /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x41d /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "lab6 - Win32 Release"
|
||||||
|
# Name "lab6 - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Circle.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\CmplxFgr.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\DbgGrphc.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\FgrHlder.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Figure.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\FList.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Graphics.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\InstMap.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Line.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\main.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Pcircle.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\PersFig.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Pline.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\pList.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Point.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Prctngle.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Prsstent.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\PsMap.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\PStream.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Rectngle.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Str.cpp
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Circle.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\CmplxFgr.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\DbgGrphc.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\FgrHlder.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Figure.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\FList.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Graphics.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\InstMap.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Line.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\List.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\MapFake.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Node.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Pcircle.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\PersFig.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Pline.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\pList.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Point.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Prctngle.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Prsstent.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\PsMap.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\PStream.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Rectngle.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\Str.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "lab6"=".\lab6.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
+120
@@ -0,0 +1,120 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: Line; Pseudo Package body
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: Line.cpp
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// Line
|
||||||
|
#include "Line.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
#include <iostream.h>
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
// Class Line
|
||||||
|
|
||||||
|
|
||||||
|
Line::Line (int x1, int y1, int x2, int y2, Color color)
|
||||||
|
//## begin Line::Line%939623930.hasinit preserve=no
|
||||||
|
//## end Line::Line%939623930.hasinit
|
||||||
|
//## begin Line::Line%939623930.initialization preserve=yes
|
||||||
|
//## end Line::Line%939623930.initialization
|
||||||
|
{
|
||||||
|
//## begin Line::Line%939623930.body preserve=yes
|
||||||
|
setColor(color);
|
||||||
|
|
||||||
|
Point start, end;
|
||||||
|
start.setx(x1);
|
||||||
|
start.sety(y1);
|
||||||
|
end.setx(x2);
|
||||||
|
end.sety(y2);
|
||||||
|
myPoints.add(myPoints.getSize(), start);
|
||||||
|
myPoints.add(myPoints.getSize(), end);
|
||||||
|
//## end Line::Line%939623930.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Line::~Line()
|
||||||
|
{
|
||||||
|
//## begin Line::~Line%.body preserve=yes
|
||||||
|
//## end Line::~Line%.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## Other Operations (implementation)
|
||||||
|
void Line::draw (Graphics &g)
|
||||||
|
{
|
||||||
|
//## begin Line::draw%937398668.body preserve=yes
|
||||||
|
Point start,end;
|
||||||
|
int i = 0;
|
||||||
|
if(!myPoints.isEmpty())
|
||||||
|
start = myPoints.getItem(i++);
|
||||||
|
while(i < myPoints.getSize())
|
||||||
|
{
|
||||||
|
end = myPoints.getItem(i++);
|
||||||
|
g.drawLine(start.getx(),start.gety(),end.getx(),end.gety(),getColor());
|
||||||
|
start = end;
|
||||||
|
}
|
||||||
|
//## end Line::draw%937398668.body
|
||||||
|
}
|
||||||
|
|
||||||
|
void Line::erase (Graphics &g)
|
||||||
|
{
|
||||||
|
//## begin Line::erase%937398669.body preserve=yes
|
||||||
|
setColor(g.getBGColor());
|
||||||
|
draw(g);
|
||||||
|
//## end Line::erase%937398669.body
|
||||||
|
}
|
||||||
|
|
||||||
|
Figure * Line::clone ()
|
||||||
|
{
|
||||||
|
//## begin Line::clone%937398682.body preserve=yes
|
||||||
|
return new Line(*this);
|
||||||
|
//## end Line::clone%937398682.body
|
||||||
|
}
|
||||||
|
|
||||||
|
void Line::add (int x, int y)
|
||||||
|
{
|
||||||
|
//## begin Line::add%939734504.body preserve=yes
|
||||||
|
Point start;
|
||||||
|
start.setx(x);
|
||||||
|
start.sety(y);
|
||||||
|
myPoints.add(myPoints.getSize(), start);
|
||||||
|
//## end Line::add%939734504.body
|
||||||
|
}
|
||||||
|
|
||||||
|
// Additional Declarations
|
||||||
|
//## begin Line.declarations preserve=yes
|
||||||
|
//## end Line.declarations
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
|
|
||||||
|
|
||||||
|
// Detached code regions:
|
||||||
|
// WARNING: this code will be lost if code is regenerated.
|
||||||
|
#if 0
|
||||||
|
//## begin Line::setColor%939797857.body preserve=no
|
||||||
|
color=src;
|
||||||
|
|
||||||
|
//## end Line::setColor%939797857.body
|
||||||
|
|
||||||
|
//## begin Line::getColor%939797858.body preserve=no
|
||||||
|
return color;
|
||||||
|
//## end Line::getColor%939797858.body
|
||||||
|
|
||||||
|
#endif
|
||||||
+102
@@ -0,0 +1,102 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: Line; Pseudo Package specification
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: Line.h
|
||||||
|
|
||||||
|
#ifndef Line_h
|
||||||
|
#define Line_h 1
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// pList
|
||||||
|
#include "pList.h"
|
||||||
|
// Figure
|
||||||
|
#include "Figure.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
//## Class: Line
|
||||||
|
//## Category: Figures
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Persistence: Transient
|
||||||
|
//## Cardinality/Multiplicity: n
|
||||||
|
|
||||||
|
class Line : public Figure //## Inherits: <unnamed>
|
||||||
|
{
|
||||||
|
//## begin Line.initialDeclarations preserve=yes
|
||||||
|
//## end Line.initialDeclarations
|
||||||
|
|
||||||
|
public:
|
||||||
|
//## Constructors (specified)
|
||||||
|
//## Operation: Line%939623930
|
||||||
|
Line (int x1, int y1, int x2, int y2, Color color);
|
||||||
|
Line(){};
|
||||||
|
|
||||||
|
//## Destructor (generated)
|
||||||
|
~Line();
|
||||||
|
|
||||||
|
|
||||||
|
//## Other Operations (specified)
|
||||||
|
//## Operation: draw%937398668
|
||||||
|
void draw (Graphics &g);
|
||||||
|
|
||||||
|
//## Operation: erase%937398669
|
||||||
|
void erase (Graphics &g);
|
||||||
|
|
||||||
|
//## Operation: clone%937398682
|
||||||
|
Figure * clone ();
|
||||||
|
|
||||||
|
//## Operation: add%939734504
|
||||||
|
void add (int x, int y);
|
||||||
|
|
||||||
|
// Additional Public Declarations
|
||||||
|
//## begin Line.public preserve=yes
|
||||||
|
//## end Line.public
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Additional Protected Declarations
|
||||||
|
//## begin Line.protected preserve=yes
|
||||||
|
//## end Line.protected
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Additional Private Declarations
|
||||||
|
//## begin Line.private preserve=yes
|
||||||
|
//## end Line.private
|
||||||
|
|
||||||
|
private: //## implementation
|
||||||
|
// Data Members for Has Relationships
|
||||||
|
|
||||||
|
//## Documentation Line::myPoints.has
|
||||||
|
//## begin Line::myPoints.has preserve=no private: pList {1 -> 1VO}
|
||||||
|
pList myPoints;
|
||||||
|
//## end Line::myPoints.has
|
||||||
|
|
||||||
|
// Additional Implementation Declarations
|
||||||
|
//## begin Line.implementation preserve=yes
|
||||||
|
//## end Line.implementation
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//## begin Line.postscript preserve=yes
|
||||||
|
//## end Line.postscript
|
||||||
|
|
||||||
|
// Class Line
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: List; Pseudo Package body
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: H:\WebDocs\skola\Avancerad_C++\Lab6\List.cpp
|
||||||
|
|
||||||
|
//## begin module. preserve=no
|
||||||
|
//## end module.
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// List
|
||||||
|
#include "H:\WebDocs\skola\Avancerad_C++\Lab6\List.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <iostream.h>
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
// Parameterized Class List
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
List<T>::List()
|
||||||
|
//## begin List::List%.hasinit preserve=no
|
||||||
|
: size(0)
|
||||||
|
//## end List::List%.hasinit
|
||||||
|
//## begin List::List%.initialization preserve=yes
|
||||||
|
//## end List::List%.initialization
|
||||||
|
{
|
||||||
|
//## begin List::List%.body preserve=yes
|
||||||
|
head=NULL;
|
||||||
|
//## end List::List%.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
List<T>::~List()
|
||||||
|
{
|
||||||
|
//## begin List::~List%.body preserve=yes
|
||||||
|
delete head;
|
||||||
|
//## end List::~List%.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## Other Operations (implementation)
|
||||||
|
template <class T>
|
||||||
|
void List<T>::add (int position, T item)
|
||||||
|
{
|
||||||
|
//## begin List::add%937398674.body preserve=yes
|
||||||
|
|
||||||
|
size++;
|
||||||
|
Node<T>* newPtr = new Node<T>(item);
|
||||||
|
|
||||||
|
if (position==0) {
|
||||||
|
newPtr->next=head;
|
||||||
|
head=newPtr;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Node<T>* prev=head;
|
||||||
|
for (int i=0;i<position-1;i++)
|
||||||
|
prev=prev->next;
|
||||||
|
newPtr->next=prev->next;
|
||||||
|
prev->next=newPtr;
|
||||||
|
}
|
||||||
|
//## end List::add%937398674.body
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void List<T>::del (int position)
|
||||||
|
{
|
||||||
|
//## begin List::del%937398675.body preserve=yes
|
||||||
|
Node<T>* trav=head;
|
||||||
|
Node<T>* cur;
|
||||||
|
size--;
|
||||||
|
if (position == 0) {
|
||||||
|
cur = head;
|
||||||
|
head = head -> next;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (int i=0 ; i<position-1 ; i++)
|
||||||
|
trav = trav -> next;
|
||||||
|
cur = trav -> next;
|
||||||
|
trav -> next = cur ->next;
|
||||||
|
}
|
||||||
|
cur -> next = NULL;
|
||||||
|
delete cur;
|
||||||
|
cur = NULL;
|
||||||
|
|
||||||
|
//## end List::del%937398675.body
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
bool List<T>::isEmpty ()
|
||||||
|
{
|
||||||
|
//## begin List::isEmpty%937398676.body preserve=yes
|
||||||
|
return (size==0);
|
||||||
|
//## end List::isEmpty%937398676.body
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
int List<T>::getSize ()
|
||||||
|
{
|
||||||
|
//## begin List::getSize%937398677.body preserve=yes
|
||||||
|
return size;
|
||||||
|
//## end List::getSize%937398677.body
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
T List<T>::getItem (int position)
|
||||||
|
{
|
||||||
|
//## begin List::getItem%937398678.body preserve=yes
|
||||||
|
Node<T>* cur=head;
|
||||||
|
for(int i=0 ; i<position ; i++)
|
||||||
|
cur=cur->next;
|
||||||
|
return (cur->data);
|
||||||
|
|
||||||
|
//## end List::getItem%937398678.body
|
||||||
|
}
|
||||||
|
|
||||||
|
// Additional Declarations
|
||||||
|
//## begin List.declarations preserve=yes
|
||||||
|
//## end List.declarations
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
+111
@@ -0,0 +1,111 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: List; Pseudo Package specification
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: List.h
|
||||||
|
|
||||||
|
#ifndef List_h
|
||||||
|
#define List_h 1
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// Node
|
||||||
|
#include "Node.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
//## Class: List; Parameterized Class
|
||||||
|
//## Category: Figures
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Persistence: Transient
|
||||||
|
//## Cardinality/Multiplicity: n
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class List
|
||||||
|
{
|
||||||
|
//## begin List.initialDeclarations preserve=yes
|
||||||
|
//## end List.initialDeclarations
|
||||||
|
|
||||||
|
public:
|
||||||
|
//## Constructors (generated)
|
||||||
|
List();
|
||||||
|
|
||||||
|
//## Destructor (generated)
|
||||||
|
~List();
|
||||||
|
|
||||||
|
|
||||||
|
//## Other Operations (specified)
|
||||||
|
//## Operation: add%937398674
|
||||||
|
// Denna sätter in grejjer i listan...
|
||||||
|
void add (int position, T item);
|
||||||
|
|
||||||
|
//## Operation: del%937398675
|
||||||
|
void del (int position);
|
||||||
|
|
||||||
|
//## Operation: isEmpty%937398676
|
||||||
|
bool isEmpty ();
|
||||||
|
|
||||||
|
//## Operation: getSize%937398677
|
||||||
|
int getSize ();
|
||||||
|
|
||||||
|
//## Operation: getItem%937398678
|
||||||
|
T getItem (int position);
|
||||||
|
|
||||||
|
// Additional Public Declarations
|
||||||
|
//## begin List.public preserve=yes
|
||||||
|
//## end List.public
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Additional Protected Declarations
|
||||||
|
//## begin List.protected preserve=yes
|
||||||
|
//## end List.protected
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Additional Private Declarations
|
||||||
|
//## begin List.private preserve=yes
|
||||||
|
//## end List.private
|
||||||
|
|
||||||
|
private: //## implementation
|
||||||
|
// Data Members for Has Relationships
|
||||||
|
|
||||||
|
//## Documentation List::head.has
|
||||||
|
//## begin List::head.has preserve=yes private: Node {1 -> 1RO}
|
||||||
|
Node<T> *head;
|
||||||
|
//## end List::head.has
|
||||||
|
|
||||||
|
// Data Members for Class Attributes
|
||||||
|
|
||||||
|
//## Attribute: size
|
||||||
|
//## begin List::size.attr preserve=no private: int {U} 0
|
||||||
|
int size;
|
||||||
|
//## end List::size.attr
|
||||||
|
|
||||||
|
// Additional Implementation Declarations
|
||||||
|
//## begin List.implementation preserve=yes
|
||||||
|
//## end List.implementation
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//## begin List.postscript preserve=yes
|
||||||
|
//## end List.postscript
|
||||||
|
|
||||||
|
// Parameterized Class List
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
#include "list.cpp"
|
||||||
|
//## end module.epilog
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
//#
|
||||||
|
//# main.c
|
||||||
|
//#
|
||||||
|
//# =======================================================
|
||||||
|
//# Lab i Avacerad C++
|
||||||
|
//# 4. Figures
|
||||||
|
//#
|
||||||
|
//#
|
||||||
|
//# Christian Ohlsson
|
||||||
|
//# Daniel Alfredsson
|
||||||
|
//# Karlstads universitet
|
||||||
|
//# 991013
|
||||||
|
//# =======================================================
|
||||||
|
|
||||||
|
|
||||||
|
#include <iostream.h>
|
||||||
|
#include "Graphics.h"
|
||||||
|
#include "line.h"
|
||||||
|
#include "rectngle.h"
|
||||||
|
#include "circle.h"
|
||||||
|
#include "flist.h"
|
||||||
|
#include "CmplxFgr.h"
|
||||||
|
#include "pstream.h"
|
||||||
|
#include "pcircle.h"
|
||||||
|
#include "prctngle.h"
|
||||||
|
|
||||||
|
void archive(int& i, PStream& ps){
|
||||||
|
if(ps.isSaving())
|
||||||
|
ps<<i<<endl;
|
||||||
|
else
|
||||||
|
ps>>i;
|
||||||
|
}
|
||||||
|
|
||||||
|
void archive(Point& i, PStream& ps){
|
||||||
|
if(ps.isSaving()){
|
||||||
|
ps<<i.getx()<<endl;
|
||||||
|
ps<<i.gety()<<endl;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
int x;
|
||||||
|
ps>>x;
|
||||||
|
i.setx(x);
|
||||||
|
ps>>x;
|
||||||
|
i.sety(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main(void) {
|
||||||
|
Graphics g;
|
||||||
|
Persistent *pFig1, *pFig2, *newFig1, *newFig2, *newFig3, *newFig4;
|
||||||
|
PStream ps;
|
||||||
|
|
||||||
|
Pcircle pc(1,2,3,4);
|
||||||
|
Prectangle pr(5,6,7,8,9);
|
||||||
|
|
||||||
|
pFig1 = &pc;
|
||||||
|
pFig2 = ≺
|
||||||
|
|
||||||
|
// Save to file
|
||||||
|
ps.save("test.dat");
|
||||||
|
ps.archive(pFig1);
|
||||||
|
ps.archive(pFig1);
|
||||||
|
ps.archive(pFig2);
|
||||||
|
ps.archive(pFig1);
|
||||||
|
ps.close();
|
||||||
|
|
||||||
|
// Restore from file
|
||||||
|
ps.load("test.dat");
|
||||||
|
ps.archive(newFig1);
|
||||||
|
ps.archive(newFig2);
|
||||||
|
ps.archive(newFig3);
|
||||||
|
ps.archive(newFig4); // Does not exist on file...
|
||||||
|
ps.close();
|
||||||
|
|
||||||
|
// Draw the figure objects..
|
||||||
|
PersFig* psf = (PersFig*)newFig1;
|
||||||
|
psf->draw(g);
|
||||||
|
psf = (PersFig*)≺
|
||||||
|
psf->draw(g);
|
||||||
|
|
||||||
|
// This is just to show the pointers...
|
||||||
|
cout << "\nFigurePtr1: " << (int)newFig1 << endl;
|
||||||
|
cout << "FigurePtr2: " << (int)newFig2 << endl;
|
||||||
|
cout << "FigurePtr3: " << (int)newFig3 << endl;
|
||||||
|
cout << "FigurePtr4: " << (int)newFig4 << endl;
|
||||||
|
|
||||||
|
char x;
|
||||||
|
cin >> x;
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
template <class KeyType, class DataType>
|
||||||
|
Mapfake<KeyType, DataType>::Mapfake(){}
|
||||||
|
|
||||||
|
|
||||||
|
template <class KeyType, class DataType>
|
||||||
|
int Mapfake<KeyType, DataType>::getSize(){
|
||||||
|
return list.getSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class KeyType, class DataType>
|
||||||
|
DataType Mapfake<KeyType, DataType>::find(KeyType key)
|
||||||
|
{
|
||||||
|
int i=0;
|
||||||
|
if(list.getItem(0)->getKey() == key)
|
||||||
|
return list.getItem(0)->getData();
|
||||||
|
while(!list.isEmpty()) {
|
||||||
|
i++;
|
||||||
|
if(list.getItem(i)->getKey() == key)
|
||||||
|
return list.getItem(i)->getData();
|
||||||
|
}
|
||||||
|
return (DataType)0; // Just to supress compilerwarning
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class KeyType, class DataType>
|
||||||
|
bool Mapfake<KeyType, DataType>::exist(KeyType key)
|
||||||
|
{
|
||||||
|
for(int i=0 ; i<list.getSize() ; i++) {
|
||||||
|
if(list.getItem(i)->getKey() == key)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class KeyType, class DataType>
|
||||||
|
bool Mapfake<KeyType, DataType>::add(KeyType key, DataType data)
|
||||||
|
{
|
||||||
|
Tuple *tuple;
|
||||||
|
tuple = new Tuple(key, data);
|
||||||
|
|
||||||
|
if(exist(key))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
list.add(0, tuple);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#ifndef __MAP_H
|
||||||
|
#define __MAP_H
|
||||||
|
|
||||||
|
#include <iostream.h>
|
||||||
|
#include "List.h"
|
||||||
|
|
||||||
|
template <class KeyType, class DataType>
|
||||||
|
class Mapfake{
|
||||||
|
private:
|
||||||
|
typedef class Tuple{
|
||||||
|
KeyType key;
|
||||||
|
DataType data;
|
||||||
|
public:
|
||||||
|
Tuple(KeyType _key, DataType _data){key = _key; data = _data;}
|
||||||
|
|
||||||
|
KeyType getKey(){return key;}
|
||||||
|
DataType getData(){return data;}
|
||||||
|
} Tuple;
|
||||||
|
|
||||||
|
List<Tuple*> list;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Mapfake();
|
||||||
|
|
||||||
|
DataType find(KeyType key);
|
||||||
|
bool exist(KeyType key);
|
||||||
|
bool add(KeyType key, DataType data);
|
||||||
|
int getSize();
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "mapfake.cpp"
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: Node; Pseudo Package body
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: Node.cpp
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// Node
|
||||||
|
#include "Node.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
// Parameterized Class Node
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
Node<T>::Node()
|
||||||
|
//## begin Node::Node%.hasinit preserve=no
|
||||||
|
//## end Node::Node%.hasinit
|
||||||
|
//## begin Node::Node%.initialization preserve=yes
|
||||||
|
//## end Node::Node%.initialization
|
||||||
|
{
|
||||||
|
//## begin Node::Node%.body preserve=yes
|
||||||
|
//## end Node::Node%.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
Node<T>::~Node()
|
||||||
|
{
|
||||||
|
//## begin Node::~Node%.body preserve=yes
|
||||||
|
if(next) delete next ;
|
||||||
|
//## end Node::~Node%.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Additional Declarations
|
||||||
|
//## begin Node.declarations preserve=yes
|
||||||
|
#include "list.h"
|
||||||
|
//## end Node.declarations
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
|
|
||||||
|
|
||||||
|
// Detached code regions:
|
||||||
|
// WARNING: this code will be lost if code is regenerated.
|
||||||
|
#if 0
|
||||||
|
//## begin Node::getData%939104773.body preserve=no
|
||||||
|
return *this;
|
||||||
|
//## end Node::getData%939104773.body
|
||||||
|
|
||||||
|
#endif
|
||||||
+95
@@ -0,0 +1,95 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: Node; Pseudo Package specification
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: Node.h
|
||||||
|
|
||||||
|
#ifndef Node_h
|
||||||
|
#define Node_h 1
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
//## Class: Node; Parameterized Class
|
||||||
|
//## Category: Figures
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Persistence: Transient
|
||||||
|
//## Cardinality/Multiplicity: n
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class Node
|
||||||
|
{
|
||||||
|
//## begin Node.initialDeclarations preserve=yes
|
||||||
|
public:
|
||||||
|
Node(T theData):data(theData){next = (Node<T>*)0;}
|
||||||
|
//## end Node.initialDeclarations
|
||||||
|
|
||||||
|
public:
|
||||||
|
//## Constructors (generated)
|
||||||
|
Node();
|
||||||
|
|
||||||
|
//## Destructor (generated)
|
||||||
|
~Node();
|
||||||
|
|
||||||
|
// Additional Public Declarations
|
||||||
|
//## begin Node.public preserve=yes
|
||||||
|
Node *next;
|
||||||
|
T data;
|
||||||
|
//## end Node.public
|
||||||
|
protected:
|
||||||
|
// Additional Protected Declarations
|
||||||
|
//## begin Node.protected preserve=yes
|
||||||
|
//## end Node.protected
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Additional Private Declarations
|
||||||
|
//## begin Node.private preserve=yes
|
||||||
|
//## end Node.private
|
||||||
|
|
||||||
|
private: //## implementation
|
||||||
|
// Data Members for Has Relationships
|
||||||
|
|
||||||
|
//## Documentation Node::next.has
|
||||||
|
//## begin Node::next.has preserve=yes public: Node {1 -> 1RO}
|
||||||
|
// Node *next;
|
||||||
|
//## end Node::next.has
|
||||||
|
|
||||||
|
// Data Members for Class Attributes
|
||||||
|
|
||||||
|
//## Attribute: data
|
||||||
|
//## begin Node::data.attr preserve=yes public: T {U}
|
||||||
|
// T data;
|
||||||
|
//## end Node::data.attr
|
||||||
|
|
||||||
|
// Additional Implementation Declarations
|
||||||
|
//## begin Node.implementation preserve=yes
|
||||||
|
//## end Node.implementation
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//## begin Node.postscript preserve=yes
|
||||||
|
|
||||||
|
#include "node.cpp"
|
||||||
|
//## end Node.postscript
|
||||||
|
|
||||||
|
// Parameterized Class Node
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: Pcircle; Pseudo Package body
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: Pcircle.cpp
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// Pcircle
|
||||||
|
#include "Pcircle.h"
|
||||||
|
#include "PStream.h"
|
||||||
|
#include "Point.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
void archive(int &i, PStream &ps);
|
||||||
|
void archive(Point& i, PStream &ps);
|
||||||
|
|
||||||
|
|
||||||
|
Persistent* Pcircle::_pobj = Persistent::addType("Pcircle", new Pcircle);
|
||||||
|
// ************** GAMMAL ******************
|
||||||
|
//IMPLEMENT_PERSISTENT(Pcircle);
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
// Class Pcircle
|
||||||
|
|
||||||
|
Pcircle::~Pcircle()
|
||||||
|
{
|
||||||
|
//## begin Pcircle::~Pcircle%.body preserve=yes
|
||||||
|
//## end Pcircle::~Pcircle%.body
|
||||||
|
}
|
||||||
|
Pcircle::Pcircle(int xPos, int yPos, int _radius, Color _color)
|
||||||
|
//## begin Pcircle::Pcircle%.hasinit preserve=no
|
||||||
|
//## end Pcircle::Pcircle%.hasinit
|
||||||
|
//## begin Pcircle::Pcircle%.initialization preserve=yes
|
||||||
|
//## end Pcircle::Pcircle%.initialization
|
||||||
|
{
|
||||||
|
//## begin Pcircle::Pcircle%.body preserve=yes
|
||||||
|
// Circle::Circle(xPos, yPos, _radius, _color);
|
||||||
|
|
||||||
|
_pobj = Persistent::addType("Pcircle", new Pcircle);
|
||||||
|
setCenter(xPos, yPos);
|
||||||
|
setRad(_radius);
|
||||||
|
setColor(_color);
|
||||||
|
//## end Pcircle::Pcircle%.body
|
||||||
|
}
|
||||||
|
|
||||||
|
Pcircle::Pcircle(const Pcircle &src)
|
||||||
|
{
|
||||||
|
Point *tmp;
|
||||||
|
tmp=(Point*)&src.getCenter();
|
||||||
|
setCenter(tmp->getx(), tmp->gety());
|
||||||
|
setRad(src.getRad());
|
||||||
|
setColor(Figure::getColor());
|
||||||
|
}
|
||||||
|
//## Other Operations (implementation)
|
||||||
|
void Pcircle::archive (PStream& ps)
|
||||||
|
{
|
||||||
|
//## begin Pcircle::archive%940866975.body preserve=yes
|
||||||
|
if(ps.isSaving()){
|
||||||
|
Point c = getCenter();
|
||||||
|
if(ps.is_open())
|
||||||
|
cout << "File open... archiving " <<endl;
|
||||||
|
else
|
||||||
|
cout << "File NOT open... archiving " <<endl;
|
||||||
|
|
||||||
|
::archive(c,ps);
|
||||||
|
int i = getRad();
|
||||||
|
::archive(i,ps);
|
||||||
|
i = getColor();
|
||||||
|
::archive(i,ps);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Point c;
|
||||||
|
int i;
|
||||||
|
::archive(c,ps);
|
||||||
|
setCenter(c.getx(), c.gety());
|
||||||
|
::archive(i,ps);
|
||||||
|
setRad(i);
|
||||||
|
::archive(i,ps);
|
||||||
|
setColor(i);
|
||||||
|
}
|
||||||
|
//## end Pcircle::archive%940866975.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Additional Declarations
|
||||||
|
//## begin Pcircle.declarations preserve=yes
|
||||||
|
//## end Pcircle.declarations
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
+106
@@ -0,0 +1,106 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: Pcircle; Pseudo Package specification
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: Pcircle.h
|
||||||
|
|
||||||
|
#ifndef Pcircle_h
|
||||||
|
#define Pcircle_h 1
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// Circle
|
||||||
|
#include "Circle.h"
|
||||||
|
// PersFig
|
||||||
|
#include "PersFig.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
//## Class: Pcircle
|
||||||
|
//## Category: Persist
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Persistence: Transient
|
||||||
|
//## Cardinality/Multiplicity: n
|
||||||
|
|
||||||
|
class Pcircle : public Circle, public PersFig //## Inherits: <unnamed>
|
||||||
|
|
||||||
|
|
||||||
|
//## Inherits: <unnamed>
|
||||||
|
{
|
||||||
|
//## begin Pcircle.initialDeclarations preserve=yes
|
||||||
|
//## end Pcircle.initialDeclarations
|
||||||
|
|
||||||
|
public:
|
||||||
|
//## Constructors (generated)
|
||||||
|
|
||||||
|
Pcircle(){};
|
||||||
|
Pcircle(int xPos, int yPos, int _radius, Color _color);
|
||||||
|
Pcircle(const Pcircle &src);
|
||||||
|
|
||||||
|
//## Destructor (generated)
|
||||||
|
~Pcircle();
|
||||||
|
|
||||||
|
|
||||||
|
//## Other Operations (specified)
|
||||||
|
//## Operation: archive%940866975
|
||||||
|
void archive (PStream& ps);
|
||||||
|
|
||||||
|
// Additional Public Declarations
|
||||||
|
//## begin Pcircle.public preserve=yes
|
||||||
|
|
||||||
|
char* name() const {
|
||||||
|
return "Pcircle";
|
||||||
|
}
|
||||||
|
Persistent* clone1() const {
|
||||||
|
return new Pcircle(*this);
|
||||||
|
}
|
||||||
|
Figure* clone() const {
|
||||||
|
return new Pcircle(*this);
|
||||||
|
}
|
||||||
|
static Persistent* _pobj;
|
||||||
|
|
||||||
|
// ************** GAMMAL ******************
|
||||||
|
// DECLARE_PERSISTENT(Pcircle);
|
||||||
|
|
||||||
|
//## end Pcircle.public
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Additional Protected Declarations
|
||||||
|
//## begin Pcircle.protected preserve=yes
|
||||||
|
//## end Pcircle.protected
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Additional Private Declarations
|
||||||
|
//## begin Pcircle.private preserve=yes
|
||||||
|
//## end Pcircle.private
|
||||||
|
|
||||||
|
private: //## implementation
|
||||||
|
// Additional Implementation Declarations
|
||||||
|
//## begin Pcircle.implementation preserve=yes
|
||||||
|
//## end Pcircle.implementation
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//## begin Pcircle.postscript preserve=yes
|
||||||
|
//## end Pcircle.postscript
|
||||||
|
|
||||||
|
// Class Pcircle
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: PersFig; Pseudo Package body
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: PersFig.cpp
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// PersFig
|
||||||
|
#include "PersFig.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
// Class PersFig
|
||||||
|
|
||||||
|
PersFig::PersFig()
|
||||||
|
//## begin PersFig::PersFig%.hasinit preserve=no
|
||||||
|
//## end PersFig::PersFig%.hasinit
|
||||||
|
//## begin PersFig::PersFig%.initialization preserve=yes
|
||||||
|
//## end PersFig::PersFig%.initialization
|
||||||
|
{
|
||||||
|
//## begin PersFig::PersFig%.body preserve=yes
|
||||||
|
//## end PersFig::PersFig%.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PersFig::~PersFig()
|
||||||
|
{
|
||||||
|
//## begin PersFig::~PersFig%.body preserve=yes
|
||||||
|
//## end PersFig::~PersFig%.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Additional Declarations
|
||||||
|
//## begin PersFig.declarations preserve=yes
|
||||||
|
//## end PersFig.declarations
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: PersFig; Pseudo Package specification
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: PersFig.h
|
||||||
|
|
||||||
|
#ifndef PersFig_h
|
||||||
|
#define PersFig_h 1
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// Figure
|
||||||
|
#include "Figure.h"
|
||||||
|
// Persistent
|
||||||
|
#include "Prsstent.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
//## Class: PersFig
|
||||||
|
//## Category: Persist
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Persistence: Transient
|
||||||
|
//## Cardinality/Multiplicity: n
|
||||||
|
|
||||||
|
class PersFig : public Persistent, //## Inherits: <unnamed>
|
||||||
|
virtual public Figure //## Inherits: <unnamed>
|
||||||
|
{
|
||||||
|
//## begin PersFig.initialDeclarations preserve=yes
|
||||||
|
//## end PersFig.initialDeclarations
|
||||||
|
|
||||||
|
public:
|
||||||
|
//## Constructors (generated)
|
||||||
|
PersFig();
|
||||||
|
|
||||||
|
//## Destructor (generated)
|
||||||
|
~PersFig();
|
||||||
|
|
||||||
|
// Additional Public Declarations
|
||||||
|
//## begin PersFig.public preserve=yes
|
||||||
|
//## end PersFig.public
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Additional Protected Declarations
|
||||||
|
//## begin PersFig.protected preserve=yes
|
||||||
|
//## end PersFig.protected
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Additional Private Declarations
|
||||||
|
//## begin PersFig.private preserve=yes
|
||||||
|
//## end PersFig.private
|
||||||
|
|
||||||
|
private: //## implementation
|
||||||
|
// Additional Implementation Declarations
|
||||||
|
//## begin PersFig.implementation preserve=yes
|
||||||
|
//## end PersFig.implementation
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//## begin PersFig.postscript preserve=yes
|
||||||
|
//## end PersFig.postscript
|
||||||
|
|
||||||
|
// Class PersFig
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: Pline; Pseudo Package body
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: Pline.cpp
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// Pline
|
||||||
|
#include "Pline.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
// Class Pline
|
||||||
|
|
||||||
|
Pline::Pline()
|
||||||
|
//## begin Pline::Pline%.hasinit preserve=no
|
||||||
|
//## end Pline::Pline%.hasinit
|
||||||
|
//## begin Pline::Pline%.initialization preserve=yes
|
||||||
|
//## end Pline::Pline%.initialization
|
||||||
|
{
|
||||||
|
//## begin Pline::Pline%.body preserve=yes
|
||||||
|
//## end Pline::Pline%.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Pline::~Pline()
|
||||||
|
{
|
||||||
|
//## begin Pline::~Pline%.body preserve=yes
|
||||||
|
//## end Pline::~Pline%.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## Other Operations (implementation)
|
||||||
|
void Pline::archive (PStream& ps)
|
||||||
|
{
|
||||||
|
//## begin Pline::archive%940866980.body preserve=yes
|
||||||
|
//## end Pline::archive%940866980.body
|
||||||
|
}
|
||||||
|
|
||||||
|
// Additional Declarations
|
||||||
|
//## begin Pline.declarations preserve=yes
|
||||||
|
//## end Pline.declarations
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: Pline; Pseudo Package specification
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: Pline.h
|
||||||
|
|
||||||
|
#ifndef Pline_h
|
||||||
|
#define Pline_h 1
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// Line
|
||||||
|
#include "Line.h"
|
||||||
|
// PersFig
|
||||||
|
#include "PersFig.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
//## Class: Pline
|
||||||
|
//## Category: Persist
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Persistence: Transient
|
||||||
|
//## Cardinality/Multiplicity: n
|
||||||
|
|
||||||
|
class Pline : public PersFig, //## Inherits: <unnamed>
|
||||||
|
public Line //## Inherits: <unnamed>
|
||||||
|
{
|
||||||
|
//## begin Pline.initialDeclarations preserve=yes
|
||||||
|
//## end Pline.initialDeclarations
|
||||||
|
|
||||||
|
public:
|
||||||
|
//## Constructors (generated)
|
||||||
|
Pline();
|
||||||
|
|
||||||
|
//## Destructor (generated)
|
||||||
|
~Pline();
|
||||||
|
|
||||||
|
|
||||||
|
//## Other Operations (specified)
|
||||||
|
//## Operation: archive%940866980
|
||||||
|
void archive (PStream &ps);
|
||||||
|
|
||||||
|
// Additional Public Declarations
|
||||||
|
//## begin Pline.public preserve=yes
|
||||||
|
//## end Pline.public
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Additional Protected Declarations
|
||||||
|
//## begin Pline.protected preserve=yes
|
||||||
|
//## end Pline.protected
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Additional Private Declarations
|
||||||
|
//## begin Pline.private preserve=yes
|
||||||
|
//## end Pline.private
|
||||||
|
|
||||||
|
private: //## implementation
|
||||||
|
// Additional Implementation Declarations
|
||||||
|
//## begin Pline.implementation preserve=yes
|
||||||
|
//## end Pline.implementation
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//## begin Pline.postscript preserve=yes
|
||||||
|
//## end Pline.postscript
|
||||||
|
|
||||||
|
// Class Pline
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: pList; Pseudo Package body
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: pList.cpp
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// pList
|
||||||
|
#include "pList.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
//## begin pList.instantiation preserve=no
|
||||||
|
template class List< Point >;
|
||||||
|
//## end pList.instantiation
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: pList; Pseudo Package specification
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: pList.h
|
||||||
|
|
||||||
|
#ifndef pList_h
|
||||||
|
#define pList_h 1
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// List
|
||||||
|
#include "List.h"
|
||||||
|
// Point
|
||||||
|
#include "Point.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
//## Class: pList; Instantiated Class
|
||||||
|
//## Category: Figures
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Persistence: Transient
|
||||||
|
//## Cardinality/Multiplicity: n
|
||||||
|
|
||||||
|
//## Uses: <unnamed>; Point { -> }
|
||||||
|
|
||||||
|
typedef List< Point > pList;
|
||||||
|
|
||||||
|
//## begin pList.postscript preserve=yes
|
||||||
|
//## end pList.postscript
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: Point; Pseudo Package body
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: Point.cpp
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
// Point
|
||||||
|
#include "Point.h"
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
// Class Point
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Point::Point()
|
||||||
|
//## begin Point::Point%.hasinit preserve=no
|
||||||
|
//## end Point::Point%.hasinit
|
||||||
|
//## begin Point::Point%.initialization preserve=yes
|
||||||
|
//## end Point::Point%.initialization
|
||||||
|
{
|
||||||
|
//## begin Point::Point%.body preserve=yes
|
||||||
|
//## end Point::Point%.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Point::~Point()
|
||||||
|
{
|
||||||
|
//## begin Point::~Point%.body preserve=yes
|
||||||
|
//## end Point::~Point%.body
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## Other Operations (implementation)
|
||||||
|
int Point::getx ()
|
||||||
|
{
|
||||||
|
//## begin Point::getx%937398664.body preserve=yes
|
||||||
|
return x;
|
||||||
|
//## end Point::getx%937398664.body
|
||||||
|
}
|
||||||
|
|
||||||
|
int Point::gety ()
|
||||||
|
{
|
||||||
|
//## begin Point::gety%937398665.body preserve=yes
|
||||||
|
return y;
|
||||||
|
//## end Point::gety%937398665.body
|
||||||
|
}
|
||||||
|
|
||||||
|
void Point::setx (int src)
|
||||||
|
{
|
||||||
|
//## begin Point::setx%937398666.body preserve=yes
|
||||||
|
x=src;
|
||||||
|
//## end Point::setx%937398666.body
|
||||||
|
}
|
||||||
|
|
||||||
|
void Point::sety (int src)
|
||||||
|
{
|
||||||
|
//## begin Point::sety%937398667.body preserve=yes
|
||||||
|
y=src;
|
||||||
|
//## end Point::sety%937398667.body
|
||||||
|
}
|
||||||
|
|
||||||
|
// Additional Declarations
|
||||||
|
//## begin Point.declarations preserve=yes
|
||||||
|
//## end Point.declarations
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
+101
@@ -0,0 +1,101 @@
|
|||||||
|
//## begin module.cm preserve=no
|
||||||
|
// %X% %Q% %Z% %W%
|
||||||
|
//## end module.cm
|
||||||
|
|
||||||
|
//## begin module.cp preserve=no
|
||||||
|
//## end module.cp
|
||||||
|
|
||||||
|
//## Module: Point; Pseudo Package specification
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Source file: Point.h
|
||||||
|
|
||||||
|
#ifndef Point_h
|
||||||
|
#define Point_h 1
|
||||||
|
|
||||||
|
//## begin module.additionalIncludes preserve=no
|
||||||
|
//## end module.additionalIncludes
|
||||||
|
|
||||||
|
//## begin module.includes preserve=yes
|
||||||
|
//## end module.includes
|
||||||
|
|
||||||
|
//## begin module.additionalDeclarations preserve=yes
|
||||||
|
//## end module.additionalDeclarations
|
||||||
|
|
||||||
|
|
||||||
|
//## Class: Point
|
||||||
|
//## Category: Figures
|
||||||
|
//## Subsystem: Figures
|
||||||
|
//## Persistence: Transient
|
||||||
|
//## Cardinality/Multiplicity: n
|
||||||
|
|
||||||
|
class Point
|
||||||
|
{
|
||||||
|
//## begin Point.initialDeclarations preserve=yes
|
||||||
|
//## end Point.initialDeclarations
|
||||||
|
|
||||||
|
public:
|
||||||
|
//## Constructors (generated)
|
||||||
|
Point();
|
||||||
|
|
||||||
|
//## Destructor (generated)
|
||||||
|
~Point();
|
||||||
|
|
||||||
|
|
||||||
|
//## Other Operations (specified)
|
||||||
|
//## Operation: getx%937398664
|
||||||
|
int getx ();
|
||||||
|
|
||||||
|
//## Operation: gety%937398665
|
||||||
|
int gety ();
|
||||||
|
|
||||||
|
//## Operation: setx%937398666
|
||||||
|
void setx (int src);
|
||||||
|
|
||||||
|
//## Operation: sety%937398667
|
||||||
|
void sety (int src);
|
||||||
|
|
||||||
|
// Additional Public Declarations
|
||||||
|
//## begin Point.public preserve=yes
|
||||||
|
//## end Point.public
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Additional Protected Declarations
|
||||||
|
//## begin Point.protected preserve=yes
|
||||||
|
//## end Point.protected
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Additional Private Declarations
|
||||||
|
//## begin Point.private preserve=yes
|
||||||
|
//## end Point.private
|
||||||
|
|
||||||
|
private: //## implementation
|
||||||
|
// Data Members for Class Attributes
|
||||||
|
|
||||||
|
//## Attribute: x
|
||||||
|
//## begin Point::x.attr preserve=no private: int {U}
|
||||||
|
int x;
|
||||||
|
//## end Point::x.attr
|
||||||
|
|
||||||
|
//## Attribute: y
|
||||||
|
//## begin Point::y.attr preserve=no private: int {U}
|
||||||
|
int y;
|
||||||
|
//## end Point::y.attr
|
||||||
|
|
||||||
|
// Additional Implementation Declarations
|
||||||
|
//## begin Point.implementation preserve=yes
|
||||||
|
//## end Point.implementation
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//## begin Point.postscript preserve=yes
|
||||||
|
//## end Point.postscript
|
||||||
|
|
||||||
|
// Class Point
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//## begin module.epilog preserve=yes
|
||||||
|
//## end module.epilog
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
Loaded 100 of 164 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user