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


C++ FileInfo类代码示例

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


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

示例1: PassesAttributesFilter

bool FileInfosFilter::PassesAttributesFilter(const FileInfo& fi) const {

    if (query_->ExcludeHiddenAndSystem && fi.IsHiddenOrSystem()) {
        return false;
    }

    if (query_->ExcludeFolders && fi.IsDirectory()) {
        return false;
    }

    if (query_->ExcludeFiles && !fi.IsDirectory()) {
        return false;
    }

    return true;
}
开发者ID:savelii,项目名称:indexer-plus-plus,代码行数:16,代码来源:FileInfosFilter.cpp

示例2: copyCurrentUrlToClipboard

void MainWindow::copyCurrentUrlToClipboard()
{
    FileInfo * currentItem = _selectionModel->currentItem();

    if ( currentItem )
    {
	QClipboard * clipboard = QApplication::clipboard();
	QString url = currentItem->url();
	clipboard->setText( url );
	showProgress( tr( "Copied to system clipboard: %1" ).arg( url ) );
    }
    else
    {
	showProgress( tr( "No current item" ) );
    }
}
开发者ID:shundhammer,项目名称:qdirstat,代码行数:16,代码来源:MainWindow.cpp

示例3: strdup

void
Scanner::_ChangeToDesired()
{
	if (fBusy || fDesiredPath.size() <= 0)
		return;

	char* workPath = strdup(fDesiredPath.c_str());
	char* pathPtr = &workPath[1]; // skip leading '/'
	char* endOfPath = pathPtr + strlen(pathPtr);

	// Check the name of the root directory.  It is a special case because
	// it has no parent data structure.
	FileInfo* checkDir = fSnapshot->rootDir;
	FileInfo* prefDir = NULL;
	char* sep = strchr(pathPtr, '/');
	if (sep != NULL)
		*sep = '\0';

	if (strcmp(pathPtr, checkDir->ref.name) == 0) {
		// Root directory matches, so follow the remainder of the path as
		// far as possible.
		prefDir = checkDir;
		pathPtr += 1 + strlen(pathPtr);
		while (pathPtr < endOfPath) {
			sep = strchr(pathPtr, '/');
			if (sep != NULL)
				*sep = '\0';

			checkDir = prefDir->FindChild(pathPtr);
			if (checkDir == NULL || checkDir->children.size() == 0)
				break;

			pathPtr += 1 + strlen(pathPtr);
			prefDir = checkDir;
		}
	}

	// If the desired path is the volume's root directory, default to the
	// volume display.
	if (prefDir == fSnapshot->rootDir)
		prefDir = NULL;

	ChangeDir(prefDir);

	free(workPath);
	fDesiredPath.erase();
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:47,代码来源:Scanner.cpp

示例4: AnswerFile

  void ServerContext::AnswerFile(RestApiOutput& output,
                                 const std::string& instancePublicId,
                                 FileContentType content)
  {
    FileInfo attachment;
    if (!index_.LookupAttachment(attachment, instancePublicId, content))
    {
      throw OrthancException(ErrorCode_InternalError);
    }

    accessor_.SetCompressionForNextOperations(attachment.GetCompressionType());

    std::auto_ptr<HttpFileSender> sender(accessor_.ConstructHttpFileSender(attachment.GetUuid()));
    sender->SetContentType("application/dicom");
    sender->SetDownloadFilename(instancePublicId + ".dcm");
    output.AnswerFile(*sender);
  }
开发者ID:amirkogithub,项目名称:orthanc,代码行数:17,代码来源:ServerContext.cpp

示例5: directory_create

bool FileContainerTemporary::directory_create(const std::string &dirname)
{
	if (!is_opened()) return false;
	if (is_file(dirname)) return false;
	if (is_directory(dirname)) return true;
	if (!container_->directory_check_name(dirname)) return false;

	FileInfo info;
	info.name = fix_slashes(dirname);
	info.split_name();
	info.is_directory = true;
	if (info.name_part_localname.empty()
	 || !is_directory(info.name_part_directory)) return false;

	files_[info.name] = info;
	return true;
}
开发者ID:ChillyCider,项目名称:synfig-reloaded,代码行数:17,代码来源:filecontainertemporary.cpp

示例6: main

//===----------------------------------------------------------------------===//
int main(int argc, char **argv) {
  // Print a stack trace if we signal out.
  sys::PrintStackTraceOnErrorSignal();
  PrettyStackTraceProgram X(argc, argv);
  llvm_shutdown_obj Y;  // Call llvm_shutdown() on exit.

  cl::ParseCommandLineOptions(argc, argv, "llvm coverage tool\n");

  GCOVFile GF;
  if (InputGCNO.empty())
    errs() << " " << argv[0] << ": No gcov input file!\n";

  OwningPtr<MemoryBuffer> GCNO_Buff;
  if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputGCNO, GCNO_Buff)) {
    errs() << InputGCNO << ": " << ec.message() << "\n";
    return 1;
  }
  GCOVBuffer GCNO_GB(GCNO_Buff.take());
  if (!GF.read(GCNO_GB)) {
    errs() << "Invalid .gcno File!\n";
    return 1;
  }

  if (!InputGCDA.empty()) {
    OwningPtr<MemoryBuffer> GCDA_Buff;
    if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputGCDA, GCDA_Buff)) {
      errs() << InputGCDA << ": " << ec.message() << "\n";
      return 1;
    }
    GCOVBuffer GCDA_GB(GCDA_Buff.take());
    if (!GF.read(GCDA_GB)) {
      errs() << "Invalid .gcda File!\n";
      return 1;
    }
  }


  if (DumpGCOV)
    GF.dump();

  FileInfo FI;
  GF.collectLineCounts(FI);
  FI.print(InputGCNO, InputGCDA);
  return 0;
}
开发者ID:vsajip,项目名称:llvm,代码行数:46,代码来源:llvm-cov.cpp

