effectContent.h
Go to the documentation of this file.
/* effectContent.h
*/
#ifndef OSL_EFFECTCONTENT_H
#define OSL_EFFECTCONTENT_H
#include "osl/basic_type.h"
namespace osl
{
class EffectContent
{
int effect;
EffectContent(int value) : effect(value)
{
}
public:
EffectContent() : effect(0)
{
}
explicit EffectContent(Offset offset)
: effect(offset.intValue() << 1)
{
}
static const EffectContent DIRECT() { return EffectContent(1); }
static const EffectContent DIRECT(Offset offset) {
return EffectContent((offset.intValue() << 1)+1);
}
bool hasEffect() const { return effect; }
bool hasUnblockableEffect() const { return (effect & 1); }
const Offset offset() const { return Offset::makeDirect(effect >> 1); }
bool hasBlockableEffect() const {
return (effect & (-effect) & ~1) != 0;
}
int intValue() const { return effect; }
};
inline bool operator==(EffectContent l, EffectContent r)
{
return l.intValue() == r.intValue();
}
inline bool operator!=(EffectContent l, EffectContent r)
{
return ! (l == r);
}
inline bool operator<(EffectContent l, EffectContent r)
{
return l.intValue() < r.intValue();
}
} // namespace osl
#endif /* OSL_EFFECTCONTENT_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
basic_type.h
osl::EffectContent
Definition effectContent.h:11
osl::EffectContent::EffectContent
EffectContent(Offset offset)
Definition effectContent.h:20
osl::EffectContent::EffectContent
EffectContent()
Definition effectContent.h:17
osl::EffectContent::offset
const Offset offset() const
返り値が0なら長い利きがない, 0以外なら辿るのに必要なoffset (2005/3/25 に仕様変更 - 長い利きだが隣の場合もoffsetを返す)
Definition effectContent.h:44
osl::EffectContent::EffectContent
EffectContent(int value)
Definition effectContent.h:13
osl::EffectContent::DIRECT
static const EffectContent DIRECT(Offset offset)
隣だが，offsetも与える
Definition effectContent.h:28
osl::EffectContent::hasBlockableEffect
bool hasBlockableEffect() const
2005/3/25に変更.
Definition effectContent.h:48
osl::EffectContent::hasEffect
bool hasEffect() const
短い利きがあるか，間がemptyなら長い利きがある
Definition effectContent.h:34
osl::EffectContent::hasUnblockableEffect
bool hasUnblockableEffect() const
短い利きがある．長い利きの隣も含む
Definition effectContent.h:38
osl::EffectContent::effect
int effect
Definition effectContent.h:12
osl::EffectContent::intValue
int intValue() const
Definition effectContent.h:51
osl::EffectContent::DIRECT
static const EffectContent DIRECT()
Definition effectContent.h:24
osl::Offset
座標の差分
Definition basic_type.h:430
osl::Offset::makeDirect
static const Offset makeDirect(int value)
Definition basic_type.h:447
osl
Definition additionalEffect.h:6
osl::operator<
bool operator<(Offset l, Offset r)
Definition basic_type.h:520
osl::operator!=
bool operator!=(Offset l, Offset r)
Definition basic_type.h:516
osl::operator==
bool operator==(Square l, Square r)
Definition basic_type.h:758