Initial
This commit is contained in:
175
worksht/INTEGER.HPP
Normal file
175
worksht/INTEGER.HPP
Normal file
@@ -0,0 +1,175 @@
|
||||
#ifndef _WORKSHT_INTEGER_HPP_
|
||||
#define _WORKSHT_INTEGER_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_STRING_HPP_
|
||||
#include <common/string.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_STDIO_HPP_
|
||||
#include <common/stdio.hpp>
|
||||
#endif
|
||||
#ifndef _FILEIO_FILEIO_HPP_
|
||||
#include <fileio/fileio.hpp>
|
||||
#endif
|
||||
#ifndef _WORKSHT_RECORD_HPP_
|
||||
#include <worksht/record.hpp>
|
||||
#endif
|
||||
|
||||
class Integer : public Record
|
||||
{
|
||||
public:
|
||||
Integer(void);
|
||||
Integer(const Integer &someInteger);
|
||||
Integer(const Record &someRecord);
|
||||
Integer(int row,int col,WORD value);
|
||||
virtual ~Integer();
|
||||
Integer &operator=(const Integer &someInteger);
|
||||
Integer &operator=(const Record &someRecord);
|
||||
BOOL operator==(const Integer &someInteger)const;
|
||||
operator String(void)const;
|
||||
char *catstr(char *pString);
|
||||
BYTE format(void)const;
|
||||
void format(BYTE format);
|
||||
WORD column(void)const;
|
||||
void column(WORD column);
|
||||
WORD row(void)const;
|
||||
void row(WORD row);
|
||||
WORD integer(void)const;
|
||||
void integer(WORD integer);
|
||||
bool read(FileIO &inFile);
|
||||
bool write(FileIO &outFile);
|
||||
private:
|
||||
BYTE mFormat;
|
||||
WORD mColumn;
|
||||
WORD mRow;
|
||||
WORD mInteger;
|
||||
};
|
||||
|
||||
inline
|
||||
Integer::Integer(void)
|
||||
: mFormat(255), mColumn(0), mRow(0), mInteger(0)
|
||||
{
|
||||
type(Record::Integer);
|
||||
}
|
||||
|
||||
inline
|
||||
Integer::Integer(const Integer &someInteger)
|
||||
: mFormat(255)
|
||||
{
|
||||
type(Record::Integer);
|
||||
*this=someInteger;
|
||||
}
|
||||
|
||||
inline
|
||||
Integer::Integer(const Record &someRecord)
|
||||
: mFormat(255), mColumn(0), mRow(0), mInteger(0)
|
||||
{
|
||||
type(Record::Integer);
|
||||
*this=someRecord;
|
||||
}
|
||||
|
||||
inline
|
||||
Integer::Integer(int row,int col,WORD value)
|
||||
: mFormat(255), mRow(row), mColumn(col), mInteger(value)
|
||||
{
|
||||
type(Record::Integer);
|
||||
}
|
||||
|
||||
inline
|
||||
Integer::~Integer()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Integer &Integer::operator=(const Integer &someInteger)
|
||||
{
|
||||
format(someInteger.format());
|
||||
column(someInteger.column());
|
||||
row(someInteger.row());
|
||||
integer(someInteger.integer());
|
||||
(Record&)*this=(Record&)someInteger;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
Integer &Integer::operator=(const Record &someRecord)
|
||||
{
|
||||
(Record&)*this=someRecord;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
BOOL Integer::operator==(const Integer &someInteger)const
|
||||
{
|
||||
return (format()==someInteger.format()&&
|
||||
column()==someInteger.column()&&
|
||||
row()==someInteger.row()&&
|
||||
integer()==someInteger.integer()&&
|
||||
(Record&)*this==(Record&)someInteger);
|
||||
}
|
||||
|
||||
inline
|
||||
Integer::operator String(void)const
|
||||
{
|
||||
String strString;
|
||||
::sprintf(strString,"%d",integer());
|
||||
return strString;
|
||||
}
|
||||
|
||||
inline
|
||||
char *Integer::catstr(char *pString)
|
||||
{
|
||||
::sprintf(pString,"%d",integer());
|
||||
while(*pString)pString++;
|
||||
return pString;
|
||||
}
|
||||
|
||||
inline
|
||||
BYTE Integer::format(void)const
|
||||
{
|
||||
return mFormat;
|
||||
}
|
||||
|
||||
inline
|
||||
void Integer::format(BYTE format)
|
||||
{
|
||||
mFormat=format;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Integer::column(void)const
|
||||
{
|
||||
return mColumn;
|
||||
}
|
||||
|
||||
inline
|
||||
void Integer::column(WORD column)
|
||||
{
|
||||
mColumn=column;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Integer::row(void)const
|
||||
{
|
||||
return mRow;
|
||||
}
|
||||
|
||||
inline
|
||||
void Integer::row(WORD row)
|
||||
{
|
||||
mRow=row;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Integer::integer(void)const
|
||||
{
|
||||
return mInteger;
|
||||
}
|
||||
|
||||
inline
|
||||
void Integer::integer(WORD integer)
|
||||
{
|
||||
mInteger=integer;
|
||||
}
|
||||
#endif
|
||||
37
worksht/LABEL.CPP
Normal file
37
worksht/LABEL.CPP
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <worksht/label.hpp>
|
||||
|
||||
bool Label::read(FileIO &inFile)
|
||||
{
|
||||
char *pString;
|
||||
|
||||
mLabelString.reserve(256,TRUE);
|
||||
pString=mLabelString;
|
||||
if(!inFile.read((char*)&mFormat,sizeof(mFormat)))return false;
|
||||
if(!inFile.read((char*)&mColumn,sizeof(mColumn)))return false;
|
||||
if(!inFile.read((char*)&mRow,sizeof(mRow)))return false;
|
||||
if(!inFile.read((char*)&mFormatPrefix,sizeof(mFormatPrefix)))return false;
|
||||
while(true)
|
||||
{
|
||||
if(!inFile.read(pString))return false;
|
||||
if(!*pString)break;
|
||||
pString++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Label::write(FileIO &outFile)
|
||||
{
|
||||
char strNull[]={'\0'};
|
||||
|
||||
type(Record::Label);
|
||||
length(sizeof(mFormat)+sizeof(mColumn)+sizeof(mRow)+sizeof(mFormatPrefix)+mLabelString.length()+1);
|
||||
Record::write(outFile);
|
||||
if(!outFile.write((char*)&mFormat,sizeof(mFormat)))return false;
|
||||
if(!outFile.write((char*)&mColumn,sizeof(mColumn)))return false;
|
||||
if(!outFile.write((char*)&mRow,sizeof(mRow)))return false;
|
||||
if(!outFile.write((char*)&mFormatPrefix,sizeof(mFormatPrefix)))return false;
|
||||
if(!outFile.write(mLabelString.str(),mLabelString.length()))return false;
|
||||
if(!outFile.write(strNull,1))return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
181
worksht/LABEL.HPP
Normal file
181
worksht/LABEL.HPP
Normal file
@@ -0,0 +1,181 @@
|
||||
#ifndef _WORKSHT_LABEL_HPP_
|
||||
#define _WORKSHT_LABEL_HPP_
|
||||
#ifndef _COMMON_STRING_HPP_
|
||||
#include <common/string.hpp>
|
||||
#endif
|
||||
#ifndef _WORKSHT_RECORD_HPP_
|
||||
#include <worksht/record.hpp>
|
||||
#endif
|
||||
|
||||
class Label : public Record
|
||||
{
|
||||
public:
|
||||
typedef enum FormatPrefix{Backslash='\'',SingleQuote='\'',DoubleQuote='"',Caret='^'};
|
||||
Label(void);
|
||||
Label(const Label &someLabel);
|
||||
Label(int row,int col,const String &strLabel);
|
||||
Label(const Record &someRecord);
|
||||
virtual ~Label();
|
||||
Label &operator=(const Label &someLabel);
|
||||
Label &operator=(const Record &someRecord);
|
||||
BOOL operator==(const Label someLabel)const;
|
||||
operator String(void)const;
|
||||
char *catstr(char *pString);
|
||||
BYTE format(void)const;
|
||||
void format(BYTE format);
|
||||
Label::FormatPrefix formatPrefix(void)const;
|
||||
void formatPrefix(FormatPrefix formatPrefix);
|
||||
|
||||
WORD column(void)const;
|
||||
void column(WORD column);
|
||||
WORD row(void)const;
|
||||
void row(WORD row);
|
||||
const String &strLabel(void)const;
|
||||
void strLabel(const String &strLabel);
|
||||
bool read(FileIO &inFile);
|
||||
bool write(FileIO &outFile);
|
||||
private:
|
||||
BYTE mFormat;
|
||||
WORD mColumn;
|
||||
WORD mRow;
|
||||
BYTE mFormatPrefix;
|
||||
String mLabelString;
|
||||
};
|
||||
|
||||
inline
|
||||
Label::Label(void)
|
||||
: mFormat(255), mColumn(0), mRow(0), mFormatPrefix(Caret)
|
||||
{
|
||||
type(Record::Label);
|
||||
}
|
||||
|
||||
inline
|
||||
Label::Label(int row,int col,const String &strLabel)
|
||||
: mFormat(255), mRow(row), mColumn(col), mLabelString(strLabel), mFormatPrefix(Caret)
|
||||
{
|
||||
type(Record::Label);
|
||||
}
|
||||
|
||||
inline
|
||||
Label::Label(const Label &someLabel)
|
||||
{
|
||||
type(Record::Label);
|
||||
*this=someLabel;
|
||||
}
|
||||
|
||||
inline
|
||||
Label::Label(const Record &someRecord)
|
||||
{
|
||||
type(Record::Label);
|
||||
*this=someRecord;
|
||||
}
|
||||
|
||||
inline
|
||||
Label::~Label()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Label &Label::operator=(const Label &someLabel)
|
||||
{
|
||||
format(someLabel.format());
|
||||
column(someLabel.column());
|
||||
row(someLabel.row());
|
||||
formatPrefix(someLabel.formatPrefix());
|
||||
strLabel(someLabel.strLabel());
|
||||
(Record&)*this=(Record&)someLabel;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
Label &Label::operator=(const Record &someRecord)
|
||||
{
|
||||
(Record&)*this=someRecord;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
BOOL Label::operator==(const Label someLabel)const
|
||||
{
|
||||
return (format()==someLabel.format()&&
|
||||
column()==someLabel.column()&&
|
||||
row()==someLabel.row()&&
|
||||
strLabel()==someLabel.strLabel()&&
|
||||
(Record&)*this==(Record&)someLabel);
|
||||
}
|
||||
|
||||
inline
|
||||
Label::operator String(void)const
|
||||
{
|
||||
return mLabelString;
|
||||
}
|
||||
|
||||
inline
|
||||
char *Label::catstr(char *pString)
|
||||
{
|
||||
::strcat(pString,(char*)mLabelString);
|
||||
while(*pString)pString++;
|
||||
return pString;
|
||||
}
|
||||
|
||||
inline
|
||||
BYTE Label::format(void)const
|
||||
{
|
||||
return mFormat;
|
||||
}
|
||||
|
||||
inline
|
||||
void Label::format(BYTE format)
|
||||
{
|
||||
mFormat=format;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Label::column(void)const
|
||||
{
|
||||
return mColumn;
|
||||
}
|
||||
|
||||
inline
|
||||
void Label::column(WORD column)
|
||||
{
|
||||
mColumn=column;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Label::row(void)const
|
||||
{
|
||||
return mRow;
|
||||
}
|
||||
|
||||
inline
|
||||
void Label::row(WORD row)
|
||||
{
|
||||
mRow=row;
|
||||
}
|
||||
|
||||
inline
|
||||
Label::FormatPrefix Label::formatPrefix(void)const
|
||||
{
|
||||
return (FormatPrefix)mFormatPrefix;
|
||||
}
|
||||
|
||||
inline
|
||||
void Label::formatPrefix(FormatPrefix formatPrefix)
|
||||
{
|
||||
mFormatPrefix=(BYTE)formatPrefix;
|
||||
}
|
||||
|
||||
inline
|
||||
const String &Label::strLabel(void)const
|
||||
{
|
||||
return mLabelString;
|
||||
}
|
||||
|
||||
inline
|
||||
void Label::strLabel(const String &strLabel)
|
||||
{
|
||||
mLabelString=strLabel;
|
||||
}
|
||||
#endif
|
||||
|
||||
177
worksht/NUMBER.HPP
Normal file
177
worksht/NUMBER.HPP
Normal file
@@ -0,0 +1,177 @@
|
||||
#ifndef _WORKSHT_NUMBER_HPP_
|
||||
#define _WORKSHT_NUMBER_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_STRING_HPP_
|
||||
#include <common/string.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_STDIO_HPP_
|
||||
#include <common/stdio.hpp>
|
||||
#endif
|
||||
#ifndef _FILEIO_FILEIO_HPP_
|
||||
#include <fileio/fileio.hpp>
|
||||
#endif
|
||||
#ifndef _WORKSHT_RECORD_HPP_
|
||||
#include <worksht/record.hpp>
|
||||
#endif
|
||||
|
||||
class Number : public Record
|
||||
{
|
||||
public:
|
||||
Number(void);
|
||||
Number(const Number &someNumber);
|
||||
Number(const Record &someRecord);
|
||||
virtual ~Number();
|
||||
Number &operator=(const Number &someNumber);
|
||||
Number &operator=(const Record &someRecord);
|
||||
BOOL operator==(const Number &someNumber)const;
|
||||
operator String(void)const;
|
||||
char *catstr(char *pString);
|
||||
BYTE format(void)const;
|
||||
void format(BYTE format);
|
||||
WORD column(void)const;
|
||||
void column(WORD column);
|
||||
WORD row(void)const;
|
||||
void row(WORD row);
|
||||
double number(void)const;
|
||||
void number(double number);
|
||||
BOOL read(FileIO &inFile);
|
||||
private:
|
||||
BYTE mFormat;
|
||||
WORD mColumn;
|
||||
WORD mRow;
|
||||
double mNumber;
|
||||
};
|
||||
|
||||
inline
|
||||
Number::Number(void)
|
||||
: mFormat(0), mColumn(0), mRow(0), mNumber(0.00)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Number::Number(const Number &someNumber)
|
||||
{
|
||||
*this=someNumber;
|
||||
}
|
||||
|
||||
inline
|
||||
Number::Number(const Record &someRecord)
|
||||
: mFormat(0), mColumn(0), mRow(0), mNumber(0.00)
|
||||
{
|
||||
*this=someRecord;
|
||||
}
|
||||
|
||||
inline
|
||||
Number::~Number()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Number &Number::operator=(const Number &someNumber)
|
||||
{
|
||||
format(someNumber.format());
|
||||
column(someNumber.column());
|
||||
row(someNumber.row());
|
||||
number(someNumber.number());
|
||||
(Record&)*this=(Record&)someNumber;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
Number &Number::operator=(const Record &someRecord)
|
||||
{
|
||||
(Record&)*this=someRecord;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
Number::operator String(void)const
|
||||
{
|
||||
String strString;
|
||||
::sprintf(strString,"%9.3lf",number());
|
||||
return strString;
|
||||
}
|
||||
|
||||
inline
|
||||
char *Number::catstr(char *pString)
|
||||
{
|
||||
::sprintf(pString,"%9.3lf",number());
|
||||
while(*pString)pString++;
|
||||
return pString;
|
||||
}
|
||||
|
||||
inline
|
||||
BOOL Number::operator==(const Number &someNumber)const
|
||||
{
|
||||
return (format()==someNumber.format()&&
|
||||
column()==someNumber.column()&&
|
||||
row()==someNumber.row()&&
|
||||
number()==someNumber.number()&&
|
||||
(Record&)*this==(Record&)someNumber);
|
||||
}
|
||||
|
||||
inline
|
||||
BYTE Number::format(void)const
|
||||
{
|
||||
return mFormat;
|
||||
}
|
||||
|
||||
inline
|
||||
void Number::format(BYTE format)
|
||||
{
|
||||
mFormat=format;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Number::column(void)const
|
||||
{
|
||||
return mColumn;
|
||||
}
|
||||
|
||||
inline
|
||||
void Number::column(WORD column)
|
||||
{
|
||||
mColumn=column;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Number::row(void)const
|
||||
{
|
||||
return mRow;
|
||||
}
|
||||
|
||||
inline
|
||||
void Number::row(WORD row)
|
||||
{
|
||||
mRow=row;
|
||||
}
|
||||
|
||||
inline
|
||||
double Number::number(void)const
|
||||
{
|
||||
return mNumber;
|
||||
}
|
||||
|
||||
inline
|
||||
void Number::number(double number)
|
||||
{
|
||||
mNumber=number;
|
||||
}
|
||||
|
||||
inline
|
||||
BOOL Number::read(FileIO &inFile)
|
||||
{
|
||||
if(!inFile.read((char*)&mFormat))return FALSE;
|
||||
if(!inFile.read((char*)&mColumn,sizeof(mColumn)))return FALSE;
|
||||
if(!inFile.read((char*)&mRow,sizeof(mRow)))return FALSE;
|
||||
if(!inFile.read((char*)&mNumber,sizeof(mNumber)))return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
185
worksht/RECORD.HPP
Normal file
185
worksht/RECORD.HPP
Normal file
@@ -0,0 +1,185 @@
|
||||
#ifndef _WORKSHT_RECORD_HPP_
|
||||
#define _WORKSHT_RECORD_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_STRING_HPP_
|
||||
#include <common/string.hpp>
|
||||
#endif
|
||||
#ifndef _FILEIO_FILEIO_HPP_
|
||||
#include <fileio/fileio.hpp>
|
||||
#endif
|
||||
|
||||
class Record
|
||||
{
|
||||
public:
|
||||
enum RecordType{Split=0x04,Sync=0x05,Win1=0x07,Win2=0x09,ColW2=0x0A,Name=0x0B,QRange=0x19,PRange=0x1A,
|
||||
SRange=0x1B,KRange1=0x1D,KRange2=0x23,Footer=0x25,Header=0x26,Setup=0x27,Margins=0x28,Titles=0x2A,
|
||||
Graph=0x2D,NGraph=0x2E,Bof=0x00,Eof=0x01,CalcMode=0x02,CalcOrder=0x03,Range=0x06,ColW1=0x08,Blank=0x0C,
|
||||
Integer=0x0D,Number=0x0E,Label=0x0F,Formula=0x10,Table=0x18,FRange=0x1C,HRange=0x20,Protec=0x24,
|
||||
LabelFmt=0x29,CalcCount=0x2F,UnFormatted=0x30,CursorW12=0x31};
|
||||
Record(void);
|
||||
Record(const Record &someRecord);
|
||||
Record(RecordType type,WORD length);
|
||||
virtual ~Record();
|
||||
Record &operator=(const Record &someRecord);
|
||||
BOOL operator==(const Record &someRecord);
|
||||
operator String(void)const;
|
||||
RecordType type(void)const;
|
||||
void type(RecordType type);
|
||||
WORD length(void)const;
|
||||
void length(WORD length);
|
||||
bool read(FileIO &inFile);
|
||||
bool write(FileIO &outFile);
|
||||
String toString(void)const;
|
||||
private:
|
||||
RecordType mRecordType;
|
||||
WORD mRecordLength;
|
||||
};
|
||||
|
||||
inline
|
||||
Record::Record(void)
|
||||
: mRecordType(Eof), mRecordLength(0)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Record::Record(RecordType type,WORD length)
|
||||
: mRecordType(type), mRecordLength(length)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Record::Record(const Record &someRecord)
|
||||
{
|
||||
*this=someRecord;
|
||||
}
|
||||
|
||||
inline
|
||||
Record::~Record()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Record &Record::operator=(const Record &someRecord)
|
||||
{
|
||||
type(someRecord.type());
|
||||
length(someRecord.length());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
BOOL Record::operator==(const Record &someRecord)
|
||||
{
|
||||
return (type()==someRecord.type()&&
|
||||
length()==someRecord.length());
|
||||
}
|
||||
|
||||
inline
|
||||
Record::operator String(void)const
|
||||
{
|
||||
switch(type())
|
||||
{
|
||||
case Split :
|
||||
return "Split";
|
||||
case Sync :
|
||||
return "Sync";
|
||||
case Win1 :
|
||||
return "Win1";
|
||||
case Win2 :
|
||||
return "Win2";
|
||||
case ColW2 :
|
||||
return "ColW2";
|
||||
case Name :
|
||||
return "Name";
|
||||
case QRange :
|
||||
return "QRange";
|
||||
case PRange :
|
||||
return "PRange";
|
||||
case SRange :
|
||||
return "SRange";
|
||||
case KRange1 :
|
||||
return "KRange1";
|
||||
case KRange2 :
|
||||
return "KRange2";
|
||||
case Footer :
|
||||
return "Footer";
|
||||
case Header :
|
||||
return "Header";
|
||||
case Setup :
|
||||
return "Setup";
|
||||
case Margins :
|
||||
return "Margins";
|
||||
case Titles :
|
||||
return "Titles";
|
||||
case Graph :
|
||||
return "Graph";
|
||||
case NGraph :
|
||||
return "NGraph";
|
||||
case Bof :
|
||||
return "Bof";
|
||||
case Eof :
|
||||
return "Eof";
|
||||
case CalcMode :
|
||||
return "CalcMode";
|
||||
case CalcOrder :
|
||||
return "CalcOrder";
|
||||
case Range :
|
||||
return "Range";
|
||||
case ColW1 :
|
||||
return "ColW1";
|
||||
case Blank :
|
||||
return "Blank";
|
||||
case Integer :
|
||||
return "Integer";
|
||||
case Number :
|
||||
return "Number";
|
||||
case Label :
|
||||
return "Label";
|
||||
case Formula :
|
||||
return "Formula";
|
||||
case Table :
|
||||
return "Table";
|
||||
case FRange :
|
||||
return "FRange";
|
||||
case HRange :
|
||||
return "HRange";
|
||||
case Protec :
|
||||
return "Protec";
|
||||
case LabelFmt :
|
||||
return "LabelFmt";
|
||||
case CalcCount :
|
||||
return "CalcCount";
|
||||
case UnFormatted :
|
||||
return "Unformatted";
|
||||
case CursorW12 :
|
||||
return "CursorW12";
|
||||
default :
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
Record::RecordType Record::type(void)const
|
||||
{
|
||||
return mRecordType;
|
||||
}
|
||||
|
||||
inline
|
||||
void Record::type(RecordType type)
|
||||
{
|
||||
mRecordType=type;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD Record::length(void)const
|
||||
{
|
||||
return mRecordLength;
|
||||
}
|
||||
|
||||
inline
|
||||
void Record::length(WORD length)
|
||||
{
|
||||
mRecordLength=length;
|
||||
}
|
||||
#endif
|
||||
213
worksht/WORKSHT.001
Normal file
213
worksht/WORKSHT.001
Normal file
@@ -0,0 +1,213 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=worksht - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to worksht - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "worksht - Win32 Release" && "$(CFG)" !=\
|
||||
"worksht - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE on this makefile
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "worksht.mak" CFG="worksht - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "worksht - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "worksht - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
################################################################################
|
||||
# Begin Project
|
||||
# PROP Target_Last_Scanned "worksht - Win32 Debug"
|
||||
CPP=cl.exe
|
||||
|
||||
!IF "$(CFG)" == "worksht - 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 ""
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
|
||||
ALL : "$(OUTDIR)\worksht.lib"
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\Label.obj"
|
||||
-@erase "$(INTDIR)\Worksht.obj"
|
||||
-@erase "$(OUTDIR)\worksht.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
|
||||
/Fp"$(INTDIR)/worksht.pch" /YX /Fo"$(INTDIR)/" /c
|
||||
CPP_OBJS=.\Release/
|
||||
CPP_SBRS=.\.
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)/worksht.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
LIB32_FLAGS=/nologo /out:"$(OUTDIR)/worksht.lib"
|
||||
LIB32_OBJS= \
|
||||
"$(INTDIR)\Label.obj" \
|
||||
"$(INTDIR)\Worksht.obj"
|
||||
|
||||
"$(OUTDIR)\worksht.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
|
||||
$(LIB32) @<<
|
||||
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "worksht - 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 "msvcobj"
|
||||
# PROP Intermediate_Dir "msvcobj"
|
||||
# PROP Target_Dir ""
|
||||
OUTDIR=.\msvcobj
|
||||
INTDIR=.\msvcobj
|
||||
|
||||
ALL : "..\exe\worksht.lib"
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\Label.obj"
|
||||
-@erase "$(INTDIR)\Worksht.obj"
|
||||
-@erase "..\exe\worksht.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /Zp1 /MTd /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /c
|
||||
CPP_PROJ=/nologo /Zp1 /MTd /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D\
|
||||
"STRICT" /D "__FLAT__" /Fp"$(INTDIR)/worksht.pch" /YX /Fo"$(INTDIR)/" /c
|
||||
CPP_OBJS=.\msvcobj/
|
||||
CPP_SBRS=.\.
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)/worksht.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\exe\worksht.lib"
|
||||
LIB32_FLAGS=/nologo /out:"..\exe\worksht.lib"
|
||||
LIB32_OBJS= \
|
||||
"$(INTDIR)\Label.obj" \
|
||||
"$(INTDIR)\Worksht.obj"
|
||||
|
||||
"..\exe\worksht.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
|
||||
$(LIB32) @<<
|
||||
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
.c{$(CPP_OBJS)}.obj:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cpp{$(CPP_OBJS)}.obj:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cxx{$(CPP_OBJS)}.obj:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.c{$(CPP_SBRS)}.sbr:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cpp{$(CPP_SBRS)}.sbr:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cxx{$(CPP_SBRS)}.sbr:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
################################################################################
|
||||
# Begin Target
|
||||
|
||||
# Name "worksht - Win32 Release"
|
||||
# Name "worksht - Win32 Debug"
|
||||
|
||||
!IF "$(CFG)" == "worksht - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "worksht - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Worksht.cpp
|
||||
DEP_CPP_WORKS=\
|
||||
{$(INCLUDE)}"\.\integer.hpp"\
|
||||
{$(INCLUDE)}"\.\label.hpp"\
|
||||
{$(INCLUDE)}"\.\number.hpp"\
|
||||
{$(INCLUDE)}"\.\record.hpp"\
|
||||
{$(INCLUDE)}"\.\worksht.hpp"\
|
||||
{$(INCLUDE)}"\common\array.hpp"\
|
||||
{$(INCLUDE)}"\common\assert.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\pointer.hpp"\
|
||||
{$(INCLUDE)}"\common\stdio.hpp"\
|
||||
{$(INCLUDE)}"\common\stdlib.hpp"\
|
||||
{$(INCLUDE)}"\common\string.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
{$(INCLUDE)}"\fileio\fileio.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Worksht.obj" : $(SOURCE) $(DEP_CPP_WORKS) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Label.cpp
|
||||
DEP_CPP_LABEL=\
|
||||
{$(INCLUDE)}"\.\label.hpp"\
|
||||
{$(INCLUDE)}"\.\record.hpp"\
|
||||
{$(INCLUDE)}"\common\stdlib.hpp"\
|
||||
{$(INCLUDE)}"\common\string.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
{$(INCLUDE)}"\fileio\fileio.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Label.obj" : $(SOURCE) $(DEP_CPP_LABEL) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
################################################################################
|
||||
175
worksht/WORKSHT.CPP
Normal file
175
worksht/WORKSHT.CPP
Normal file
@@ -0,0 +1,175 @@
|
||||
#include <worksht/worksht.hpp>
|
||||
|
||||
BOOL Worksheet::open(const String &strPathFileName)
|
||||
{
|
||||
Array<ColumnData> &matrix=mMatrix;
|
||||
Record lotusRecord;
|
||||
char buffer[1024];
|
||||
char charByte;
|
||||
FileIO inFile;
|
||||
int maxRow(0);
|
||||
int maxCol(0);
|
||||
BOOL isFirstPass;
|
||||
|
||||
mRows=0;
|
||||
mCols=0;
|
||||
isFirstPass=TRUE;
|
||||
if(!inFile.open(strPathFileName))return FALSE;
|
||||
for(int pass=0;pass<2;pass++)
|
||||
{
|
||||
if(1==pass)
|
||||
{
|
||||
inFile.rewind();
|
||||
matrix.size(maxRow+1);
|
||||
for(int index=0;index<mMatrix.size();index++)matrix[index].size(maxCol+1);
|
||||
}
|
||||
while(TRUE)
|
||||
{
|
||||
processEvents();
|
||||
if(!lotusRecord.read(inFile))break;
|
||||
|
||||
::OutputDebugString(lotusRecord.toString()+String("\n"));
|
||||
|
||||
if(isFirstPass)
|
||||
{
|
||||
if(Record::Bof!=lotusRecord.type())return FALSE;
|
||||
isFirstPass=FALSE;
|
||||
}
|
||||
if(Record::Label==lotusRecord.type())
|
||||
{
|
||||
Label label(lotusRecord);
|
||||
label.read(inFile);
|
||||
if(label.row()>maxRow)maxRow=label.row();
|
||||
if(label.column()>maxCol)maxCol=label.column();
|
||||
if(!pass)continue;
|
||||
(matrix[label.row()])[label.column()]=::new Label(label);
|
||||
(matrix[label.row()])[label.column()].disposition(PointerDisposition::Delete);
|
||||
continue;
|
||||
}
|
||||
if(Record::Number==lotusRecord.type())
|
||||
{
|
||||
Number number(lotusRecord);
|
||||
number.read(inFile);
|
||||
if(number.row()>maxRow)maxRow=number.row();
|
||||
if(number.column()>maxCol)maxCol=number.column();
|
||||
if(!pass)continue;
|
||||
(matrix[number.row()])[number.column()]=::new Number(number);
|
||||
(matrix[number.row()])[number.column()].disposition(PointerDisposition::Delete);
|
||||
continue;
|
||||
}
|
||||
if(Record::Integer==lotusRecord.type())
|
||||
{
|
||||
Integer integer(lotusRecord);
|
||||
integer.read(inFile);
|
||||
if(integer.row()>maxRow)maxRow=integer.row();
|
||||
if(integer.column()>maxCol)maxCol=integer.column();
|
||||
if(!pass)continue;
|
||||
(matrix[integer.row()])[integer.column()]=::new Integer(integer);
|
||||
(matrix[integer.row()])[integer.column()].disposition(PointerDisposition::Delete);
|
||||
continue;
|
||||
}
|
||||
if(Record::Formula==lotusRecord.type()){::OutputDebugString("Formula encountered\n");break;}
|
||||
if(Record::Eof==lotusRecord.type())break;
|
||||
if(lotusRecord.length()<sizeof(buffer))inFile.read(buffer,lotusRecord.length());
|
||||
else for(int index=0;index<lotusRecord.length();index++)inFile.read(&charByte);
|
||||
}
|
||||
}
|
||||
mRows=maxRow;
|
||||
mCols=maxCol;
|
||||
return (maxRow&&maxCol);
|
||||
}
|
||||
|
||||
BOOL Worksheet::save(const String &strPathFileName)
|
||||
{
|
||||
Array<ColumnData> &matrix=mMatrix;
|
||||
FileIO outFile;
|
||||
BYTE header[]={0x06,0x04};
|
||||
BYTE format[]={0x27};
|
||||
|
||||
if(!outFile.open(strPathFileName,FileIO::GenericWrite,FileIO::FileShareRead,FileIO::CreateAlways))return FALSE;
|
||||
Record lotusRecord(Record::Bof,2);
|
||||
lotusRecord.write(outFile);
|
||||
outFile.write(header,sizeof(header));
|
||||
|
||||
lotusRecord.type(Record::LabelFmt);
|
||||
lotusRecord.length(1);
|
||||
lotusRecord.write(outFile);
|
||||
outFile.write(format,sizeof(format));
|
||||
|
||||
for(int row=0;row<rows();row++)
|
||||
{
|
||||
processEvents();
|
||||
for(int col=0;col<cols();col++)
|
||||
{
|
||||
if(!(matrix[row])[col].isOkay())continue;
|
||||
Record &record=*(matrix[row])[col];
|
||||
if(Record::Label==record.type())
|
||||
{
|
||||
Label &label=(Label&)record;
|
||||
label.write(outFile);
|
||||
}
|
||||
else if(Record::Number==record.type())
|
||||
{
|
||||
Number &number=(Number&)record;
|
||||
number.write(outFile);
|
||||
}
|
||||
else if(Record::Integer==record.type())
|
||||
{
|
||||
Integer &integer=(Integer&)record;
|
||||
integer.write(outFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lotusRecord.type(Record::Eof);
|
||||
lotusRecord.length(0);
|
||||
lotusRecord.write(outFile);
|
||||
|
||||
outFile.flush();
|
||||
outFile.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL Worksheet::saveText(const String &strPathFileName)
|
||||
{
|
||||
Array<ColumnData> &matrix=mMatrix;
|
||||
String strColumn;
|
||||
FileIO outFile;
|
||||
char *pCursor;
|
||||
|
||||
if(!outFile.open(strPathFileName,FileIO::GenericWrite,FileIO::FileShareRead,FileIO::CreateAlways))return FALSE;
|
||||
strColumn.reserve(MaxColumn);
|
||||
for(int row=0;row<rows();row++)
|
||||
{
|
||||
processEvents();
|
||||
::memset((char*)strColumn,0,MaxColumn);
|
||||
pCursor=strColumn;
|
||||
for(int col=0;col<cols();col++)
|
||||
{
|
||||
if(!(matrix[row])[col].isOkay())continue;
|
||||
Record &record=*(matrix[row])[col];
|
||||
if(Record::Label==record.type())pCursor=((Label&)record).catstr(pCursor);
|
||||
else if(Record::Number==record.type())pCursor=((Number&)record).catstr(pCursor);
|
||||
else if(Record::Integer==record.type())pCursor=((Integer&)record).catstr(pCursor);
|
||||
::strcat(pCursor," ");
|
||||
while(*pCursor)pCursor++;
|
||||
}
|
||||
::strcat(pCursor,"\n");
|
||||
outFile.write((char*)strColumn,(pCursor-(char*)strColumn)+1);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Worksheet::setDimensions(UINT rows,UINT cols)
|
||||
{
|
||||
mMatrix.size(rows+1);
|
||||
for(int row=0;row<rows;row++)mMatrix[row].size(cols+1);
|
||||
mRows=rows;
|
||||
mCols=cols;
|
||||
}
|
||||
|
||||
// virtuals
|
||||
|
||||
void Worksheet::processEvents(void)
|
||||
{
|
||||
}
|
||||
132
worksht/WORKSHT.DSP
Normal file
132
worksht/WORKSHT.DSP
Normal file
@@ -0,0 +1,132 @@
|
||||
# Microsoft Developer Studio Project File - Name="worksht" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=worksht - Win32 Release
|
||||
!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 "WORKSHT.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 "WORKSHT.MAK" CFG="worksht - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "worksht - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "worksht - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "worksht - 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 "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409
|
||||
# ADD RSC /l 0x409
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "worksht - 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 ".\msvcobj"
|
||||
# PROP Intermediate_Dir ".\msvcobj"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /MTd /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409
|
||||
# ADD RSC /l 0x409
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\exe\worksht.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "worksht - Win32 Release"
|
||||
# Name "worksht - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\integer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Label.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\record.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Worksht.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\integer.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\label.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\number.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\record.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\worksht.hpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
29
worksht/WORKSHT.DSW
Normal file
29
worksht/WORKSHT.DSW
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "worksht"=.\WORKSHT.DSP - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
140
worksht/WORKSHT.HPP
Normal file
140
worksht/WORKSHT.HPP
Normal file
@@ -0,0 +1,140 @@
|
||||
#ifndef _WORKSHT_WORKSHEET_HPP_
|
||||
#define _WORKSHT_WORKSHEET_HPP_
|
||||
#ifndef _COMMON_ARRAY_HPP_
|
||||
#include <common/array.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_SMARTPOINTER_HPP_
|
||||
#include <common/pointer.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_ASSERT_HPP_
|
||||
#include <common/assert.hpp>
|
||||
#endif
|
||||
#ifndef _WORKSHT_RECORD_HPP_
|
||||
#include <worksht/record.hpp>
|
||||
#endif
|
||||
#ifndef _WORKSHT_LABEL_HPP_
|
||||
#include <worksht/label.hpp>
|
||||
#endif
|
||||
#ifndef _WORKSHT_NUMBER_HPP_
|
||||
#include <worksht/number.hpp>
|
||||
#endif
|
||||
#ifndef _WORKSHT_INTEGER_HPP_
|
||||
#include <worksht/integer.hpp>
|
||||
#endif
|
||||
#ifndef _FILEIO_FILEIO_HPP_
|
||||
#include <fileio/fileio.hpp>
|
||||
#endif
|
||||
|
||||
class Worksheet
|
||||
{
|
||||
public:
|
||||
typedef Array<SmartPointer<Record> > ColumnData;
|
||||
Worksheet(void);
|
||||
virtual ~Worksheet();
|
||||
ColumnData &operator[](UINT index);
|
||||
UINT rows(void)const;
|
||||
UINT cols(void)const;
|
||||
void setDimensions(UINT rows,UINT cols);
|
||||
bool setAt(int row,int col,SmartPointer<Record> &record);
|
||||
bool setAt(int row,int col,const String &strLabel);
|
||||
bool setAt(int row,int col,WORD value);
|
||||
BOOL open(const String &strPathFileName);
|
||||
BOOL save(const String &strPathFileName);
|
||||
BOOL saveText(const String &strPathFileName);
|
||||
BOOL isOkay(void)const;
|
||||
protected:
|
||||
virtual void processEvents(void);
|
||||
private:
|
||||
enum{MaxColumn=16384};
|
||||
Worksheet(const Worksheet &someWorksheet);
|
||||
Worksheet &operator=(const Worksheet &someWorksheet);
|
||||
BOOL operator==(const Worksheet &someWorksheet);
|
||||
Array<ColumnData> mMatrix;
|
||||
Record mLotusRecord;
|
||||
UINT mRows;
|
||||
UINT mCols;
|
||||
};
|
||||
|
||||
inline
|
||||
Worksheet::Worksheet(void)
|
||||
: mRows(0), mCols(0)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Worksheet::Worksheet(const Worksheet &someWorksheet)
|
||||
{ // private implmentation
|
||||
*this=someWorksheet;
|
||||
}
|
||||
|
||||
inline
|
||||
Worksheet::~Worksheet()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Worksheet &Worksheet::operator=(const Worksheet &/*someWorksheet*/)
|
||||
{ // private implementation
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
BOOL Worksheet::operator==(const Worksheet &/*someWorksheet*/)
|
||||
{ // private implementation
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
inline
|
||||
Worksheet::ColumnData &Worksheet::operator[](UINT index)
|
||||
{
|
||||
assert(index<mMatrix.size());
|
||||
return mMatrix[index];
|
||||
}
|
||||
|
||||
inline
|
||||
UINT Worksheet::rows(void)const
|
||||
{
|
||||
return mRows;
|
||||
}
|
||||
|
||||
inline
|
||||
UINT Worksheet::cols(void)const
|
||||
{
|
||||
return mCols;
|
||||
}
|
||||
|
||||
inline
|
||||
bool Worksheet::setAt(int row,int col,SmartPointer<Record> &record)
|
||||
{
|
||||
if(row>=rows()||col>=cols())return false;
|
||||
record.disposition(PointerDisposition::Assume);
|
||||
(mMatrix[row])[col]=record;
|
||||
(mMatrix[row])[col].disposition(PointerDisposition::Delete);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline
|
||||
bool Worksheet::setAt(int row,int col,const String &strLabel)
|
||||
{
|
||||
SmartPointer<Record> label=new Label(row,col,strLabel);
|
||||
setAt(row,col,label);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline
|
||||
bool Worksheet::setAt(int row,int col,WORD value)
|
||||
{
|
||||
if(row>=rows()||col>=cols())return false;
|
||||
SmartPointer<Record> integer=new Integer(row,col,value);
|
||||
integer.disposition(PointerDisposition::Assume);
|
||||
(mMatrix[row])[col]=integer;
|
||||
(mMatrix[row])[col].disposition(PointerDisposition::Delete);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline
|
||||
BOOL Worksheet::isOkay(void)const
|
||||
{
|
||||
return (rows()&&cols());
|
||||
}
|
||||
#endif
|
||||
213
worksht/WORKSHT.MAK
Normal file
213
worksht/WORKSHT.MAK
Normal file
@@ -0,0 +1,213 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=worksht - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to worksht - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "worksht - Win32 Release" && "$(CFG)" !=\
|
||||
"worksht - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE on this makefile
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "worksht.mak" CFG="worksht - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "worksht - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "worksht - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
################################################################################
|
||||
# Begin Project
|
||||
# PROP Target_Last_Scanned "worksht - Win32 Debug"
|
||||
CPP=cl.exe
|
||||
|
||||
!IF "$(CFG)" == "worksht - 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 ""
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
|
||||
ALL : "$(OUTDIR)\worksht.lib"
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\Label.obj"
|
||||
-@erase "$(INTDIR)\Worksht.obj"
|
||||
-@erase "$(OUTDIR)\worksht.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
|
||||
/Fp"$(INTDIR)/worksht.pch" /YX /Fo"$(INTDIR)/" /c
|
||||
CPP_OBJS=.\Release/
|
||||
CPP_SBRS=.\.
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)/worksht.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
LIB32_FLAGS=/nologo /out:"$(OUTDIR)/worksht.lib"
|
||||
LIB32_OBJS= \
|
||||
"$(INTDIR)\Label.obj" \
|
||||
"$(INTDIR)\Worksht.obj"
|
||||
|
||||
"$(OUTDIR)\worksht.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
|
||||
$(LIB32) @<<
|
||||
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "worksht - 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 "msvcobj"
|
||||
# PROP Intermediate_Dir "msvcobj"
|
||||
# PROP Target_Dir ""
|
||||
OUTDIR=.\msvcobj
|
||||
INTDIR=.\msvcobj
|
||||
|
||||
ALL : "..\exe\worksht.lib"
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\Label.obj"
|
||||
-@erase "$(INTDIR)\Worksht.obj"
|
||||
-@erase "..\exe\worksht.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /Zp1 /MTd /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /c
|
||||
CPP_PROJ=/nologo /Zp1 /MTd /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D\
|
||||
"STRICT" /D "__FLAT__" /Fp"$(INTDIR)/worksht.pch" /YX /Fo"$(INTDIR)/" /c
|
||||
CPP_OBJS=.\msvcobj/
|
||||
CPP_SBRS=.\.
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)/worksht.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\exe\worksht.lib"
|
||||
LIB32_FLAGS=/nologo /out:"..\exe\worksht.lib"
|
||||
LIB32_OBJS= \
|
||||
"$(INTDIR)\Label.obj" \
|
||||
"$(INTDIR)\Worksht.obj"
|
||||
|
||||
"..\exe\worksht.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
|
||||
$(LIB32) @<<
|
||||
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
.c{$(CPP_OBJS)}.obj:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cpp{$(CPP_OBJS)}.obj:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cxx{$(CPP_OBJS)}.obj:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.c{$(CPP_SBRS)}.sbr:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cpp{$(CPP_SBRS)}.sbr:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cxx{$(CPP_SBRS)}.sbr:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
################################################################################
|
||||
# Begin Target
|
||||
|
||||
# Name "worksht - Win32 Release"
|
||||
# Name "worksht - Win32 Debug"
|
||||
|
||||
!IF "$(CFG)" == "worksht - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "worksht - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Worksht.cpp
|
||||
DEP_CPP_WORKS=\
|
||||
{$(INCLUDE)}"\.\integer.hpp"\
|
||||
{$(INCLUDE)}"\.\label.hpp"\
|
||||
{$(INCLUDE)}"\.\number.hpp"\
|
||||
{$(INCLUDE)}"\.\record.hpp"\
|
||||
{$(INCLUDE)}"\.\worksht.hpp"\
|
||||
{$(INCLUDE)}"\common\array.hpp"\
|
||||
{$(INCLUDE)}"\common\assert.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\pointer.hpp"\
|
||||
{$(INCLUDE)}"\common\stdio.hpp"\
|
||||
{$(INCLUDE)}"\common\stdlib.hpp"\
|
||||
{$(INCLUDE)}"\common\string.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
{$(INCLUDE)}"\fileio\fileio.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Worksht.obj" : $(SOURCE) $(DEP_CPP_WORKS) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Label.cpp
|
||||
DEP_CPP_LABEL=\
|
||||
{$(INCLUDE)}"\.\label.hpp"\
|
||||
{$(INCLUDE)}"\.\record.hpp"\
|
||||
{$(INCLUDE)}"\common\stdlib.hpp"\
|
||||
{$(INCLUDE)}"\common\string.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
{$(INCLUDE)}"\fileio\fileio.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Label.obj" : $(SOURCE) $(DEP_CPP_LABEL) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
################################################################################
|
||||
BIN
worksht/WORKSHT.MDP
Normal file
BIN
worksht/WORKSHT.MDP
Normal file
Binary file not shown.
BIN
worksht/WORKSHT.OPT
Normal file
BIN
worksht/WORKSHT.OPT
Normal file
Binary file not shown.
16
worksht/WORKSHT.PLG
Normal file
16
worksht/WORKSHT.PLG
Normal file
@@ -0,0 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: worksht - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
worksht.lib - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
BIN
worksht/WORKSHT.ncb
Normal file
BIN
worksht/WORKSHT.ncb
Normal file
Binary file not shown.
86
worksht/WORKSH~1.DSP
Normal file
86
worksht/WORKSH~1.DSP
Normal file
@@ -0,0 +1,86 @@
|
||||
# Microsoft Developer Studio Project File - Name="worksheet" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=worksheet - 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 "worksheet.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 "worksheet.mak" CFG="worksheet - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "worksheet - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "worksheet - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
|
||||
!IF "$(CFG)" == "worksheet - 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 "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "worksheet - 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 "msvcobj"
|
||||
# PROP Intermediate_Dir "msvcobj"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /Zp1 /MTd /GX /Z7 /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /FD /c
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\exe\worksht.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "worksheet - Win32 Release"
|
||||
# Name "worksheet - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\label.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\worksht.cpp
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
29
worksht/WORKSH~1.DSW
Normal file
29
worksht/WORKSH~1.DSW
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 5.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "worksheet"=.\worksheet.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
25
worksht/WORKSH~1.PLG
Normal file
25
worksht/WORKSH~1.PLG
Normal file
@@ -0,0 +1,25 @@
|
||||
--------------------Configuration: worksheet - Win32 Debug--------------------
|
||||
Begining build with project "C:\work\worksht\worksheet.dsp", at root.
|
||||
Active configuration is Win32 (x86) Static Library (based on Win32 (x86) Static Library)
|
||||
|
||||
Project's tools are:
|
||||
"32-bit C/C++ Compiler for 80x86" with flags "/nologo /Zp1 /MTd /GX /Z7 /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /Fp"msvcobj/worksheet.pch" /YX /Fo"msvcobj/" /Fd"msvcobj/" /FD /c "
|
||||
"Browser Database Maker" with flags "/nologo /o"msvcobj/worksheet.bsc" "
|
||||
"Library Manager" with flags "/nologo /out:"..\exe\worksht.lib" "
|
||||
"Custom Build" with flags ""
|
||||
"<Component 0xa>" with flags ""
|
||||
|
||||
Creating temp file "c:\windows\TEMP\RSP4083.TMP" with contents </nologo /Zp1 /MTd /GX /Z7 /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /Fp"msvcobj/worksheet.pch" /YX /Fo"msvcobj/" /Fd"msvcobj/" /FD /c
|
||||
"C:\work\worksht\label.cpp"
|
||||
"C:\work\worksht\worksht.cpp"
|
||||
>
|
||||
Creating command line "cl.exe @c:\windows\TEMP\RSP4083.TMP"
|
||||
Creating command line "link.exe -lib /nologo /out:"..\exe\worksht.lib" .\msvcobj\label.obj .\msvcobj\worksht.obj"
|
||||
Compiling...
|
||||
label.cpp
|
||||
worksht.cpp
|
||||
Creating library...
|
||||
|
||||
|
||||
|
||||
worksht.lib - 0 error(s), 0 warning(s)
|
||||
22
worksht/integer.cpp
Normal file
22
worksht/integer.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <worksht/integer.hpp>
|
||||
|
||||
bool Integer::read(FileIO &inFile)
|
||||
{
|
||||
if(!inFile.read((char*)&mFormat,sizeof(mFormat)))return false;
|
||||
if(!inFile.read((char*)&mColumn,sizeof(mColumn)))return false;
|
||||
if(!inFile.read((char*)&mRow,sizeof(mRow)))return false;
|
||||
if(!inFile.read((char*)&mInteger,sizeof(mInteger)))return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Integer::write(FileIO &outFile)
|
||||
{
|
||||
type(Record::Integer);
|
||||
length(sizeof(mFormat)+sizeof(mColumn)+sizeof(mRow)+sizeof(mInteger));
|
||||
Record::write(outFile);
|
||||
if(!outFile.write((char*)&mFormat,sizeof(mFormat)))return false;
|
||||
if(!outFile.write((char*)&mColumn,sizeof(mColumn)))return false;
|
||||
if(!outFile.write((char*)&mRow,sizeof(mRow)))return false;
|
||||
if(!outFile.write((char*)&mInteger,sizeof(mInteger)))return false;
|
||||
return true;
|
||||
}
|
||||
141
worksht/record.cpp
Normal file
141
worksht/record.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
#include <worksht/record.hpp>
|
||||
|
||||
bool Record::read(FileIO &inFile)
|
||||
{
|
||||
WORD wType;
|
||||
|
||||
if(!inFile.isOkay())return FALSE;
|
||||
if(!inFile.read((char*)&wType,sizeof(wType)))return FALSE;
|
||||
type((RecordType)wType);
|
||||
if(!inFile.read((char*)&mRecordLength,sizeof(mRecordLength)))return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool Record::write(FileIO &outFile)
|
||||
{
|
||||
WORD wType=mRecordType;
|
||||
if(!outFile.isOkay())return false;
|
||||
if(!outFile.write((char*)&wType,sizeof(wType)))return false;
|
||||
if(!outFile.write((char*)&mRecordLength,sizeof(mRecordLength)))return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
String Record::toString(void)const
|
||||
{
|
||||
switch(type())
|
||||
{
|
||||
case Split :
|
||||
return "Split";
|
||||
break;
|
||||
case Sync :
|
||||
return "Sync";
|
||||
break;
|
||||
case Win1 :
|
||||
return "Win1";
|
||||
break;
|
||||
case Win2 :
|
||||
return "Win2";
|
||||
break;
|
||||
case ColW2 :
|
||||
return "ColW2";
|
||||
break;
|
||||
case Name :
|
||||
return "Name";
|
||||
break;
|
||||
case QRange :
|
||||
return "QRange";
|
||||
break;
|
||||
case PRange :
|
||||
return "PRange";
|
||||
break;
|
||||
case SRange :
|
||||
return "SRange";
|
||||
break;
|
||||
case KRange1 :
|
||||
return "KRange1";
|
||||
break;
|
||||
case KRange2 :
|
||||
return "KRange2";
|
||||
break;
|
||||
case Footer :
|
||||
return "Footer";
|
||||
break;
|
||||
case Header :
|
||||
return "Header";
|
||||
break;
|
||||
case Setup :
|
||||
return "Setup";
|
||||
break;
|
||||
case Margins :
|
||||
return "Margins";
|
||||
break;
|
||||
case Titles :
|
||||
return "Titles";
|
||||
break;
|
||||
case Graph :
|
||||
return "Graph";
|
||||
break;
|
||||
case NGraph :
|
||||
return "NGraph";
|
||||
break;
|
||||
case Bof :
|
||||
return "Bof";
|
||||
break;
|
||||
case Eof :
|
||||
return "Eof";
|
||||
break;
|
||||
case CalcMode :
|
||||
return "CalcMode";
|
||||
break;
|
||||
case CalcOrder :
|
||||
return "CalcOrder";
|
||||
break;
|
||||
case Range :
|
||||
return "Range";
|
||||
break;
|
||||
case ColW1 :
|
||||
return "ColW1";
|
||||
break;
|
||||
case Blank :
|
||||
return "Blank";
|
||||
break;
|
||||
case Integer :
|
||||
return "Integer";
|
||||
break;
|
||||
case Number :
|
||||
return "Number";
|
||||
break;
|
||||
case Label :
|
||||
return "Label";
|
||||
break;
|
||||
case Formula :
|
||||
return "Formula";
|
||||
break;
|
||||
case Table :
|
||||
return "Table";
|
||||
break;
|
||||
case FRange :
|
||||
return "FRange";
|
||||
break;
|
||||
case HRange :
|
||||
return "HRange";
|
||||
break;
|
||||
case Protec :
|
||||
return "Protec";
|
||||
break;
|
||||
case LabelFmt :
|
||||
return "LabelFmt";
|
||||
break;
|
||||
case CalcCount :
|
||||
return "CalcCount";
|
||||
break;
|
||||
case UnFormatted :
|
||||
return "Unformatted";
|
||||
break;
|
||||
case CursorW12 :
|
||||
return "CursorW12";
|
||||
break;
|
||||
default :
|
||||
return String("Unknown ")+String().fromInt((int)type());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user