00001 /* effectContent.h 00002 */ 00003 #ifndef OSL_EFFECTCONTENT_H 00004 #define OSL_EFFECTCONTENT_H 00005 00006 #include "osl/basic_type.h" 00007 00008 namespace osl 00009 { 00010 class EffectContent 00011 { 00012 int effect; 00013 EffectContent(int value) : effect(value) 00014 { 00015 } 00016 public: 00017 EffectContent() : effect(0) 00018 { 00019 } 00020 explicit EffectContent(Offset offset) 00021 : effect(offset.intValue() << 1) 00022 { 00023 } 00024 static const EffectContent DIRECT() { return EffectContent(1); } 00028 static const EffectContent DIRECT(Offset offset) { 00029 return EffectContent((offset.intValue() << 1)+1); 00030 } 00034 bool hasEffect() const { return effect; } 00038 bool hasUnblockableEffect() const { return (effect & 1); } 00044 const Offset offset() const { return Offset::makeDirect(effect >> 1); } 00048 bool hasBlockableEffect() const { 00049 return (effect & (-effect) & ~1) != 0; 00050 } 00051 int intValue() const { return effect; } 00052 }; 00053 00054 inline bool operator==(EffectContent l, EffectContent r) 00055 { 00056 return l.intValue() == r.intValue(); 00057 } 00058 inline bool operator!=(EffectContent l, EffectContent r) 00059 { 00060 return ! (l == r); 00061 } 00062 inline bool operator<(EffectContent l, EffectContent r) 00063 { 00064 return l.intValue() < r.intValue(); 00065 } 00066 00067 } // namespace osl 00068 00069 #endif /* OSL_EFFECTCONTENT_H */ 00070 // ;;; Local Variables: 00071 // ;;; mode:c++ 00072 // ;;; c-basic-offset:2 00073 // ;;; End: