Initial
This commit is contained in:
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user