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


C++ XStringVector::size方法代码示例

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


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

示例1: Init

void Init(const char *gameCode)
{
	textureMap.clear();

	CFileSearch::XStringVector Directories;
	//Directories.push_back(File::GetUserPath(D_HIRESTEXTURES_IDX));
	char szDir[MAX_PATH];
	sprintf(szDir, "%s%s", File::GetUserPath(D_HIRESTEXTURES_IDX).c_str(), gameCode);
	Directories.push_back(std::string(szDir));
	

	for (u32 i = 0; i < Directories.size(); i++)
	{
		File::FSTEntry FST_Temp;
		File::ScanDirectoryTree(Directories[i], FST_Temp);
		for (u32 j = 0; j < FST_Temp.children.size(); j++)
		{
			if (FST_Temp.children.at(j).isDirectory)
			{
				bool duplicate = false;
				for (u32 k = 0; k < Directories.size(); k++)
				{
					if (strcmp(Directories[k].c_str(), FST_Temp.children.at(j).physicalName.c_str()) == 0)
					{
						duplicate = true;
						break;
					}
				}
				if (!duplicate)
					Directories.push_back(FST_Temp.children.at(j).physicalName.c_str());
			}
		}
	}

	CFileSearch::XStringVector Extensions;
	Extensions.push_back("*.png");
	Extensions.push_back("*.bmp");
	Extensions.push_back("*.tga");
	Extensions.push_back("*.dds");
	Extensions.push_back("*.jpg"); // Why not? Could be useful for large photo-like textures

	CFileSearch FileSearch(Extensions, Directories);
	const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
	char code[MAX_PATH];
	sprintf(code, "%s_", gameCode);

	if (rFilenames.size() > 0)
	{
		for (u32 i = 0; i < rFilenames.size(); i++)
		{
			std::string FileName;
			SplitPath(rFilenames[i], NULL, &FileName, NULL);

			if (FileName.substr(0, strlen(code)).compare(code) == 0 && textureMap.find(FileName) == textureMap.end())
				textureMap.insert(std::map<std::string, std::string>::value_type(FileName, rFilenames[i]));
		}
	}
}
开发者ID:Zombiebest,项目名称:Dolphin,代码行数:58,代码来源:HiresTextures.cpp

示例2:

CFileSearch::CFileSearch(const CFileSearch::XStringVector& _rSearchStrings, const CFileSearch::XStringVector& _rDirectories)
{
	// Reverse the loop order for speed?
	for (size_t j = 0; j < _rSearchStrings.size(); j++)
	{
		for (size_t i = 0; i < _rDirectories.size(); i++)
		{
			FindFiles(_rSearchStrings[j], _rDirectories[i]);
		}
	}
}
开发者ID:173210,项目名称:ppsspp,代码行数:11,代码来源:FileSearch.cpp

示例3: Init

void Init(const std::string& gameCode)
{
    textureMap.clear();

    CFileSearch::XStringVector Directories;

    std::string szDir = StringFromFormat("%s%s", File::GetUserPath(D_HIRESTEXTURES_IDX).c_str(), gameCode.c_str());
    Directories.push_back(szDir);

    for (u32 i = 0; i < Directories.size(); i++)
    {
        File::FSTEntry FST_Temp;
        File::ScanDirectoryTree(Directories[i], FST_Temp);
        for (auto& entry : FST_Temp.children)
        {
            if (entry.isDirectory)
            {
                bool duplicate = false;

                for (auto& Directory : Directories)
                {
                    if (Directory == entry.physicalName)
                    {
                        duplicate = true;
                        break;
                    }
                }

                if (!duplicate)
                    Directories.push_back(entry.physicalName);
            }
        }
    }

    CFileSearch::XStringVector Extensions = {
        "*.png",
        "*.bmp",
        "*.tga",
        "*.dds",
        "*.jpg" // Why not? Could be useful for large photo-like textures
    };

    CFileSearch FileSearch(Extensions, Directories);
    const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();

    const std::string code = StringFromFormat("%s_", gameCode.c_str());

    if (rFilenames.size() > 0)
    {
        for (auto& rFilename : rFilenames)
        {
            std::string FileName;
            SplitPath(rFilename, nullptr, &FileName, nullptr);

            if (FileName.substr(0, code.length()).compare(code) == 0 && textureMap.find(FileName) == textureMap.end())
                textureMap.insert(std::map<std::string, std::string>::value_type(FileName, rFilename));
        }
    }
}
开发者ID:diegobill,项目名称:dolphin,代码行数:59,代码来源:HiresTextures.cpp

