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


C++ Display::displayHandle方法代码示例

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


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

示例1: main

int main(int argc, char *  argv[])
{
	DataStore dataStore;
	Display display;
	string path;
	vector<string>options;
	vector<string>pattern;
	vector<string> files;
	Executive executive;

	if (argc == 1)
		path = ".";
	else
	{
		path = argv[1];
		std::string pathTest = FileSystem::Path::getFullFileSpec(path);
		DWORD ftyp = GetFileAttributesA(pathTest.c_str());						//checks if user has provided path or not
		if (ftyp == INVALID_FILE_ATTRIBUTES)
			path = ".";
	}
	pattern = executive.processArgumentsPattern(argv, argc);
	options = executive.processArgumentOptions(argv, argc);

	if (pattern.size() == 0)
		pattern.push_back("*.*");
	FileManager fileManager(options, pattern);
	fileManager.search(path, dataStore);
	map <string, list<DataStore::PathIter>> mapVal = dataStore.dispMap();
	int number_of_directories = fileManager.number_of_dir();
	int number_of_file = fileManager.number_of_files();

	display.displayHandle(options, number_of_file, number_of_directories, mapVal, files, dataStore);

	int flag = 1;

	while (flag)
	{
		//options.clear(); 
		pattern.clear();
		dataStore.clear();
		cin.clear();
		fflush(stdin);

		cout << endl << "================================================================================";
		cout << "================================================================================" << endl;
		cout << "**************User Inputs**************" << endl;
		cout << endl << "================================================================================";
		cout << "================================================================================" << endl;
		cout << endl << "Please enter the text you want to search OR press enter to exit" << endl << endl;

		string input = "";
		//cin>> input;
		input = cin.get(); 

		if (input == "\n") //.empty())
		{
			cout << "\n Exiting as no text is entered!!" << endl;
			break;
		}

		cout << "\n Please enter file pattern(s) in which text needs to be searched" << endl;
		cin.clear();
		fflush(stdin);

		string newPattern = "";
		getline(cin,newPattern);

		istringstream iss(newPattern);
		vector<string> tokens{ istream_iterator < string > {iss},
			istream_iterator < string > {} };

		regex r("[A-Za-z\\*]+\\.[A-Za-z\\*]+$");
		for (string tok : tokens)
		{
			if (regex_match(tok, r))
				pattern.push_back(tok);
		}


		if (pattern.size() == 0)
			pattern.push_back("*.*");

		string a = "/f<" + input + ">";


		//options.push_back("/d"); 

		std::vector<string>::iterator iter = options.begin();

		while (iter != options.end())
		{
			if (*iter == a)
				iter = options.erase(iter);
			else
				iter++;
		}

		options.push_back(a);

		map<string, int> m;
//.........这里部分代码省略.........
开发者ID:Raag079,项目名称:FileCatalogue,代码行数:101,代码来源:Executive.cpp


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