本文整理汇总了C++中DataStore::save方法的典型用法代码示例。如果您正苦于以下问题:C++ DataStore::save方法的具体用法?C++ DataStore::save怎么用?C++ DataStore::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataStore
的用法示例。
在下文中一共展示了DataStore::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
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;
}
示例2: main
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";
}
示例3: main
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";
}
示例4: main
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;
}