CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
vfsvfs.h
1#pragma once
2// This header file is auto-generated!
3// Do not make changes to this file or they will be overwritten.
4// clang-format off
5#include <cx/obj.h>
6#include <cx/fs/vfsprovider.h>
7#include <cx/fs/vfsobj.h>
8
9typedef struct VFSDir VFSDir;
10typedef struct VFSVFS VFSVFS;
11typedef struct VFSVFS_WeakRef VFSVFS_WeakRef;
12saDeclarePtr(VFSVFS);
13saDeclarePtr(VFSVFS_WeakRef);
14
15typedef struct VFSVFS_ClassIf {
16 ObjIface* _implements;
17 ObjIface* _parent;
18 size_t _size;
19
20 // VFSProviderFlags enforced for this provider
21 flags_t (*flags)(_In_ void* self);
22 // returns an object that implements VFSFileProvider
23 _Ret_opt_valid_ ObjInst* (*open)(_In_ void* self, _In_opt_ strref path, flags_t flags);
24 FSPathStat (*stat)(_In_ void* self, _In_opt_ strref path, _When_(return != FS_Nonexistent, _Out_opt_) FSStat* stat);
25 bool (*setTimes)(_In_ void* self, _In_opt_ strref path, int64 modified, int64 accessed);
26 bool (*createDir)(_In_ void* self, _In_opt_ strref path);
27 bool (*removeDir)(_In_ void* self, _In_opt_ strref path);
28 bool (*deleteFile)(_In_ void* self, _In_opt_ strref path);
29 bool (*rename)(_In_ void* self, _In_opt_ strref oldpath, _In_opt_ strref newpath);
30 bool (*getFSPath)(_In_ void* self, _Inout_ string* out, _In_opt_ strref path);
31 bool (*searchInit)(_In_ void* self, _Out_ FSSearchIter* iter, _In_opt_ strref path, _In_opt_ strref pattern, bool stat);
32 bool (*searchValid)(_In_ void* self, _In_ FSSearchIter* iter);
33 bool (*searchNext)(_In_ void* self, _Inout_ FSSearchIter* iter);
34 void (*searchFinish)(_In_ void* self, _Inout_ FSSearchIter* iter);
35} VFSVFS_ClassIf;
36extern VFSVFS_ClassIf VFSVFS_ClassIf_tmpl;
37
38typedef struct VFSVFS {
39 union {
40 VFSVFS_ClassIf* _;
41 void* _is_VFSVFS;
42 void* _is_ObjInst;
43 };
44 ObjClassInfo* _clsinfo;
45 atomic(uintptr) _ref;
46 atomic(ptr) _weakref;
47
48 VFS* vfs;
49 string root;
50} VFSVFS;
51extern ObjClassInfo VFSVFS_clsinfo;
52#define VFSVFS(inst) ((VFSVFS*)(unused_noeval((inst) && &((inst)->_is_VFSVFS)), (inst)))
53#define VFSVFSNone ((VFSVFS*)NULL)
54
55typedef struct VFSVFS_WeakRef {
56 union {
57 ObjInst* _inst;
58 void* _is_VFSVFS_WeakRef;
59 void* _is_ObjInst_WeakRef;
60 };
61 atomic(uintptr) _ref;
62 RWLock _lock;
63} VFSVFS_WeakRef;
64#define VFSVFS_WeakRef(inst) ((VFSVFS_WeakRef*)(unused_noeval((inst) && &((inst)->_is_VFSVFS_WeakRef)), (inst)))
65
66_objfactory_guaranteed VFSVFS* VFSVFS_create(VFS* vfs, _In_opt_ strref rootpath);
67// VFSVFS* vfsvfsCreate(VFS* vfs, strref rootpath);
68#define vfsvfsCreate(vfs, rootpath) VFSVFS_create(VFS(vfs), rootpath)
69
70// flags_t vfsvfsFlags(VFSVFS* self);
71//
72// VFSProviderFlags enforced for this provider
73#define vfsvfsFlags(self) (self)->_->flags(VFSVFS(self))
74// ObjInst* vfsvfsOpen(VFSVFS* self, strref path, flags_t flags);
75//
76// returns an object that implements VFSFileProvider
77#define vfsvfsOpen(self, path, flags) (self)->_->open(VFSVFS(self), path, flags)
78// FSPathStat vfsvfsStat(VFSVFS* self, strref path, FSStat* stat);
79#define vfsvfsStat(self, path, stat) (self)->_->stat(VFSVFS(self), path, stat)
80// bool vfsvfsSetTimes(VFSVFS* self, strref path, int64 modified, int64 accessed);
81#define vfsvfsSetTimes(self, path, modified, accessed) (self)->_->setTimes(VFSVFS(self), path, modified, accessed)
82// bool vfsvfsCreateDir(VFSVFS* self, strref path);
83#define vfsvfsCreateDir(self, path) (self)->_->createDir(VFSVFS(self), path)
84// bool vfsvfsRemoveDir(VFSVFS* self, strref path);
85#define vfsvfsRemoveDir(self, path) (self)->_->removeDir(VFSVFS(self), path)
86// bool vfsvfsDeleteFile(VFSVFS* self, strref path);
87#define vfsvfsDeleteFile(self, path) (self)->_->deleteFile(VFSVFS(self), path)
88// bool vfsvfsRename(VFSVFS* self, strref oldpath, strref newpath);
89#define vfsvfsRename(self, oldpath, newpath) (self)->_->rename(VFSVFS(self), oldpath, newpath)
90// bool vfsvfsGetFSPath(VFSVFS* self, string* out, strref path);
91#define vfsvfsGetFSPath(self, out, path) (self)->_->getFSPath(VFSVFS(self), out, path)
92// bool vfsvfsSearchInit(VFSVFS* self, FSSearchIter* iter, strref path, strref pattern, bool stat);
93#define vfsvfsSearchInit(self, iter, path, pattern, stat) (self)->_->searchInit(VFSVFS(self), iter, path, pattern, stat)
94// bool vfsvfsSearchValid(VFSVFS* self, FSSearchIter* iter);
95#define vfsvfsSearchValid(self, iter) (self)->_->searchValid(VFSVFS(self), iter)
96// bool vfsvfsSearchNext(VFSVFS* self, FSSearchIter* iter);
97#define vfsvfsSearchNext(self, iter) (self)->_->searchNext(VFSVFS(self), iter)
98// void vfsvfsSearchFinish(VFSVFS* self, FSSearchIter* iter);
99#define vfsvfsSearchFinish(self, iter) (self)->_->searchFinish(VFSVFS(self), iter)
100
#define saDeclarePtr(name)
Definition sarray.h:98
enum FSPathStatEnum FSPathStat
@ FS_Nonexistent
Path does not exist.
Definition fs.h:94
#define _objfactory_guaranteed
Definition objimpl.h:104
CX Object System - Object-oriented programming in C.
Definition fs.h:103
VFS Object.
Definition vfsobj.h:25
VFS object definitions.