CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
vfsprovider.cxh
1#include <cx/fs/fs.h>
2#include <cx/fs/file.h>
3#include <cx/fs/fileobj.cxh>
4
5interface VFSProvider {
6 flags_t flags(); // VFSProviderFlags enforced for this provider
7
8 [opt] File *open(strref path, flags_t flags); // caller takes ownership of the returned file
9 FSPathStat stat(strref path, [sal _When_(return != FS_Nonexistent, _Out_opt_)] FSStat *stat);
10 bool setTimes(strref path, int64 modified, int64 accessed);
11 bool createDir(strref path);
12 bool removeDir(strref path);
13 bool deleteFile(strref path);
14 bool rename(strref oldpath, strref newpath);
15 bool getFSPath([inout] string *out, strref path);
16
17 /// Begins iterating a directory, positioning iter on the first matching entry.
18 ///
19 /// Clear iter before doing anything else, and release everything you allocated before
20 /// returning false -- a caller is allowed to walk away from a failed searchInit without
21 /// calling searchFinish.
22 ///
23 /// @param iter Iterator to initialize
24 /// @param path Directory to list, relative to the mount point ("" is the mount root)
25 /// @param pattern Wildcard to match entry names against, or NULL for all of them
26 /// @param stat Fill in each entry's stat field
27 /// @return true if the directory was listed and has at least one matching entry
28 bool searchInit([out] FSSearchIter *iter, strref path, strref pattern, bool stat);
29 bool searchValid([in] FSSearchIter *iter);
30 bool searchNext([inout] FSSearchIter *iter);
31 /// Releases whatever searchInit allocated.
32 ///
33 /// Must do nothing when handed a cleared iterator, so that it is safe to call after a
34 /// failed searchInit as well as after a successful one.
35 void searchFinish([inout] FSSearchIter *iter);
36}