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


C++ IFileSystem类代码示例

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


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

示例1: guard

bool MetaFileSystem::MkDir(const std::string &dirname)
{
	std::lock_guard<std::recursive_mutex> guard(lock);
	std::string of;
	IFileSystem *system;
	if (MapFilePath(dirname, of, &system))
	{
		return system->MkDir(of);
	}
	else
	{
		return false;
	}
}
开发者ID:333rich333,项目名称:citra,代码行数:14,代码来源:meta_file_system.cpp

示例2: RenameFile

bool MetaFileSystem::RenameFile(const std::string &from, const std::string &to)
{
	std::string of;
	std::string rf;
	IFileSystem *system;
	if (MapFilePath(from, of, &system) && MapFilePath(to, rf, &system))
	{
		return system->RenameFile(of, rf);
	}
	else
	{
		return false;
	}
}
开发者ID:CPkmn,项目名称:ppsspp,代码行数:14,代码来源:MetaFileSystem.cpp

示例3:

std::vector<PSPFileInfo> MetaFileSystem::GetDirListing(std::string path)
{
	std::string of;
	IFileSystem *system;
	if (MapFilePath(path, of, &system))
	{
		return system->GetDirListing(of);
	}
	else
	{
		std::vector<PSPFileInfo> empty;
		return empty;
	}
}
开发者ID:173210,项目名称:ppsspp,代码行数:14,代码来源:MetaFileSystem.cpp

示例4: guard

bool MetaFileSystem::RmDir(const std::string &dirname)
{
	lock_guard guard(lock);
	std::string of;
	IFileSystem *system;
	if (MapFilePath(dirname, of, &system))
	{
		return system->RmDir(of);
	}
	else
	{
		return false;
	}
}
开发者ID:elsonLee,项目名称:ppsspp,代码行数:14,代码来源:MetaFileSystem.cpp

示例5: GetFileInfo

PSPFileInfo MetaFileSystem::GetFileInfo(std::string filename)
{
	std::string of;
	IFileSystem *system;
	if (MapFilePath(filename, of, &system))
	{
		return system->GetFileInfo(of);
	}
	else
	{
		PSPFileInfo bogus; // TODO
		return bogus; 
	}
}
开发者ID:173210,项目名称:ppsspp,代码行数:14,代码来源:MetaFileSystem.cpp

示例6: CreateFileSystem

IFileSystem* CreateFileSystem(const IVolume* _rVolume)
{
	IFileSystem* pFileSystem = new CFileSystemGCWii(_rVolume);

	if (!pFileSystem)
		return nullptr;

	if (!pFileSystem->IsValid())
	{
		delete pFileSystem;
		pFileSystem = nullptr;
	}

	return pFileSystem;
}
开发者ID:Jack-Walker,项目名称:Ishiiruka,代码行数:15,代码来源:Filesystem.cpp

示例7:

bool
CMNGAnimation::Load(const char* filename, IFileSystem& fs)
{
  this->~CMNGAnimation();

  // open the file
  m_file = fs.Open(filename, IFileSystem::read);
  if (m_file == NULL) {
    return false;
  }

  // initialize MNG playback
  m_stream = mng_initialize(this, CB_Allocate, CB_Free, NULL);

  // set all of the callbacks
  mng_setcb_openstream(m_stream, CB_OpenStream);
  mng_setcb_closestream(m_stream, CB_CloseStream);
  mng_setcb_readdata(m_stream, CB_ReadData);
  mng_setcb_processheader(m_stream, CB_ProcessHeader);
  mng_setcb_gettickcount(m_stream, CB_GetTickCount);
  mng_setcb_getcanvasline(m_stream, CB_GetCanvasLine);
  mng_setcb_refresh(m_stream, CB_Refresh);
  mng_setcb_settimer(m_stream, CB_SetTimer);

  // do some reading
  if (mng_read(m_stream) != MNG_NOERROR) {
    return false;
  }

  return true;
}
开发者ID:chadaustin,项目名称:sphere,代码行数:31,代码来源:MNGAnimation.cpp

示例8: while

