Esempio n. 1
0
int main()
{
  DataStore ds;
  ds.save("one", "../TESTFOLDER");
  ds.save("two", "../TESTFOLDER/Dir1");
  ds.save("one", "../TESTFOLDER/Dir1");

  map<string,set<string>> catalog=ds.fetch();

  ostream_iterator< string > output(cout, "\n|");
  map<string, set<string>>::iterator it;

  for (it = catalog.begin(); it != catalog.end(); ++it)
  {
	  set<string> value = catalog[it->first];
		  cout << "_______________________________________" << endl;
		  cout << "|  " << "FileName: " << it->first << endl;
		  cout << "----------------------------------------" << endl;
		  cout << "|" << "Path:\n|";
		  copy(value.begin(), value.end(), output);
		  cout << "----------------------------------------" << endl;
  }
  std::cout << "\n\n";
  return 0;
}
Esempio 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";
}
int main()
{
  title("Testing DataStore");

  DataStore ds;
  ds.save("firstFile","firstPath");
  ds.save("secondFile", "firstPath");
  ds.save("secondFile", "secondPath");

  std::cout << "\n  " << ds.numberOfFiles() << " Files in " << ds.numberOfPaths() << " directories\n";

  for (auto item : ds)
  {
    std::cout << "\n  " << (item).first.c_str()/* << " on " << (item).second.c_str()*/;
    DataStore::PathCollection paths = ds.getPaths(item.first);
    for (auto path : paths)
      std::cout << "\n    " << path;
  }
  std::cout << "\n\n";
}
Esempio n. 4
0
int main(){
	DisplayHelper DH;
	DataStore DS;
	DH.title("Test DataStore's save method with two parameters", '=');
	DS.save("test1.txt", "D:\\");
	DS.save("test1.txt", "D:\\FolderA");
	DS.save("test2.txt", "D:\\FolderA");
	for (auto ds : DS){
		DH.displayFilename(ds.first);
		for (auto p : ds.second){
			DH.displayPath(*p);
		}
		DH.displayInfo("");
	}

	DH.title("Test DataStore's save method with one parameter", '=');
	DS.save("D:\\newtest1.txt");
	DS.save("D:\\FolderA\\newtest2.txt");
	for (auto ds : DS){
		DH.displayFilename(ds.first);
		for (auto p : ds.second){
			DH.displayPath(*p);
		}
	}

	DH.title("Test DataStore's findFile method", '=');
	DataStore::iterator it = DS.findFile("test1.txt");
	DH.displayFilename(it->first);
	for (list<DataStore::PathsIter>::iterator lit = (it->second).begin(); lit != (it->second).end(); lit++)
		DH.displayPath(**lit);

	DH.title("Test DataStore's findPathIter method", '=');
	string filename = "test2.txt", path1 = "D:\\FolderA", path2 = "D:\\";
	string info1 = "The PathIter from " + filename + " to " + path1 + (DS.findPathIter(filename, path1) ? " exists" : " doesn't exist");
	DH.displayInfo(info1);
	string info2 = "The PathIter from " + filename + " to " + path2 + (DS.findPathIter(filename, path2) ? " exists" : " doesn't exist");
	DH.displayInfo(info2);
	DH.displayInfo("\n");
	return 0;
}