2009-12-19 19:53:53 +00:00
|
|
|
#include "dummy_vfs.cpp"
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2010-01-01 16:06:41 +00:00
|
|
|
void print(FileInfo &inf)
|
2009-12-19 19:53:53 +00:00
|
|
|
{
|
|
|
|
cout << "name: " << inf.name << endl;
|
|
|
|
cout << "basename: " << inf.basename << endl;
|
|
|
|
cout << "isDir: " << inf.isDir << endl;
|
|
|
|
cout << "size: " << inf.size << endl;
|
|
|
|
cout << "time: " << inf.time << endl;
|
|
|
|
}
|
2010-01-01 16:06:41 +00:00
|
|
|
void print(FileInfoPtr inf) { print(*inf); }
|
2009-12-19 19:53:53 +00:00
|
|
|
|
2010-01-01 16:06:41 +00:00
|
|
|
void print(FileInfoList &lst)
|
2009-12-19 19:53:53 +00:00
|
|
|
{
|
|
|
|
for(int i=0; i<lst.size(); i++)
|
|
|
|
print(lst[i]);
|
|
|
|
}
|
2010-01-01 16:06:41 +00:00
|
|
|
void print(FileInfoListPtr lst) { print(*lst); }
|
2009-12-19 19:53:53 +00:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
DummyVFS vfs;
|
|
|
|
|
|
|
|
cout << "Listing all files:\n";
|
|
|
|
print(vfs.list());
|
|
|
|
cout << "\nStat for single files:\n";
|
|
|
|
print(vfs.stat("file1"));
|
|
|
|
cout << endl;
|
|
|
|
print(vfs.stat("dir/file2"));
|
|
|
|
cout << endl;
|
|
|
|
print(vfs.stat("dir"));
|
|
|
|
|
2010-01-01 16:06:41 +00:00
|
|
|
StreamPtr inp = vfs.open("file1");
|
2009-12-19 19:53:53 +00:00
|
|
|
cout << "filesize: " << inp->size() << endl;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|