示例4: Init

void Init(const char *gameCode)
{
	textureMap.clear();
	texturecount = 0;
	CFileSearch::XStringVector Directories;
	//Directories.push_back(File::GetUserPath(D_HIRESTEXTURES_IDX));
	char szDir[MAX_PATH];
	sprintf(szDir, "%s%s", File::GetUserPath(D_HIRESTEXTURES_IDX).c_str(), gameCode);
	Directories.push_back(std::string(szDir));
	

	for (u32 i = 0; i < Directories.size(); i++)
	{
		File::FSTEntry FST_Temp;
		File::ScanDirectoryTree(Directories[i], FST_Temp);
		for (u32 j = 0; j < FST_Temp.children.size(); j++)
		{
			if (FST_Temp.children.at(j).isDirectory)
			{
				bool duplicate = false;
				for (u32 k = 0; k < Directories.size(); k++)
				{
					if (strcmp(Directories[k].c_str(), FST_Temp.children.at(j).physicalName.c_str()) == 0)
					{
						duplicate = true;
						break;
					}
				}
				if (!duplicate)
					Directories.push_back(FST_Temp.children.at(j).physicalName.c_str());
			}
		}
	}

	CFileSearch::XStringVector Extensions;
	Extensions.push_back("*.png");
	Extensions.push_back("*.PNG");
	Extensions.push_back("*.bmp");
	Extensions.push_back("*.BMP");
	Extensions.push_back("*.tga");
	Extensions.push_back("*.TGA");
	Extensions.push_back("*.dds");
	Extensions.push_back("*.DDS");
	Extensions.push_back("*.jpg"); // Why not? Could be useful for large photo-like textures
	Extensions.push_back("*.JPG");
	CFileSearch FileSearch(Extensions, Directories);
	const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
	std::string code(gameCode);

	if (rFilenames.size() > 0)
	{
		for (u32 i = 0; i < rFilenames.size(); i++)
		{
			std::string FileName;
			std::string Extension;			
			SplitPath(rFilenames[i], NULL, &FileName, &Extension);
			std::pair<std::string, std::string> Pair(rFilenames[i], Extension);
			std::vector<std::string> nameparts;
			std::istringstream issfilename(FileName);
			std::string nameitem;
			while (std::getline(issfilename, nameitem, '_')) {
				nameparts.push_back(nameitem);
			}
			if (nameparts.size() >= 3)
			{
				u32 hash = 0;
				u32 format = 0;
				u32 mip = 0;
				sscanf(nameparts[1].c_str(), "%x", &hash);
				sscanf(nameparts[2].c_str(), "%i", &format);
				if (nameparts.size() > 3 && nameparts[3].size() > 3)
				{
					sscanf(nameparts[3].substr(3, std::string::npos).c_str(), "%i", &mip);
				}
				u64 key = ((u64)hash) | (((u64)format) << 32) | (((u64)mip) << 48);
				if (nameparts[0].compare(code) == 0 && textureMap.find(key) == textureMap.end())
				{
					texturecount++;
					textureMap.insert(std::map<u64, std::pair<std::string, std::string>>::value_type(key, Pair));
				}
			}
			
		}
	}
}
开发者ID:djbarry004,项目名称:Ishiiruka,代码行数:85,代码来源:HiresTextures.cpp


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