182 lines
3.1 KiB
C++
182 lines
3.1 KiB
C++
#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
|
|
|