示例7: CalcHashes

void NZBFile::CalcHashes()
{
	TempFileList fileList;

	for (FileList::iterator it = m_pNZBInfo->GetFileList()->begin(); it != m_pNZBInfo->GetFileList()->end(); it++)
	{
		fileList.push_back(*it);
	}

	fileList.sort(CompareFileInfo);

	unsigned int iFullContentHash = 0;
	unsigned int iFilteredContentHash = 0;
	int iUseForFilteredCount = 0;

	for (TempFileList::iterator it = fileList.begin(); it != fileList.end(); it++)
	{
		FileInfo* pFileInfo = *it;

		// check file extension
		bool bSkip = !pFileInfo->GetParFile() &&
			Util::MatchFileExt(pFileInfo->GetFilename(), g_pOptions->GetExtCleanupDisk(), ",;");

		for (FileInfo::Articles::iterator it = pFileInfo->GetArticles()->begin(); it != pFileInfo->GetArticles()->end(); it++)
		{
			ArticleInfo* pArticle = *it;
			int iLen = strlen(pArticle->GetMessageID());
			iFullContentHash = Util::HashBJ96(pArticle->GetMessageID(), iLen, iFullContentHash);
			if (!bSkip)
			{
				iFilteredContentHash = Util::HashBJ96(pArticle->GetMessageID(), iLen, iFilteredContentHash);
				iUseForFilteredCount++;
			}
		}
	}

	// if filtered hash is based on less than a half of files - do not use filtered hash at all
	if (iUseForFilteredCount < (int)fileList.size() / 2)
	{
		iFilteredContentHash = 0;
	}

	m_pNZBInfo->SetFullContentHash(iFullContentHash);
	m_pNZBInfo->SetFilteredContentHash(iFilteredContentHash);
}
开发者ID:0BruceWayne0,项目名称:nzbget,代码行数:45,代码来源:NZBFile.cpp

示例8: WriteToDisk

FileHandle::~FileHandle()
{
	WriteToDisk();
	FileInfo* fp = first_file_;
	while (fp != NULL)
	{
		FileInfo* fpn = fp->GetNext();
		BlockInfo* bp = fp->GetFirstBlock();
		while (bp != NULL)
		{
			BlockInfo* bpn = bp->GetNext();
			delete bp;
			bp = bpn;
		}
		delete fp;
		fp = fpn;
	}
}
开发者ID:XuJing1022,项目名称:DataBaseProject,代码行数:18,代码来源:FileHandle.cpp

示例9: LOG

  void ServerContext::ChangeAttachmentCompression(const std::string& resourceId,
                                                  FileContentType attachmentType,
                                                  CompressionType compression)
  {
    LOG(INFO) << "Changing compression type for attachment "
              << EnumerationToString(attachmentType) 
              << " of resource " << resourceId << " to " 
              << compression; 

    FileInfo attachment;
    if (!index_.LookupAttachment(attachment, resourceId, attachmentType))
    {
      throw OrthancException(ErrorCode_UnknownResource);
    }

    if (attachment.GetCompressionType() == compression)
    {
      // Nothing to do
      return;
    }

    std::string content;

    StorageAccessor accessor(area_);
    accessor.Read(content, attachment);

    FileInfo modified = accessor.Write(content.empty() ? NULL : content.c_str(),
                                       content.size(), attachmentType, compression, storeMD5_);

    try
    {
      StoreStatus status = index_.AddAttachment(modified, resourceId);
      if (status != StoreStatus_Success)
      {
        accessor.Remove(modified);
        throw OrthancException(ErrorCode_Database);
      }
    }
    catch (OrthancException&)
    {
      accessor.Remove(modified);
      throw;
    }    
  }
开发者ID:151706061,项目名称:OrthancMirror,代码行数:44,代码来源:ServerContext.cpp

示例10: ReorderFiles

