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


C++ FileList类代码示例

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


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

示例1: FileList

void LightmapsPacker::ParseSpriteDescriptors()
{
	FileList * fileList = new FileList(outputDir);

	char8 buf[512];
	uint32 readSize; 

	int32 itemsCount = fileList->GetCount();
	for(int32 i = 0; i < itemsCount; ++i)
	{
		const FilePath & filePath = fileList->GetPathname(i);
		if(fileList->IsDirectory(i) || !filePath.IsEqualToExtension(".txt"))
		{
			continue;
		}

		LightmapAtlasingData data;

		data.meshInstanceName = filePath.GetBasename();
        
		File * file = File::Create(filePath, File::OPEN | File::READ);
		
		file->ReadLine(buf, sizeof(buf)); //textures count

		readSize = file->ReadLine(buf, sizeof(buf)); //texture name
		FilePath originalTextureName = outputDir + String(buf, readSize);
		data.textureName = originalTextureName;

		file->ReadLine(buf, sizeof(buf)); //image size

		file->ReadLine(buf, sizeof(buf)); //frames count

		file->ReadLine(buf, sizeof(buf)); //frame rect
		int32 x, y, dx, dy, unused0, unused1, unused2;
		sscanf(buf, "%d %d %d %d %d %d %d", &x, &y, &dx, &dy, &unused0, &unused1, &unused2);
		dx++;//cause TexturePacker::ReduceRectToOriginalSize removed one pixel by default
		dy++;

		Vector2 textureSize = GetTextureSize(originalTextureName);
		data.uvOffset = Vector2((float32)x/textureSize.x, (float32)y/textureSize.y);
		data.uvScale = Vector2((float32)dx/textureSize.x, (float32)dy/textureSize.y);
		
		file->Release();

		atlasingData.push_back(data);

		FileSystem::Instance()->DeleteFile(filePath);
	}

	fileList->Release();
}
开发者ID:boyjimeking,项目名称:dava.framework,代码行数:51,代码来源:LightmapsPacker.cpp

示例2: OpenWrite

void OpenWrite(ofstream& s, const char *name, FileList& flist)
{
   // post condition: file is successfully opened iff 
   //   name is added to flist (even if exception is thrown).
   //   We do the AddFile first, since that can conceivably fail.

   flist.AddFile(name);
   s.open(name, ios::out);

   if (!s) {
      flist.RemoveLast();
      FileError("write open failed");
   }
}
开发者ID:95krasovsky,项目名称:SecretSharingSchemes,代码行数:14,代码来源:fileio.c

示例3: dir

void TestFileList::filterFiles4()
{
    FileList list;
    QStringList filters;
    filters << "dir1/";
    list.AddExcludeList(filters);
    list.AddDirectory(QString(SRCDIR) + "/../data/files", true);
    QStringList files = list.GetFileList();
    QCOMPARE(files.size(), 8);
    QDir dir(QString(SRCDIR) + "/../data/files");
    QString base = dir.canonicalPath();
    QVERIFY(! files.contains(base + "/dir1/foo1.cpp"));
    QVERIFY(! files.contains(base + "/dir1/dir11/foo11.cpp"));
}
开发者ID:0x20e,项目名称:cppcheck,代码行数:14,代码来源:testfilelist.cpp

示例4: presetdir

      PresetList::PresetList() : Wt::Ext::TableView() {
        File presetdir(org::esb::config::Config::get("preset.path"));
        if (presetdir.exists()) {
          FileList files = presetdir.listFiles();
          std::list<std::list<std::string> > data;
          FileList::iterator file_it = files.begin();
          for (; file_it != files.end(); file_it++) {
            org::esb::hive::PresetReader reader((*file_it)->getPath());
            LOGDEBUG((*file_it)->getPath());
            std::list<std::string> line;
            line.push_back((*file_it)->getFileName());
            line.push_back(reader.getPreset()["name"]);
            //line.push_back(reader.getPreset()["id"]);
            data.push_back(line);
          }
          setModel(new PresetListTableModel(data));
          setAlternatingRowColors(true);
          resizeColumnsToContents(true);
          setColumnHidden(0, true);
          setHighlightMouseOver(true);
          setSelectionBehavior(Wt::SelectRows);
          setSelectionMode(Wt::SingleSelection);
          setColumnWidth(0, 50);
          setAutoExpandColumn(1);

          itemSelectionChanged().connect(SLOT(this, PresetList::selectionChanged));


          setTopToolBar(new Wt::Ext::ToolBar());
          create_button = topToolBar()->addButton("Create a new Preset");
          create_button->setIcon("icons/add-icon.png");
          topToolBar()->addSeparator();
          edit_button = topToolBar()->addButton("Edit selected Preset");
          edit_button->setIcon("icons/edit-icon.png");
          //topToolBar()->addSeparator();
          //delete_button = topToolBar()->addButton("Delete selected Preset");
          //delete_button->setIcon("icons/encoding-project-remove-icon.png");

          create_button->setEnabled(true);
          edit_button->setEnabled(false);
          //delete_button->setEnabled(false);

          create_button->clicked().connect(SLOT(this, PresetList::createPreset));
          edit_button->clicked().connect(SLOT(this, PresetList::editPreset));
          //delete_button->clicked().connect(SLOT(this, PresetList::deletePreset));

        } else {
          LOGERROR("Preset Directory does not exist! " << presetdir.getPath());
        }
      }