bool
CConfigFile::Load(const char* filename, IFileSystem& fs)
{
    m_sections.erase(m_sections.begin(), m_sections.end());

    // open the file
    IFile* file = fs.Open(filename, IFileSystem::read);
    if (file == NULL) {
        return false;
    }

    std::string current_section = "";

    bool eof = false;
    while (!eof) {
        // read a line
        std::string line;
        eof = !read_line(file, line);
        const char* string = line.c_str();

        // parse it

        // eliminate whitespace
        skip_whitespace(string);

        if (string[0] == '[') {  // it's a section
            string++;

            current_section = "";
            while (*string != ']') {
                current_section += *string++;
            }
            string++;
        } else {                 // it's a key=value pair

            // read key
            std::string key;
            while (*string != '=' && *string) {
                key += *string++;
            }

            if (*string == 0) {
                continue; // skip lines without equals
            }
            string++; // skip the '='

            std::string value;
            while (*string) {
                value += *string++;
            }

            // add the item
            WriteString(current_section.c_str(), key.c_str(), value.c_str());
        }
    }

    file->Close();
    return true;
}
开发者ID:sphere-group,项目名称:sphere,代码行数:59,代码来源:configfile.cpp

示例9: LoadFromFile

bool
sTileset::Load(const char* filename, IFileSystem& fs)
{
  IFile* file = fs.Open(filename, IFileSystem::read);
  if (file == NULL)
    return false;

  bool result = LoadFromFile(file);

  file->Close();
  return result;
}
开发者ID:FlyingJester,项目名称:sphere,代码行数:12,代码来源:Tileset.cpp

示例10: PrintDetailedPlayerClassStats

