| home
| contents
| previous
| next page
| send comment
| send link
| add bookmark |
Document.h
/*---------------------------------------------------------------------------------*
* "document.h"
*
* Declarations for the document class. These load, store,
* initialize, and provide access to the data in the spreadsheet
* document.
*
* Stephen R. Schmitt
*
* January 1999
*/
#ifndef DOCUMENT_H
#define DOCUMENT_H
#include <assert.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "scalc.h"
// The spreadsheet is an array of Cells. Each Cell has storage for
// an expression and acts as memory for the variable identified by the
// cell's coordinates in the spread sheet. This is the data structure
// of each cell:
typedef struct
{
int status; // status of cell
int errloc; // error location, if any
double val; // last calculated cell value
char contents[MAX_CONTENTS]; // formula or some text
}
CELL_TP;
/*---------------------------------------------------------------------------------*
* "document" class declarations
*
* uses CELL_TP structure and TOKEN
*/
class document
{
public:
document();
~document();
void put_filename( char * );
void get_filename( char * );
void put_cell_contents( int, int, char * );
void get_cell_contents( int, int, char * );
void put_cell_status( int, int, int );
int get_cell_status( int, int );
void put_cell_errloc( int, int, int );
int get_cell_errloc( int, int );
void put_cell_value( int, int, double );
double get_cell_value( int, int );
void clear_sheet();
bool save();
bool load();
private:
char filename[MAX_CONTENTS]; // file name of spread sheet
CELL_TP *sheet[CXmax][CYmax]; // array of pointers to cells
};
#endif
| home
| contents
| previous
| next page
| send comment
| send link
| add bookmark |
Copyright © 2004, Stephen R. Schmitt