void QueueEditor::ReorderFiles(DownloadQueue* pDownloadQueue, ItemList* pItemList)
{
	if (pItemList->size() == 0)
	{
		return;
	}

	EditItem* pFirstItem = pItemList->front();
	NZBInfo* pNZBInfo = pFirstItem->m_pFileInfo->GetNZBInfo();
	unsigned int iInsertPos = 0;

	// find first file of the group
    for (FileQueue::iterator it = pDownloadQueue->GetFileQueue()->begin(); it != pDownloadQueue->GetFileQueue()->end(); it++)
    {
        FileInfo* pFileInfo = *it;
		if (pFileInfo->GetNZBInfo() == pNZBInfo)
		{
			break;
		}
		iInsertPos++;
	}

	// now can reorder
	for (ItemList::iterator it = pItemList->begin(); it != pItemList->end(); it++)
	{
		EditItem* pItem = *it;
		FileInfo* pFileInfo = pItem->m_pFileInfo;

		// move file item
		for (FileQueue::iterator it = pDownloadQueue->GetFileQueue()->begin(); it != pDownloadQueue->GetFileQueue()->end(); it++)
		{
			FileInfo* pFileInfo1 = *it;
			if (pFileInfo1 == pFileInfo)
			{
				pDownloadQueue->GetFileQueue()->erase(it);
				pDownloadQueue->GetFileQueue()->insert(pDownloadQueue->GetFileQueue()->begin() + iInsertPos, pFileInfo);
				iInsertPos++;				
				break;
			}
		}

		delete pItem;
	}
}
开发者ID:Bootz,项目名称:nzbm,代码行数:44,代码来源:QueueEditor.cpp

示例11: collectLineCounts

/// collectLineCounts - Collect line counts. This must be used after
/// reading .gcno and .gcda files.
void GCOVFunction::collectLineCounts(FileInfo &FI) {
  // If the line number is zero, this is a function that doesn't actually appear
  // in the source file, so there isn't anything we can do with it.
  if (LineNumber == 0)
    return;

  for (const auto &Block : Blocks)
    Block->collectLineCounts(FI);
  FI.addFunctionLine(Filename, LineNumber, this);
}
开发者ID:chubbymaggie,项目名称:asap,代码行数:12,代码来源:GCOV.cpp

示例12: treeLevel

int FileInfo::treeLevel() const
{
    int		level	= 0;
    FileInfo *	parent	= _parent;

    while ( parent )
    {
	level++;
	parent = parent->parent();
    }

    return level;


    if ( _parent )
	return _parent->treeLevel() + 1;
    else
	return 0;
}
开发者ID:buxit,项目名称:qdirstat,代码行数:19,代码来源:FileInfo.cpp

示例13: strncpy

/**
* Check if deletion of already downloaded files is possible (when nzb id deleted from queue).
* The deletion is most always possible, except the case if all remaining files in queue 
* (belonging to this nzb-file) are PARS.
*/
bool QueueEditor::CanCleanupDisk(DownloadQueue* pDownloadQueue, NZBInfo* pNZBInfo)
{
    for (FileQueue::iterator it = pDownloadQueue->GetFileQueue()->begin(); it != pDownloadQueue->GetFileQueue()->end(); it++)
    {
        FileInfo* pFileInfo = *it;
		char szLoFileName[1024];
		strncpy(szLoFileName, pFileInfo->GetFilename(), 1024);
		szLoFileName[1024-1] = '\0';
		for (char* p = szLoFileName; *p; p++) *p = tolower(*p); // convert string to lowercase

		if (!strstr(szLoFileName, ".par2"))
		{
			// non-par file found
			return true;
		}
	}

	return false;
}
开发者ID:Bootz,项目名称:nzbm,代码行数:24,代码来源:QueueEditor.cpp

示例14: max

void FileInfoListView::addRange(FileInfo **filesInfo, size_t count)
{
  int index = max(0, (getCount() - 1));
  size_t i = 0;
  FileInfo *arr = *filesInfo;

  for (i = 0; i < count; i++) {
    FileInfo *fi = &arr[i];
    if (fi->isDirectory()) {
      addItem(index++, fi);
    } 
  } 

  for (i = 0; i < count; i++) {
    FileInfo *fi = &arr[i];
    if (!fi->isDirectory()) {
      addItem(index++, fi);
    } 
  } 
} 
开发者ID:newmind,项目名称:tvnc_rds,代码行数:20,代码来源:FileInfoListView.cpp

示例15: finalizeRecursive

void CacheReader::finalizeRecursive( DirInfo * dir )
{
    if ( dir->readState() != DirOnRequestOnly )
    {
	dir->setReadState( DirCached );
	_tree->sendFinalizeLocal( dir );
	dir->finalizeLocal();
	_tree->sendReadJobFinished( dir );
    }

    FileInfo * child = dir->firstChild();

    while ( child )
    {
	if ( child->isDirInfo() )
	    finalizeRecursive( child->toDirInfo() );

	child = child->next();
    }

}
开发者ID:buxit,项目名称:qdirstat,代码行数:21,代码来源:DirTreeCache.cpp


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