当前位置: 首页>>代码示例>>C++>>正文


C++ Flags类代码示例

本文整理汇总了C++中Flags的典型用法代码示例。如果您正苦于以下问题:C++ Flags类的具体用法?C++ Flags怎么用?C++ Flags使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Flags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: NumProc

 NumProc :: NumProc (weak_ptr<PDE> apde, const Flags & flags) 
   : NGS_Object (shared_ptr<PDE> (apde)->GetMeshAccess(int(flags.GetNumFlag("mesh",1))-1), "numproc"), 
     pde(apde)
 {
   if (flags.StringFlagDefined ("name"))
     SetName (flags.GetStringFlag ("name",""));
 }
开发者ID:mliertzer,项目名称:ngsolve,代码行数:7,代码来源:basenumproc.cpp

示例2: isOn

 bool isOn(Flags flags) const {
   if (flags.isOn(ModifierFlag::NONE)) {
     return (value_ | ModifierFlag::NONE.get()) == flags.get();
   } else {
     return (value_ & flags.get()) == flags.get();
   }
 }
开发者ID:dodamn,项目名称:keyremap4macbook,代码行数:7,代码来源:KeyCode.hpp

示例3: sendPayload

void RocketServerFrameContext::sendPayload(Payload&& payload, Flags flags) {
  DCHECK(connection_);
  DCHECK(flags.next() || flags.complete());

  auto buf = PayloadFrame(streamId_, std::move(payload), flags).serialize();
  connection_->send(std::move(buf));
}
开发者ID:facebook,项目名称:fbthrift,代码行数:7,代码来源:RocketServerFrameContext.cpp

示例4:

Flags&
Flags::remove(ModifierFlag flag) {
  // We consider the following case.
  //   (ModifierFlag::SHIFT_L | ModifierFlag::SHIFT_R).remove(ModifierFlag::SHIFT_L).
  //
  // The value of SHIFT_L and SHIFT_R is below.
  //
  // ModifierFlag::SHIFT_L : 0x20002
  // ModifierFlag::SHIFT_R : 0x20004
  //
  // So, the correct value of above case is 0x20004 (SHIFT_R).
  //
  // If we remove bits simple way (value_ &= ~flags),
  // the result value becomes 0x00004. It's not right.
  //
  // Therefore, we save the old value, and restore the necessary bits from it.
  //
  Flags old = *this;

  // keep ModifierFlag::NUMPAD.
  value_ &= ~(flag.getRawBits());

  auto& pairs = KeyCodeModifierFlagPairs::getPairs();
  for (size_t i = 0; i < pairs.size(); ++i) {
    ModifierFlag f = pairs[i].getModifierFlag();
    if (f == flag) continue;
    if (!old.isOn(f)) continue;

    value_ |= f.getRawBits();
  }

  return *this;
}
开发者ID:Beej126,项目名称:Karabiner,代码行数:33,代码来源:KeyCode.cpp

示例5: WebItemResource

/** WebItemCollection **/
WebItemCollection::WebItemCollection(const tj::shared::String& fn, const tj::shared::String& dn, const tj::shared::String& contentType):
	WebItemResource(fn,dn,contentType, 0) {
		Flags<WebItem::Permission> perms;
		perms.Set(WebItem::PermissionGet, true);
		perms.Set(WebItem::PermissionPropertyRead, true);
		SetPermissions(perms);
}
开发者ID:pixelspark,项目名称:corespark,代码行数:8,代码来源:tjwebcontent.cpp

示例6: setcapslock_timer_callback

void ListHookedKeyboard::setcapslock_timer_callback(OSObject* owner, IOTimerEventSource* sender) {
  ListHookedKeyboard& self = ListHookedKeyboard::instance();

  if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_passthrough_capslock_led_status)) return;

  Flags flags = FlagStatus::globalFlagStatus().makeFlags();

  for (Item* p = static_cast<Item*>(self.list_.safe_front()); p; p = static_cast<Item*>(p->getnext())) {
    if (!p->isReplaced()) continue;

    // Don't call setAlphaLock on devices which have non-Apple driver.
    if (p->getDeviceType() != DeviceType::APPLE_INTERNAL &&
        p->getDeviceType() != DeviceType::APPLE_EXTERNAL) {
      continue;
    }

    IOHIKeyboard* kbd = OSDynamicCast(IOHIKeyboard, p->get());
    if (!kbd) continue;

    {
      GlobalLock::ScopedUnlock lk;

      // We call setAlphaLock to match a state of CapsLock of the hardware with remapped CapsLock.
      if (flags.isOn(ModifierFlag::CAPSLOCK)) {
        if (!kbd->alphaLock()) {
          kbd->setAlphaLock(true);
        }
      } else {
        if (kbd->alphaLock()) {
          kbd->setAlphaLock(false);
        }
      }
    }
  }
}
开发者ID:hjmf1954,项目名称:Karabiner,代码行数:35,代码来源:ListHookedKeyboard.cpp

示例7: permissions

