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


C++ StringArray::IsEmpty方法代码示例

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


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

示例1: main

// Use the legacy main on Linux and assume UTF-8
int main(int argc, char** argv)
#endif

{
	String cmdLine = Process::GetCommandLine();

	ArgvParser ap(argc, argv);
	if( !ap.HasFlag("file") )
	{
		// Display usage
		String version = "PngOptimizerCL 2.4.1";
#if defined(_M_X64)
		version = version + String(" (x64)");
#elif defined(_M_IX86)  
		version = version + String(" (x86)");
#endif
		Console::WriteLine(version + " \xA9 2002/2014 Hadrien Nilsson - psydk.org");
		Console::WriteLine("Converts GIF, BMP and TGA files to optimized PNG files.");
		Console::WriteLine("Optimizes and cleans PNG files.");
		Console::WriteLine("");
		Console::WriteLine("Usage:  PngOptimizerCL -file:\"yourfile.png\" [-recurs]");
		POEngineSettings::WriteArgvUsage("  ");
		Console::WriteLine("");
		Console::WriteLine("Values enclosed with [] are optional.");
		Console::WriteLine("Chunk option meaning: R=Remove, K=Keep, F=Force. 0|1|2 can be used too.");
		Console::WriteLine("");
		Console::WriteLine("Input examples:");
		Console::WriteLine("Handle a specific file:");
		Console::WriteLine("  PngOptimizerCL -file:\"icon.png\"");
		Console::WriteLine("Handle specific file types in the current directory:");
		Console::WriteLine("  PngOptimizerCL -file:\"*.png|*.bmp\"");
		Console::WriteLine("Handle any supported file in the current directory:");
		Console::WriteLine("  PngOptimizerCL -file:\"*\"");
		Console::WriteLine("Handle specific file types in the current directory (recursive):");
		Console::WriteLine("  PngOptimizerCL -file:\".png|*.bmp\" -recurs");
		Console::WriteLine("Handle a specific directory (recursive):");
		Console::WriteLine("  PngOptimizerCL -file:\"gfx/\"");
		Console::WriteLine("");
	
		if( Console::IsOwned() )
		{
			Console::Write("Press any key to continue");
			Console::WaitForKey();
		}
		return 0;
	}

	POApplicationConsole app;

	// PngOptimizer.exe -file:"myfile.png"

	POEngine engine;
	if( !engine.WarmUp() )
	{
		Console::WriteLine("Warm-up failed");
		return 1;
	}
	engine.Progressing.Handle(&app, &POApplicationConsole::OnEngineProgressing);

	engine.m_settings.LoadFromArgv(ap);

	//////////////////////////////////////////////////////////////////
	String filePath = ap.GetFlagString("file");
	String dir, fileName;
	FilePath::Split(filePath, dir, fileName);
	StringArray filePaths;
	String joker;
	if( ap.HasFlag("recurs") )
	{
		filePaths.Add(dir);
		joker = fileName;
	}
	else
	{
		filePaths = Directory::GetFileNames(dir, fileName, true);
		if( filePaths.IsEmpty() )
		{
			// For PngOptimizerCL, it is an error if we have nothing to optimize
			Color32 col = POEngine::ColorFromTextType(POEngine::TT_ErrorMsg);
			Console::SetTextColor(col);
			Console::WriteLine("File not found: " + filePath);
			Console::ResetTextColor();
			return 1;
		}
	}

	if( !engine.OptimizeFiles(filePaths, joker) )
	{
		return 1;
	}
	return 0;
}
开发者ID:cloudflare,项目名称:pngoptimizer,代码行数:93,代码来源:PngOptimizerCL.cpp


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