开发者ID:psychobob666,项目名称:MediaEncodingCluster,代码行数:50,代码来源:PresetList.cpp

示例5: files

bool DataTransfer::hasFileOfType(const String& type) const {
  if (!canReadTypes())
    return false;

  FileList* fileList = files();
  if (fileList->isEmpty())
    return false;

  for (unsigned f = 0; f < fileList->length(); f++) {
    if (equalIgnoringCase(fileList->item(f)->type(), type))
      return true;
  }
  return false;
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例6: output

void output(const FileList& flist)
{
	for (BOOST_AUTO(iter, flist.begin()); iter != flist.end(); ++iter)
	{
		BOOST_AUTO(&fmeta, iter->second);
		std::vector<char> buffer;
		std::cout << "name  : "  << GetFileName(fmeta.mName, buffer) << "\n, "
					<< "meta  : {" << fmeta.mMeta     << "}, \n"
					<< "offset: "  << fmeta.mOffset   << ", \n"
					<< "fsize : "  << fmeta.mFileSize << ", \n"
					<< "wbsize: "  << fmeta.mWriteBSize << "\n"
					<< std::endl;
	}
}
开发者ID:wenxq,项目名称:cpp,代码行数:14,代码来源:main.cpp

示例7: deduplicate

    void deduplicate(const File &inputGallery, const File &outputGallery, const float threshold)
    {
        qDebug("Deduplicating %s to %s with a score threshold of %f", qPrintable(inputGallery.flat()), qPrintable(outputGallery.flat()), threshold);

        if (distance.isNull()) qFatal("Null distance.");

        QScopedPointer<Gallery> i;
        FileList inputFiles;
        retrieveOrEnroll(inputGallery, i, inputFiles);

        TemplateList t = i->read();

        Output *o = Output::make(QString("buffer.tail[selfSimilar,threshold=%1,atLeast=0]").arg(QString::number(threshold)),inputFiles,inputFiles);

        // Compare to global tail output
        distance->compare(t,t,o);

        delete o;

        QString buffer(Globals->buffer);

        QStringList tail = buffer.split("\n");

        // Remove header
        tail.removeFirst();

        QStringList toRemove;
        foreach(const QString &s, tail)
            toRemove.append(s.split(',').at(1));

        QSet<QString> duplicates = QSet<QString>::fromList(toRemove);

        QStringList fileNames = inputFiles.names();

        QList<int> indices;
        foreach(const QString &d, duplicates)
            indices.append(fileNames.indexOf(d));

        std::sort(indices.begin(),indices.end(),std::greater<float>());

        qDebug("\n%d duplicates removed.", indices.size());

        for (int i=0; i<indices.size(); i++)
            inputFiles.removeAt(indices[i]);

        QScopedPointer<Gallery> og(Gallery::make(outputGallery));

        og->writeBlock(inputFiles);
    }
开发者ID:RoxanneGe,项目名称:openbr,代码行数:49,代码来源:core.cpp

示例8: enter

// ------------------------------------------------------------------------------------------------
//
//
void CUI_Loadscreen::enter(void) 
{
  need_refresh = 1;
  is_loading = 0;
  cur_state = STATE_LOAD;
  FileList *fl;
  DirList *dl;
  fl = (FileList *)UI->get_element(0);
  dl = (DirList *)UI->get_element(1);
  dl->OnChange();
  fl->OnChange();
  if (song->filename[0] && song->filename[0]!=' ') strcpy(load_filename, (const char *)song->filename);
//    fl->set_cursor(load_filename);
  fl->setCursor(fl->findItem(load_filename));
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例9: getConfig

FileList Bitmunk::getModulePaths()
{
   FileList rval;

   Config cfg = getConfig()["node"];
   ConfigIterator mpi = cfg["modulePath"].getIterator();
   while(mpi->hasNext())
   {
      const char* path = mpi->next()->getString();
      FileList pathList = File::parsePath(path);
      rval->concat(*pathList);
   }

   return rval;
}
开发者ID:digitalbazaar,项目名称:bitmunk,代码行数:15,代码来源:bitmunk.cpp

示例10: defaultToolTip

String FileInputType::defaultToolTip() const
{
    FileList* fileList = m_fileList.get();
    unsigned listSize = fileList->length();
    if (!listSize)
        return fileButtonNoFileSelectedLabel();

    StringBuilder names;
    for (size_t i = 0; i < listSize; ++i) {
        names.append(fileList->item(i)->fileName());
        if (i != listSize - 1)
            names.append('\n');
    }
    return names.toString();
}
开发者ID:1833183060,项目名称:wke,代码行数:15,代码来源:FileInputType.cpp

示例11: GenFileList

void	GenFileList( const string& path )
{
	const string	CURR_PATH	= ".";
	const string	PARENT_PATH	= "..";
	
	WIN32_FIND_DATA	fd;
	string cur_file;
	string szFullPath(path + "/*");
	HANDLE h	= FindFirstFile( szFullPath.c_str(), &fd );
	if ( h != INVALID_HANDLE_VALUE )
	{
		BOOL	bMoreFile	= 1;
		while ( bMoreFile )
		{
			if ( CURR_PATH != fd.cFileName && PARENT_PATH != fd.cFileName )
			{
				cur_file = path + "/" + fd.cFileName;
				if ( fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
				{
					if ( fd.cFileName[0] != '.' )
						GenFileList(cur_file);
				}
				else
				{
					backslash_to_slash(cur_file);
					cur_file = cur_file.substr(cur_file.find("sound"), cur_file.length());
					g_file_list.push_back(cur_file);
				}
			}
			bMoreFile	= FindNextFile( h, &fd ); 
		}
		FindClose(h);
	}

}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:35,代码来源:GenAudioCheckFile.cpp

示例12: itemCallback

 static v8::Handle<v8::Value> itemCallback(const v8::Arguments& args) {
   INC_STATS("DOM.FileList.item");
   FileList* imp = V8FileList::toNative(args.Holder());
   ExceptionCode ec = 0;
   {
   int index = toInt32(args[0]);
   if (UNLIKELY(index < 0)) {
     ec = INDEX_SIZE_ERR;
     goto fail;
   }
   return toV8(imp->item(index));
   }
 fail:
   V8Proxy::setDOMException(ec);
   return v8::Handle<v8::Value>();
 }
开发者ID:,项目名称:,代码行数:16,代码来源:

示例13: listDirectory

/**
 * Lists the contents of the directory denoted by this File. If the current
 * File doesn't point to a directory or does not exist, an exception is thrown.
 *
 * @param result matching names will be put here
 * @param filter optional filter filter which can be used to filter filenames.
 * @return the number of items put into the result
 */
size_t File::listDirectory(FileList &result, FileFilter *filter) const
{
    if (!exists())
        throw std::logic_error("Cannot list a non-existing directory");
    if (!isDirectory())
        throw std::logic_error("Cannot list file which isn't a directory");
    if (!canRead())
        throw std::logic_error(std::string("No read access for directory ") + fullname);

    DIR *dir = opendir(fullname.c_str());
    if (dir == NULL) {
        throw std::logic_error("opendir() failed for a directory");
    }

    size_t numItems = 0;
    struct dirent *pEntry;

    pEntry = readdir(dir);
    while (pEntry)
    {
        // do not include "." and ".." in the list
        if (strcmp(pEntry->d_name, ".") && strcmp(pEntry->d_name, ".."))
        {
            File f(*this, pEntry->d_name);
            if (!filter || (*filter)(f))
            {
                result.push_back(std::move(f));
                ++numItems;
            }
        }
        pEntry = readdir(dir);
    }
    closedir(dir);
    return numItems;
}
开发者ID:PlayWithIt,项目名称:TFStubserver,代码行数:43,代码来源:File.cpp

示例14: jsFileListPrototypeFunctionItem

JSValue* jsFileListPrototypeFunctionItem(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSFileList::s_info))
        return throwError(exec, TypeError);
    JSFileList* castedThisObj = static_cast<JSFileList*>(thisValue);
    FileList* imp = static_cast<FileList*>(castedThisObj->impl());
    int index = args[0]->toInt32(exec);
    if (index < 0) {
        setDOMException(exec, INDEX_SIZE_ERR);
        return jsUndefined();
    }


    KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->item(index)));
    return result;
}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:16,代码来源:JSFileList.cpp

示例15: loaddirectories

static ibool loaddirectories(const char *filename,FileList& fileList)
/****************************************************************************
*
* Function:		loaddirectories
* Parameters:   filename	- Name of directories to look for
*				fileList	- Place to store the filenames
* Returns:		True on success, false on memory error
*
* Description:	Loads a list of all the directories from the current
*				directory into the specified name list.
*
****************************************************************************/
{
	PM_findData	findData;
	void		*hfile;
	ibool		valid;

	valid = (hfile = PM_findFirstFile(filename,&findData)) != NULL;
	while (valid) {
		if ((findData.attrib & PM_FILE_DIRECTORY) && findData.name[0] != '.') {
			fileList.add(new TCDynStr(findData.name));
			if (MV_lowMemory())
				return false;
			}
		valid = PM_findNextFile(hfile,&findData);
		}
	if (hfile)
		PM_findClose(hfile);
	return true;
}
开发者ID:OS2World,项目名称:LIB-VIDEO-MGL,代码行数:30,代码来源:mfiledlg.cpp


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