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


C++ FilePath::isValid方法代码示例

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


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

示例1: searchComponentsAndDevices

AddComponentDialog::SearchResult AddComponentDialog::searchComponentsAndDevices(
    const QString& input) {
  SearchResult       result;
  const QStringList& localeOrder = mProject.getSettings().getLocaleOrder();

  // add matching devices and their corresponding components
  QList<Uuid> devices =
      mWorkspace.getLibraryDb().getElementsBySearchKeyword<library::Device>(
          input);  // can throw
  foreach (const Uuid& devUuid, devices) {
    FilePath devFp =
        mWorkspace.getLibraryDb().getLatestDevice(devUuid);  // can throw
    if (!devFp.isValid()) continue;
    Uuid cmpUuid = Uuid::createRandom();
    Uuid pkgUuid = Uuid::createRandom();
    mWorkspace.getLibraryDb().getDeviceMetadata(devFp, &pkgUuid,
                                                &cmpUuid);  // can throw
    FilePath cmpFp =
        mWorkspace.getLibraryDb().getLatestComponent(cmpUuid);  // can throw
    if (!cmpFp.isValid()) continue;
    FilePath pkgFp =
        mWorkspace.getLibraryDb().getLatestPackage(pkgUuid);  // can throw
    SearchResultDevice& resDev = result[cmpFp].devices[devFp];
    resDev.pkgFp               = pkgFp;
    resDev.match               = true;
  }
开发者ID:LibrePCB,项目名称:LibrePCB,代码行数:26,代码来源:addcomponentdialog.cpp

示例2: on_cbxSelectedDevice_currentIndexChanged

void UnplacedComponentsDock::on_cbxSelectedDevice_currentIndexChanged(int index)
{
    Uuid deviceUuid(mUi->cbxSelectedDevice->itemData(index, Qt::UserRole).toString());
    FilePath devFp = mProjectEditor.getWorkspace().getLibrary().getLatestDevice(deviceUuid);
    if (devFp.isValid()) {
        const library::Device* device = new library::Device(devFp, true);
        FilePath pkgFp = mProjectEditor.getWorkspace().getLibrary().getLatestPackage(device->getPackageUuid());
        if (pkgFp.isValid()) {
            const library::Package* package = new library::Package(pkgFp, true);
            setSelectedDeviceAndPackage(device, package);
        } else {
            setSelectedDeviceAndPackage(nullptr, nullptr);
        }
    }
    else {
        setSelectedDeviceAndPackage(nullptr, nullptr);
    }
}
开发者ID:The-Compiler,项目名称:LibrePCB,代码行数:18,代码来源:unplacedcomponentsdock.cpp

示例3: on_cbxSelectedComponent_currentIndexChanged

void UnplacedComponentsDock::on_cbxSelectedComponent_currentIndexChanged(int index)
{
    QUuid componentUuid = mUi->cbxSelectedComponent->itemData(index, Qt::UserRole).toUuid();
    FilePath cmpFp = mProjectEditor.getWorkspace().getLibrary().getLatestComponent(componentUuid);
    if (cmpFp.isValid())
    {
        const library::Component* component = new library::Component(cmpFp);
        setSelectedComponent(component);
    }
    else
    {
        setSelectedComponent(nullptr);
    }
}
开发者ID:nemofisch,项目名称:LibrePCB,代码行数:14,代码来源:unplacedcomponentsdock.cpp

示例4: foreach

 foreach (const Uuid& cmpUuid, components) {
   FilePath cmpFp =
       mWorkspace.getLibraryDb().getLatestComponent(cmpUuid);  // can throw
   if (!cmpFp.isValid()) continue;
   QSet<Uuid> devices =
       mWorkspace.getLibraryDb().getDevicesOfComponent(cmpUuid);  // can throw
   SearchResultComponent& resCmp = result[cmpFp];
   resCmp.match                  = true;
   foreach (const Uuid& devUuid, devices) {
     FilePath devFp =
         mWorkspace.getLibraryDb().getLatestDevice(devUuid);  // can throw
     if (!devFp.isValid()) continue;
     if (resCmp.devices.contains(devFp)) continue;
     Uuid pkgUuid = Uuid::createRandom();
     mWorkspace.getLibraryDb().getDeviceMetadata(devFp, &pkgUuid,
                                                 nullptr);  // can throw
     FilePath pkgFp =
         mWorkspace.getLibraryDb().getLatestPackage(pkgUuid);  // can throw
     SearchResultDevice& resDev = resCmp.devices[devFp];
     resDev.pkgFp               = pkgFp;
   }
开发者ID:LibrePCB,项目名称:LibrePCB,代码行数:21,代码来源:addcomponentdialog.cpp


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