forked from zinnschlag/mangle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdummy_test.cpp
42 lines (34 loc) · 860 Bytes
/
dummy_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "dummy_vfs.cpp"
#include <iostream>
#include <string.h>
using namespace std;
void print(FileInfo &inf)
{
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;
}
void print(FileInfoPtr inf) { print(*inf); }
void print(FileInfoList &lst)
{
for(unsigned i=0; i<lst.size(); i++)
print(lst[i]);
}
void print(FileInfoListPtr lst) { print(*lst); }
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"));
StreamPtr inp = vfs.open("file1");
cout << "filesize: " << inp->size() << endl;
return 0;
}