void PrintDetailedPlayerClassStats()
{
	if ( !tf_DetailedStats.GetInt() )
		return;

	IFileSystem *pFileSys = filesystem;

	FileHandle_t hFile = pFileSys->Open( "class_stats_detailed.txt", "wt", "LOGDIR" );
	if ( hFile != FILESYSTEM_INVALID_HANDLE )
	{
		// Print the header.
		for ( int i=TFCLASS_UNDECIDED+1; i < STATS_NUM_GROUPS; i++ )
		{
			pFileSys->FPrintf( hFile, "%s dist\t%s dmg\t", GetGroupNameFor( i ), GetGroupNameFor( i ) );
		}
		pFileSys->FPrintf( hFile, "\n" );

		// Write out each column.
		int iterators[STATS_NUM_GROUPS];
		for ( i=TFCLASS_UNDECIDED+1; i < STATS_NUM_GROUPS; i++ )
			iterators[i] = g_ClassShotInfos[i].Head();

		bool bWroteAnything;
		do
		{
			bWroteAnything = false;
			for ( int i=TFCLASS_UNDECIDED+1; i < STATS_NUM_GROUPS; i++ )
			{
				if ( iterators[i] == g_ClassShotInfos[i].InvalidIndex() )
				{
					pFileSys->FPrintf( hFile, "\t\t" );
				}
				else
				{
					CShotInfo *pInfo = &g_ClassShotInfos[i][iterators[i]];
					iterators[i] = g_ClassShotInfos[i].Next( iterators[i] );

					pFileSys->FPrintf( hFile, "%.2f\t%d\t", pInfo->m_flDistance, pInfo->m_nDamage );
					bWroteAnything = true;
				}
			}
			pFileSys->FPrintf( hFile, "\n" );

		} while ( bWroteAnything );


		pFileSys->Close( hFile );
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:49,代码来源:tf_playerclass.cpp

示例11: SaveToFile

bool
sTileset::Save(const char* filename, IFileSystem& fs) const
{
  // open the file
  IFile* file = fs.Open(filename, IFileSystem::write);
  if (file == NULL)
    return false;

  bool result = SaveToFile(file);

  file->Close();
  return result;
}
开发者ID:FlyingJester,项目名称:sphere,代码行数:13,代码来源:Tileset.cpp

示例12:

bool
CConfigFile::Save(const char* filename, IFileSystem& fs) const
{
    IFile* file = fs.Open(filename, IFileSystem::write);
    if (file == NULL) {
        return false;
    }

    // find the section without a name and write that first
    std::map<std::string, Section>::const_iterator i;
    for (i = m_sections.begin(); i != m_sections.end(); i++) {
        if (i->first == "") {
            const Section& s = i->second;

            std::map<std::string, std::string>::const_iterator j;
            for (j = s.entries.begin(); j != s.entries.end(); j++) {
                write_string(file, j->first);
                file->Write("=", 1);
                write_string(file, j->second);
                file->Write("\n", 1);
            }

            file->Write("\n", 1);
        }
    }

    // write the rest of the sections
    for (i = m_sections.begin(); i != m_sections.end(); i++) {
        if (i->first != "") {
            file->Write("[", 1);
            write_string(file, i->first);
            file->Write("]\n", 2);

            const Section& s = i->second;
            std::map<std::string, std::string>::const_iterator j;
            for (j = s.entries.begin(); j != s.entries.end(); j++) {
                write_string(file, j->first);
                file->Write("=", 1);
                write_string(file, j->second);
                file->Write("\n", 1);
            }

            file->Write("\n", 1);

        }
    }

    file->Close();
    return true;
}
开发者ID:sphere-group,项目名称:sphere,代码行数:50,代码来源:configfile.cpp

示例13: LoadJson

CString WindowManager::LoadJson(IFileSystem& fileSystem, const CString& cszRelativeFilename)
{
   std::shared_ptr<Stream::IStream> spStream =
      fileSystem.OpenFile(cszRelativeFilename, true);

   Stream::TextStreamFilter stream(*spStream,
      Stream::ITextStream::textEncodingAnsi,
      Stream::ITextStream::lineEndingNative);

   CString cszLine, cszText;
   while (!stream.AtEndOfStream())
   {
      stream.ReadLine(cszLine);
      cszText += cszLine;
      cszText += _T("\r\n");
   }

   return cszText;
}
开发者ID:zengnotes,项目名称:MultiplayerOnlineGame,代码行数:19,代码来源:WindowManager.cpp

示例14: GetHandleOwner

void MetaFileSystem::CloseFile(u32 handle)
{
	IFileSystem *sys = GetHandleOwner(handle);
	if (sys)
		sys->CloseFile(handle);
}
开发者ID:Darth1701,项目名称:ppsspp,代码行数:6,代码来源:MetaFileSystem.cpp

示例15: ParsePartitionData

// Operations dealing with encrypted space are done here - the volume is swapped to allow this
bool ParsePartitionData(SPartition& _rPartition)
{
	bool ParsedOK = true;

	// Switch out the main volume temporarily
	IVolume *OldVolume = m_Disc;

	// Ready some stuff
	m_Disc = CreateVolumeFromFilename(m_Filename, _rPartition.GroupNumber, _rPartition.Number);
	IFileSystem *FileSystem = CreateFileSystem(m_Disc);

	if (!FileSystem)
	{
		ERROR_LOG(DISCIO, "Failed to create filesystem for group %d partition %u", _rPartition.GroupNumber, _rPartition.Number);
		ParsedOK = false;
	}
	else
	{
		std::vector<const SFileInfo *> Files;
		size_t numFiles = FileSystem->GetFileList(Files);

		// Mark things as used which are not in the filesystem
		// Header, Header Information, Apploader
		ReadFromVolume(0x2440 + 0x14, 4, _rPartition.Header.ApploaderSize);
		ReadFromVolume(0x2440 + 0x18, 4, _rPartition.Header.ApploaderTrailerSize);
		MarkAsUsedE(_rPartition.Offset
			+ _rPartition.Header.DataOffset
			, 0
			, 0x2440
			+ _rPartition.Header.ApploaderSize
			+ _rPartition.Header.ApploaderTrailerSize);

		// DOL
		ReadFromVolume(0x420, 4, _rPartition.Header.DOLOffset);
		_rPartition.Header.DOLSize = GetDOLSize(_rPartition.Header.DOLOffset);
		MarkAsUsedE(_rPartition.Offset
			+ _rPartition.Header.DataOffset
			, _rPartition.Header.DOLOffset
			, _rPartition.Header.DOLSize);

		// FST
		ReadFromVolume(0x424, 4, _rPartition.Header.FSTOffset);
		ReadFromVolume(0x428, 4, _rPartition.Header.FSTSize);
		MarkAsUsedE(_rPartition.Offset
			+ _rPartition.Header.DataOffset
			, _rPartition.Header.FSTOffset
			, _rPartition.Header.FSTSize);

		// Go through the filesystem and mark entries as used
		for (size_t currentFile = 0; currentFile < numFiles; currentFile++)
		{
			DEBUG_LOG(DISCIO, "%s", currentFile ? (*Files.at(currentFile)).m_FullPath : "/");
			// Just 1byte for directory? - it will end up reserving a cluster this way
			if ((*Files.at(currentFile)).m_NameOffset & 0x1000000)
				MarkAsUsedE(_rPartition.Offset
				+ _rPartition.Header.DataOffset
				, (*Files.at(currentFile)).m_Offset, 1);
			else
				MarkAsUsedE(_rPartition.Offset
				+ _rPartition.Header.DataOffset
				, (*Files.at(currentFile)).m_Offset, (*Files.at(currentFile)).m_FileSize);
		}
	}

	delete FileSystem;

	// Swap back
	delete m_Disc;
	m_Disc = OldVolume;

	return ParsedOK;
}
开发者ID:Idan345,项目名称:dolphin,代码行数:73,代码来源:DiscScrubber.cpp


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