示例#1
0
int main() {
	DataStore ds;

	int argc = 4;
	char* argv[] = { "C://filename.cpp", "/s", "*.cpp", "*.h" };

	FileManager fm(ds, argc, argv);
	fm.processInput();
	fm.search();

	DataStore::iterator iter = ds.begin();
	using pathref = DataStore::pathIterator;

	std::cout << "\n FILE NAME \t\t PATH \n";
	std::cout << "------------------------------------------------\n\n";
	for (iter = ds.begin(); iter != ds.end(); iter++)
	{
		std::cout << iter->first << "\n";
		std::list<pathref> itss = iter->second;
		std::list<pathref>::iterator itssr;

		for (itssr = itss.begin(); itssr != itss.end(); itssr++)
		{
			std::cout << "\t\t\t" << (*(*itssr)) << "\n";
		}
	}
	std::cout << "\n\n";
	Catalogue c(ds);
	c.processTextInput("include");
	std::set<std::string> inputSet = c.getFileSet();
	for (auto element : inputSet) {
		unsigned found = element.find_last_of("/\\");
		std::string path = element.substr(0, found);
		std::string file = element.substr(found + 1);
		std::cout << "File : " << file << "\n";
		std::cout << "Path : " << path << "\n\n";
	}
	std::cout << "\n\n";
}
示例#2
0
int main()
{
  std::cout << "\n  Testing DataStore";

  DataStore ds;
  ds.save("one");
  ds.save("two");
  ds.save("three");
  DataStore::iterator iter = ds.begin();
  std::cout << "\n  " << (*iter).c_str();

  for (auto item : ds)
  {
    std::cout << "\n  " << item.c_str();
  }
  std::cout << "\n\n";
}