CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
vfsfs.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
9CX_C_BEGIN
10
11typedef struct VFSFS VFSFS;
12typedef struct VFSFS_WeakRef VFSFS_WeakRef;
13saDeclarePtr(VFSFS);
14saDeclarePtr(VFSFS_WeakRef);
15#define _sti_VFSFS _sti_object
16#define SType_VFSFS VFSFS*
17#define STStorageType_VFSFS VFSFS*
18#define STypeArg_VFSFS(type, val) stgeneric(object, (ObjInst*)objInstCheckClass(VFSFS, val))
19#define STypeArgPtr_VFSFS(type, val) (stgeneric*)objInstCheckClassPtr(VFSFS, val)
20#define STypeCheckedArg_VFSFS(type, val) stType(type), stArg(type, val)
21#define STypeCheckedPtrArg_VFSFS(type, val) stType(type), stArgPtr(type, val)
22
23typedef struct VFSFS_ClassIf {
24 ObjIface* _implements;
25 ObjIface* _parent;
26 size_t _size;
27
28 // VFSProviderFlags enforced for this provider
29 flags_t (*flags)(_In_ void* self);
30 // caller takes ownership of the returned file
31 _Ret_opt_valid_ File* (*open)(_In_ void* self, _In_opt_ strref path, flags_t flags);
32 FSPathStat (*stat)(_In_ void* self, _In_opt_ strref path, _When_(return != FS_Nonexistent, _Out_opt_) FSStat* stat);
33 bool (*setTimes)(_In_ void* self, _In_opt_ strref path, int64 modified, int64 accessed);
34 bool (*createDir)(_In_ void* self, _In_opt_ strref path);
35 bool (*removeDir)(_In_ void* self, _In_opt_ strref path);
36 bool (*deleteFile)(_In_ void* self, _In_opt_ strref path);
37 bool (*rename)(_In_ void* self, _In_opt_ strref oldpath, _In_opt_ strref newpath);
38 bool (*getFSPath)(_In_ void* self, _Inout_ string* out, _In_opt_ strref path);
39 bool (*searchInit)(_In_ void* self, _Out_ FSSearchIter* iter, _In_opt_ strref path, _In_opt_ strref pattern, bool stat);
40 bool (*searchValid)(_In_ void* self, _In_ FSSearchIter* iter);
41 bool (*searchNext)(_In_ void* self, _Inout_ FSSearchIter* iter);
42 void (*searchFinish)(_In_ void* self, _Inout_ FSSearchIter* iter);
43} VFSFS_ClassIf;
44extern VFSFS_ClassIf VFSFS_ClassIf_tmpl;
45
46typedef struct VFSFS {
47 union {
48 VFSFS_ClassIf* _;
49 void* _is_VFSFS;
50 void* _is_ObjInst;
51 };
52 ObjClassInfo* _clsinfo;
53 atomic(uintptr) _ref;
54 atomic(ptr) _weakref;
55
56 string root;
57} VFSFS;
58extern ObjClassInfo VFSFS_clsinfo;
59#define VFSFS(inst) objInstCheckClass(VFSFS, inst)
60#define VFSFSNone ((VFSFS*)NULL)
61
62typedef struct VFSFS_WeakRef {
63 union {
64 ObjInst* _inst;
65 void* _is_VFSFS_WeakRef;
66 void* _is_ObjInst_WeakRef;
67 };
68 atomic(uintptr) _ref;
69 RWLock _lock;
70} VFSFS_WeakRef;
71#define VFSFS_WeakRef(inst) objWeakRefCheckClass(VFSFS, inst)
72
73_objfactory_check VFSFS* VFSFS_create(_In_opt_ strref rootpath);
74// VFSFS* vfsfsCreate(strref rootpath);
75#define vfsfsCreate(rootpath) VFSFS_create(rootpath)
76
77// flags_t vfsfsFlags(VFSFS* self);
78//
79// VFSProviderFlags enforced for this provider
80#define vfsfsFlags(self) (self)->_->flags(VFSFS(self))
81// File* vfsfsOpen(VFSFS* self, strref path, flags_t flags);
82//
83// caller takes ownership of the returned file
84#define vfsfsOpen(self, path, flags) (self)->_->open(VFSFS(self), path, flags)
85// FSPathStat vfsfsStat(VFSFS* self, strref path, FSStat* stat);
86#define vfsfsStat(self, path, stat) (self)->_->stat(VFSFS(self), path, stat)
87// bool vfsfsSetTimes(VFSFS* self, strref path, int64 modified, int64 accessed);
88#define vfsfsSetTimes(self, path, modified, accessed) (self)->_->setTimes(VFSFS(self), path, modified, accessed)
89// bool vfsfsCreateDir(VFSFS* self, strref path);
90#define vfsfsCreateDir(self, path) (self)->_->createDir(VFSFS(self), path)
91// bool vfsfsRemoveDir(VFSFS* self, strref path);
92#define vfsfsRemoveDir(self, path) (self)->_->removeDir(VFSFS(self), path)
93// bool vfsfsDeleteFile(VFSFS* self, strref path);
94#define vfsfsDeleteFile(self, path) (self)->_->deleteFile(VFSFS(self), path)
95// bool vfsfsRename(VFSFS* self, strref oldpath, strref newpath);
96#define vfsfsRename(self, oldpath, newpath) (self)->_->rename(VFSFS(self), oldpath, newpath)
97// bool vfsfsGetFSPath(VFSFS* self, string* out, strref path);
98#define vfsfsGetFSPath(self, out, path) (self)->_->getFSPath(VFSFS(self), out, path)
99// bool vfsfsSearchInit(VFSFS* self, FSSearchIter* iter, strref path, strref pattern, bool stat);
100#define vfsfsSearchInit(self, iter, path, pattern, stat) (self)->_->searchInit(VFSFS(self), iter, path, pattern, stat)
101// bool vfsfsSearchValid(VFSFS* self, FSSearchIter* iter);
102#define vfsfsSearchValid(self, iter) (self)->_->searchValid(VFSFS(self), iter)
103// bool vfsfsSearchNext(VFSFS* self, FSSearchIter* iter);
104#define vfsfsSearchNext(self, iter) (self)->_->searchNext(VFSFS(self), iter)
105// void vfsfsSearchFinish(VFSFS* self, FSSearchIter* iter);
106#define vfsfsSearchFinish(self, iter) (self)->_->searchFinish(VFSFS(self), iter)
107
108CX_C_END
#define saDeclarePtr(name)
Definition sarray.h:100
enum FSPathStatEnum FSPathStat
@ FS_Nonexistent
Path does not exist.
Definition fs.h:94
#define _objfactory_check
Definition objimpl.h:112
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