Error
ProcessMachCore::GetMemoryRegionInfo(addr_t load_addr, MemoryRegionInfo &region_info)
{
    region_info.Clear();
    const VMRangeToPermissions::Entry *permission_entry = m_core_range_infos.FindEntryThatContainsOrFollows(load_addr);
    if (permission_entry)
    {
        if (permission_entry->Contains(load_addr))
        {
            region_info.GetRange().SetRangeBase(permission_entry->GetRangeBase());
            region_info.GetRange().SetRangeEnd(permission_entry->GetRangeEnd());
            const Flags permissions(permission_entry->data);
            region_info.SetReadable(permissions.Test(ePermissionsReadable) ? MemoryRegionInfo::eYes
                                                                           : MemoryRegionInfo::eNo);
            region_info.SetWritable(permissions.Test(ePermissionsWritable) ? MemoryRegionInfo::eYes
                                                                           : MemoryRegionInfo::eNo);
            region_info.SetExecutable(permissions.Test(ePermissionsExecutable) ? MemoryRegionInfo::eYes
                                                                               : MemoryRegionInfo::eNo);
        }
        else if (load_addr < permission_entry->GetRangeBase())
        {
            region_info.GetRange().SetRangeBase(load_addr);
            region_info.GetRange().SetRangeEnd(permission_entry->GetRangeBase());
            region_info.SetReadable(MemoryRegionInfo::eNo);
            region_info.SetWritable(MemoryRegionInfo::eNo);
            region_info.SetExecutable(MemoryRegionInfo::eNo);
        }
        return Error();
    }

    return Error("invalid address");
}
开发者ID:bob-wilson,项目名称:swift-lldb,代码行数:32,代码来源:ProcessMachCore.cpp

示例8: TEST

TEST(Flags, stripFN) {
  Flags mask = ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_R | ModifierFlag::COMMAND_R;
  Flags flags = mask;
  EXPECT_EQ(mask, flags.stripFN());

  flags.add(ModifierFlag::FN);
  EXPECT_EQ(mask, flags.stripFN());
}
开发者ID:CharlseLee,项目名称:KeyRemap4MacBook,代码行数:8,代码来源:test.cpp

示例9:

 Flags
 FlagStatus::makeFlags(void)
 {
   Flags flags;
   for (int i = 0; item_[i].flag_ != ModifierFlag::NONE; ++i) {
     flags.add(item_[i].makeFlag());
   }
   return flags;
 }
开发者ID:kmaehashi,项目名称:KeyRemap4MacBook,代码行数:9,代码来源:FlagStatus.cpp

示例10: makeFlags

Flags FlagStatus::makeFlags(void) const {
  Flags flags;
  for (size_t i = 0; i < item_.size(); ++i) {
    if (item_[i].sum(false) > 0) {
      flags.add(item_[i].flag_);
    }
  }
  return flags;
}
开发者ID:Beej126,项目名称:Karabiner,代码行数:9,代码来源:FlagStatus.cpp

示例11:

  void
  KeyCode::reverseNormalizeKey(KeyCode& key, Flags& flags, EventType eventType, KeyboardType keyboardType)
  {
    if (! Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_disable_numpad_hack)) {
      for (unsigned int i = 0; i < sizeof(fnkeyhack) / sizeof(fnkeyhack[0]); ++i) {
        if (fnkeyhack[i].reverse(key, flags, eventType)) break;
      }
    }

    if (keyboardType == KeyboardType::POWERBOOK ||
        keyboardType == KeyboardType::POWERBOOK_G4 ||
        keyboardType == KeyboardType::POWERBOOK_G4_TI) {
      if (key == KeyCode::ENTER) { key = KeyCode::ENTER_POWERBOOK; }
    }

    // ------------------------------------------------------------
    // Don't add ModifierFlag::FN automatically for F-keys, PageUp/PageDown/Home/End and Forward Delete.
    //
    // PageUp/PageDown/Home/End and Forward Delete are entered by fn+arrow, fn+delete normally,
    // And, from Cocoa Application, F-keys and PageUp,... keys have Fn modifier
    // even if Fn key is not pressed actually.
    // So, it's natural adding ModifierFlag::FN to these keys.
    // However, there is a reason we must not add ModifierFlag::FN to there keys.
    //
    // Mission Control may have "fn" as shortcut key.
    // If we add ModifierFlag::FN here,
    // "XXX to PageUp" launches Mission Control because Mission Control recognizes fn key was pressed.
    //
    // It's not intended behavior from users.
    // Therefore, we don't add ModifierFlag::FN for these keys.

    // ------------------------------------------------------------
    // set ModifierFlag::KEYPAD, ModifierFlag::CURSOR
    flags.stripCURSOR().stripKEYPAD();

    // Note: KEYPAD_CLEAR, KEYPAD_COMMA have no ModifierFlag::KEYPAD bit.
    if (key == KeyCode::KEYPAD_0 || key == KeyCode::KEYPAD_1 || key == KeyCode::KEYPAD_2 ||
        key == KeyCode::KEYPAD_3 || key == KeyCode::KEYPAD_4 || key == KeyCode::KEYPAD_5 ||
        key == KeyCode::KEYPAD_6 || key == KeyCode::KEYPAD_7 || key == KeyCode::KEYPAD_8 ||
        key == KeyCode::KEYPAD_9 ||
        key == KeyCode::KEYPAD_DOT ||
        key == KeyCode::KEYPAD_MULTIPLY ||
        key == KeyCode::KEYPAD_PLUS ||
        key == KeyCode::KEYPAD_SLASH ||
        key == KeyCode::KEYPAD_MINUS ||
        key == KeyCode::KEYPAD_EQUAL) {
      flags.add(ModifierFlag::KEYPAD);
    }

    if (key == KeyCode::CURSOR_UP ||
        key == KeyCode::CURSOR_DOWN ||
        key == KeyCode::CURSOR_LEFT ||
        key == KeyCode::CURSOR_RIGHT) {
      flags.add(ModifierFlag::CURSOR);
    }
  }
