Initial
This commit is contained in:
85
test/CHAR.HPP
Normal file
85
test/CHAR.HPP
Normal file
@@ -0,0 +1,85 @@
|
||||
#ifndef _TEST_CHAR_HPP_
|
||||
#define _TEST_CHAR_HPP_
|
||||
|
||||
typedef char Attribute;
|
||||
|
||||
class Char
|
||||
{
|
||||
public:
|
||||
Char(void);
|
||||
Char(char charData,Attribute attribute=0);
|
||||
Char(const Char &someChar);
|
||||
Char &operator=(const Char &someChar);
|
||||
bool operator==(const Char &someChar)const;
|
||||
~Char(); // must not be virtual
|
||||
char getChar(void)const;
|
||||
void setChar(char someChar);
|
||||
Attribute getAttribute(void)const;
|
||||
void setAttribute(Attribute attribute);
|
||||
private:
|
||||
char mChar;
|
||||
Attribute mAttribute;
|
||||
};
|
||||
|
||||
inline
|
||||
Char::Char(void)
|
||||
: mChar(0), mAttribute(0)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Char::Char(char charData,Attribute attribute)
|
||||
: mChar(charData), mAttribute(attribute)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Char::Char(const Char &someChar)
|
||||
: mChar(someChar.mChar), mAttribute(someChar.mAttribute)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Char::~Char()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Char &Char::operator=(const Char &someChar)
|
||||
{
|
||||
setChar(someChar.getChar());
|
||||
setAttribute(someChar.getAttribute());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
bool Char::operator==(const Char &someChar)const
|
||||
{
|
||||
return (getChar()==someChar.getChar()&&
|
||||
getAttribute()==someChar.getAttribute());
|
||||
}
|
||||
|
||||
inline
|
||||
char Char::getChar(void)const
|
||||
{
|
||||
return mChar;
|
||||
}
|
||||
|
||||
inline
|
||||
void Char::setChar(char someChar)
|
||||
{
|
||||
mChar=someChar;
|
||||
}
|
||||
|
||||
inline
|
||||
Attribute Char::getAttribute(void)const
|
||||
{
|
||||
return mAttribute;
|
||||
}
|
||||
|
||||
inline
|
||||
void Char::setAttribute(Attribute attribute)
|
||||
{
|
||||
mAttribute=attribute;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user