本文整理汇总了C++中Flags::stripNONE方法的典型用法代码示例。如果您正苦于以下问题:C++ Flags::stripNONE方法的具体用法?C++ Flags::stripNONE怎么用?C++ Flags::stripNONE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flags
的用法示例。
在下文中一共展示了Flags::stripNONE方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(Flags, stripNONE) {
Flags mask = ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_R | ModifierFlag::COMMAND_R;
Flags flags = mask;
EXPECT_EQ(mask, flags.stripNONE());
flags.add(ModifierFlag::NONE);
EXPECT_EQ(mask, flags.stripNONE());
}
示例2: ptr
void
EventOutputQueue::FireModifiers::fire(Flags toFlags, KeyboardType keyboardType)
{
toFlags.stripNONE();
toFlags.stripEXTRA();
if (lastFlags_ == toFlags) return;
// ------------------------------------------------------------
// At first we handle KeyUp events and handle KeyDown events next.
// We need to end KeyDown at Command+Space to Option_L+Shift_L.
//
// When Option_L+Shift_L has a meaning (switch input language at Windows),
// it does not works well when the last is KeyUp of Command.
// ------------------------------------------------------------
// About ModifierFlag::CURSOR (UpdateEventFlags) handling:
//
// We need to treat ModifierFlag::CURSOR specially.
//
// When we activated "Control+Right to Option+Right" and pressed Control+Right,
// the following events are happened.
//
// ----------------------+----------------------------------------------------------------------
// (1) Press Control_L | eventType:keyMod code:0x3b name:Control_L flags: misc:
// (2) Press Right | eventType:keyMod code:0x3a name:Option_L flags:Opt misc:
// | eventType:keyDown code:0x7c name:Right flags:Opt NumPad Fn misc:
// (3) Release Right | eventType:keyUp code:0x7c name:Right flags:Opt NumPad Fn misc:
// (4) Release Control_L | eventType:keyMod code:0x3a name:Option_L flags: misc:
// ----------------------+----------------------------------------------------------------------
//
// We need to treat "ModifierFlag::CURSOR Down" event after other modifiers.
// We need to treat "ModifierFlag::CURSOR Up" event before other modifiers.
// If not, unnecessary ModifierFlag::CURSOR is added on keyMod events.
// ModifierFlag::CURSOR (Up)
if (lastFlags_.isOn(ModifierFlag::CURSOR) && ! toFlags.isOn(ModifierFlag::CURSOR)) {
lastFlags_.remove(ModifierFlag::CURSOR);
Params_UpdateEventFlagsCallback::auto_ptr ptr(Params_UpdateEventFlagsCallback::alloc(lastFlags_));
if (ptr) {
EventOutputQueue::push(*ptr);
}
}
// ------------------------------------------------------------
// KeyUp
for (int i = 0;; ++i) {
ModifierFlag flag = FlagStatus::getFlag(i);
if (flag == ModifierFlag::NONE) break;
if (flag == ModifierFlag::CURSOR) continue;
if (Flags(flag).isVirtualModifiersOn()) continue;
if (! lastFlags_.isOn(flag)) continue;
if (toFlags.isOn(flag)) continue;
lastFlags_.remove(flag);
Params_KeyboardEventCallBack::auto_ptr ptr(Params_KeyboardEventCallBack::alloc(EventType::MODIFY, lastFlags_, flag.getKeyCode(), keyboardType, false));
if (! ptr) continue;
EventOutputQueue::push(*ptr);
}
// KeyDown
for (int i = 0;; ++i) {
ModifierFlag flag = FlagStatus::getFlag(i);
if (flag == ModifierFlag::NONE) break;
if (flag == ModifierFlag::CURSOR) continue;
if (Flags(flag).isVirtualModifiersOn()) continue;
if (! toFlags.isOn(flag)) continue;
if (lastFlags_.isOn(flag)) continue;
lastFlags_.add(flag);
Params_KeyboardEventCallBack::auto_ptr ptr(Params_KeyboardEventCallBack::alloc(EventType::MODIFY, lastFlags_, flag.getKeyCode(), keyboardType, false));
if (! ptr) continue;
EventOutputQueue::push(*ptr);
}
// ------------------------------------------------------------
// ModifierFlag::CURSOR (Down)
if (! lastFlags_.isOn(ModifierFlag::CURSOR) && toFlags.isOn(ModifierFlag::CURSOR)) {
lastFlags_.add(ModifierFlag::CURSOR);
Params_UpdateEventFlagsCallback::auto_ptr ptr(Params_UpdateEventFlagsCallback::alloc(lastFlags_));
if (ptr) {
EventOutputQueue::push(*ptr);
}
}
lastFlags_ = toFlags;
}