开发者ID:Bilalh,项目名称:KeyRemap4MacBook,代码行数:56,代码来源:KeyCode.cpp

示例12: MyVTKOutput

 MyVTKOutput<D>::MyVTKOutput(const Array<shared_ptr<CoefficientFunction>> & a_coefs,
                             const Flags & flags,
                             shared_ptr<MeshAccess> ama)
   : MyVTKOutput(ama, a_coefs,
                 flags.GetStringListFlag("fieldnames" ),
                 flags.GetStringFlag("filename","output"),
                 (int) flags.GetNumFlag("subdivision", 0),
                 (int) flags.GetNumFlag("only_element", -1),
                 flags.GetDefineFlag("nocache"))
 {;}
开发者ID:schruste,项目名称:ngsapps,代码行数:10,代码来源:myvtkoutput.cpp

示例13: NumProcLinearHyperbolic

  NumProcLinearHyperbolic (shared_ptr<PDE> apde, const Flags & flags)
    : NumProc (apde), 
      timer_element("convection - time element"), 
      timer_facet("convection - time facet"),
      timer_mass("convection - time mass")
  {
    gfu = apde->GetGridFunction (flags.GetStringFlag ("gridfunction", "u"));
    cfflow = apde->GetCoefficientFunction (flags.GetStringFlag ("flow", "flow"));

    dt = flags.GetNumFlag ("dt", 0.001);
    tend = flags.GetNumFlag ("tend", 1);
  }
开发者ID:mliertzer,项目名称:ngsolve,代码行数:12,代码来源:linhypDG.cpp

示例14: MESHIT_LOG_INFO

void SplineGeometry::LoadData(std::istream& infile)
{
    MESHIT_LOG_INFO("Load 2D Geometry");

    Point2d x;
    char buf[50], ch;

    std::string keyword;
    std::string flag;

    int nb_domains = 0;

    TestComment(infile);
    // refinement factor
    infile >> elto0;

    while (infile.good()) {
        TestComment(infile);
        infile >> keyword;
        ch = TestComment(infile);

        if (keyword == "points") {
            std::vector<GeomPoint> points;
            std::vector<PointIndex> point_ids;
            size_t point_id;
            size_t nb_points = 0;
            while (!isalpha(static_cast<int>(ch))) {
                infile >> point_id;  // point ids are 1-based
                if (point_id > nb_points) nb_points = point_id;
                point_ids.push_back(point_id);

                infile >> x.X() >> x.Y() >> ch;

                Flags flags;
                while (ch == '-') {
                    infile >> flag;
                    flags.SetCommandLineFlag(flag);
                    ch = TestComment(infile);
                }
                infile.unget();
                ch = TestComment(infile);

                points.push_back(GeomPoint(x, flags.GetNumFlag("ref", 1.0), flags.GetNumFlag("maxh", 1e99)));
            }
            geompoints.resize(nb_points);
            for (size_t i = 0; i < nb_points; i++) {
                geompoints[point_ids[i] - 1] = points[i];
            }
        } else if (keyword == "segments") {
开发者ID:honnorat,项目名称:meshit,代码行数:49,代码来源:geometry2d.cpp

示例15: if

  void
  KeyboardRepeat::set(EventType eventType,
                      Flags flags,
                      ConsumerKeyCode key)
  {
    if (! queue_) return;

    if (key == ConsumerKeyCode::VK_NONE) return;

    if (eventType == EventType::UP) {
      goto cancel;

    } else if (eventType == EventType::DOWN) {
      if (! key.isRepeatable()) {
        goto cancel;
      }

      cancel();

      primitive_add(eventType, flags, key);
      primitive_start(Config::get_repeat_consumer_initial_wait(),
                      Config::get_repeat_consumer_wait());

      IOLOG_DEVEL("KeyboardRepeat::set consumer key:%d flags:0x%x\n", key.get(), flags.get());

    } else {
      goto cancel;
    }

    return;

  cancel:
    cancel();
  }
开发者ID:NJAldwin,项目名称:KeyRemap4MacBook,代码行数:34,代码来源:KeyboardRepeat.cpp


注:本文中的Flags类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。