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/struct.h>
7#include <cx/fs/vfsprovider.h>
8#include <cx/fs/vfsobj.h>
9
10CX_C_BEGIN
11
12typedef struct VFSDir VFSDir;
13typedef struct VFSVFS VFSVFS;
14typedef struct VFSVFS_WeakRef VFSVFS_WeakRef;
15saDeclarePtr(VFSVFS);
16saDeclarePtr(VFSVFS_WeakRef);
17#define _sti_VFSVFS _sti_object
18#define SType_VFSVFS VFSVFS*
19#define STStorageType_VFSVFS VFSVFS*
20#define STypeArg_VFSVFS(type, val) stgeneric(object, (ObjInst*)objInstCheckClass(VFSVFS, val))
21#define STypeArgPtr_VFSVFS(type, val) (stgeneric*)objInstCheckClassPtr(VFSVFS, val)
22#define STypeCheckedArg_VFSVFS(type, val) stType(type), stArg(type, val)
23#define STypeCheckedPtrArg_VFSVFS(type, val) stType(type), stArgPtr(type, val)
24
25typedef struct VFSVFS_ClassIf {
26 ObjIface* _implements;
27 ObjIface* _parent;
28 size_t _size;
29
30 // VFSProviderFlags enforced for this provider
31 flags_t (*flags)(_In_ void* self);
32 // caller takes ownership of the returned file
33 _Ret_opt_valid_ File* (*open)(_In_ void* self, _In_opt_ strref path, flags_t flags);
34 FSPathStat (*stat)(_In_ void* self, _In_opt_ strref path, _When_(return != FS_Nonexistent, _Out_opt_) FSStat* stat);
35 bool (*setTimes)(_In_ void* self, _In_opt_ strref path, int64 modified, int64 accessed);
36 bool (*createDir)(_In_ void* self, _In_opt_ strref path);
37 bool (*removeDir)(_In_ void* self, _In_opt_ strref path);
38 bool (*deleteFile)(_In_ void* self, _In_opt_ strref path);
39 bool (*rename)(_In_ void* self, _In_opt_ strref oldpath, _In_opt_ strref newpath);
40 bool (*getFSPath)(_In_ void* self, _Inout_ string* out, _In_opt_ strref path);
41 bool (*searchInit)(_In_ void* self, _Out_ FSSearchIter* iter, _In_opt_ strref path, _In_opt_ strref pattern, bool stat);
42 bool (*searchValid)(_In_ void* self, _In_ FSSearchIter* iter);
43 bool (*searchNext)(_In_ void* self, _Inout_ FSSearchIter* iter);
44 void (*searchFinish)(_In_ void* self, _Inout_ FSSearchIter* iter);
45} VFSVFS_ClassIf;
46extern VFSVFS_ClassIf VFSVFS_ClassIf_tmpl;
47
48typedef struct VFSVFS {
49 union {
50 VFSVFS_ClassIf* _;
51 void* _is_VFSVFS;
52 void* _is_ObjInst;
53 };
54 ObjClassInfo* _clsinfo;
55 atomic(uintptr) _ref;
56 atomic(ptr) _weakref;
57
58 VFS* vfs;
59 string root;
60} VFSVFS;
61extern ObjClassInfo VFSVFS_clsinfo;
62#define VFSVFS(inst) objInstCheckClass(VFSVFS, inst)
63#define VFSVFSNone ((VFSVFS*)NULL)
64
65typedef struct VFSVFS_WeakRef {
66 union {
67 ObjInst* _inst;
68 void* _is_VFSVFS_WeakRef;
69 void* _is_ObjInst_WeakRef;
70 };
71 atomic(uintptr) _ref;
72 RWLock _lock;
73} VFSVFS_WeakRef;
74#define VFSVFS_WeakRef(inst) objWeakRefCheckClass(VFSVFS, inst)
75
76_objfactory_guaranteed VFSVFS* VFSVFS_create(VFS* vfs, _In_opt_ strref rootpath);
77// VFSVFS* vfsvfsCreate(VFS* vfs, strref rootpath);
78#define vfsvfsCreate(vfs, rootpath) VFSVFS_create(VFS(vfs), rootpath)
79
80// flags_t vfsvfsFlags(VFSVFS* self);
81//
82// VFSProviderFlags enforced for this provider
83#define vfsvfsFlags(self) (self)->_->flags(VFSVFS(self))
84// File* vfsvfsOpen(VFSVFS* self, strref path, flags_t flags);
85//
86// caller takes ownership of the returned file
87#define vfsvfsOpen(self, path, flags) (self)->_->open(VFSVFS(self), path, flags)
88// FSPathStat vfsvfsStat(VFSVFS* self, strref path, FSStat* stat);
89#define vfsvfsStat(self, path, stat) (self)->_->stat(VFSVFS(self), path, stat)
90// bool vfsvfsSetTimes(VFSVFS* self, strref path, int64 modified, int64 accessed);
91#define vfsvfsSetTimes(self, path, modified, accessed) (self)->_->setTimes(VFSVFS(self), path, modified, accessed)
92// bool vfsvfsCreateDir(VFSVFS* self, strref path);
93#define vfsvfsCreateDir(self, path) (self)->_->createDir(VFSVFS(self), path)
94// bool vfsvfsRemoveDir(VFSVFS* self, strref path);
95#define vfsvfsRemoveDir(self, path) (self)->_->removeDir(VFSVFS(self), path)
96// bool vfsvfsDeleteFile(VFSVFS* self, strref path);
97#define vfsvfsDeleteFile(self, path) (self)->_->deleteFile(VFSVFS(self), path)
98// bool vfsvfsRename(VFSVFS* self, strref oldpath, strref newpath);
99#define vfsvfsRename(self, oldpath, newpath) (self)->_->rename(VFSVFS(self), oldpath, newpath)
100// bool vfsvfsGetFSPath(VFSVFS* self, string* out, strref path);
101#define vfsvfsGetFSPath(self, out, path) (self)->_->getFSPath(VFSVFS(self), out, path)
102// bool vfsvfsSearchInit(VFSVFS* self, FSSearchIter* iter, strref path, strref pattern, bool stat);
103#define vfsvfsSearchInit(self, iter, path, pattern, stat) (self)->_->searchInit(VFSVFS(self), iter, path, pattern, stat)
104// bool vfsvfsSearchValid(VFSVFS* self, FSSearchIter* iter);
105#define vfsvfsSearchValid(self, iter) (self)->_->searchValid(VFSVFS(self), iter)
106// bool vfsvfsSearchNext(VFSVFS* self, FSSearchIter* iter);
107#define vfsvfsSearchNext(self, iter) (self)->_->searchNext(VFSVFS(self), iter)
108// void vfsvfsSearchFinish(VFSVFS* self, FSSearchIter* iter);
109#define vfsvfsSearchFinish(self, iter) (self)->_->searchFinish(VFSVFS(self), iter)
110
111CX_C_END
#define saDeclarePtr(name)
Definition sarray.h:100
enum FSPathStatEnum FSPathStat
@ FS_Nonexistent
Path does not exist.
Definition fs.h:94
#define _objfactory_guaranteed
Definition objimpl.h:106
CX Struct System - Introspectable, serializable POD structures in C.
CX Object System - Object-oriented programming in C.
Definition fs.h:103
Definition fileobj.h:59
VFS Object.
Definition vfsobj.h:51
VFS object definitions.