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


C++ BlobImpl::GetMozFullPathInternal方法代码示例

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


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

示例1:

void
MultipartBlobImpl::GetMozFullPathInternal(nsAString& aFilename,
                                          ErrorResult& aRv)
{
  if (!mIsFromNsIFile || mBlobImpls.Length() == 0) {
    BlobImplBase::GetMozFullPathInternal(aFilename, aRv);
    return;
  }

  BlobImpl* blobImpl = mBlobImpls.ElementAt(0).get();
  if (!blobImpl) {
    BlobImplBase::GetMozFullPathInternal(aFilename, aRv);
    return;
  }

  blobImpl->GetMozFullPathInternal(aFilename, aRv);
}
开发者ID:ShakoHo,项目名称:gecko-dev,代码行数:17,代码来源:MultipartBlobImpl.cpp

示例2: GetAsFileWithPrincipal

already_AddRefed<FileSystemEntry>
DataTransferItem::GetAsEntryWithPrincipal(nsIPrincipal* aPrincipal,
                                          ErrorResult& aRv)
{
  RefPtr<File> file = GetAsFileWithPrincipal(aPrincipal, aRv);
  if (NS_WARN_IF(aRv.Failed()) || !file) {
    return nullptr;
  }

  nsCOMPtr<nsIGlobalObject> global;
  // This is annoying, but DataTransfer may have various things as parent.
  nsCOMPtr<EventTarget> target =
    do_QueryInterface(mDataTransfer->GetParentObject());
  if (target) {
    global = target->GetOwnerGlobal();
  } else {
    nsCOMPtr<nsIDOMEvent> event =
      do_QueryInterface(mDataTransfer->GetParentObject());
    if (event) {
      global = event->InternalDOMEvent()->GetParentObject();
    }
  }

  if (!global) {
    return nullptr;
  }

  RefPtr<FileSystem> fs = FileSystem::Create(global);
  RefPtr<FileSystemEntry> entry;
  BlobImpl* impl = file->Impl();
  MOZ_ASSERT(impl);

  if (impl->IsDirectory()) {
    nsAutoString fullpath;
    impl->GetMozFullPathInternal(fullpath, aRv);
    if (aRv.Failed()) {
      aRv.SuppressException();
      return nullptr;
    }

    nsCOMPtr<nsIFile> directoryFile;
    nsresult rv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(fullpath),
                                        true, getter_AddRefs(directoryFile));
    if (NS_WARN_IF(NS_FAILED(rv))) {
      return nullptr;
    }

    RefPtr<Directory> directory = Directory::Create(global, directoryFile);
    entry = new FileSystemDirectoryEntry(global, directory, fs);
  } else {
    entry = new FileSystemFileEntry(global, file, fs);
  }

  Sequence<RefPtr<FileSystemEntry>> entries;
  if (!entries.AppendElement(entry, fallible)) {
    return nullptr;
  }

  fs->CreateRoot(entries);
  return entry.forget();
}
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:61,代码来源:DataTransferItem.cpp


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