summaryrefslogtreecommitdiffhomepage
path: root/Public/Developer/System.Core/Headers/File.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'Public/Developer/System.Core/Headers/File.hxx')
-rw-r--r--Public/Developer/System.Core/Headers/File.hxx120
1 files changed, 0 insertions, 120 deletions
diff --git a/Public/Developer/System.Core/Headers/File.hxx b/Public/Developer/System.Core/Headers/File.hxx
deleted file mode 100644
index 3d3abf13..00000000
--- a/Public/Developer/System.Core/Headers/File.hxx
+++ /dev/null
@@ -1,120 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
-------------------------------------------- */
-
-#ifndef __FILE_API__
-#define __FILE_API__
-
-#include <System.Core/Headers/Defines.hxx>
-
-#define kFileOpenInterface 10
-#define kFileAliasInterface 11
-
-namespace System {
-class FileInterface;
-class DirectoryInterface;
-
-typedef IntPtrType FSRef;
-
-enum {
- kErrorNoSuchPath = -44,
- kErrorNotAFile = -45,
- kErrorNotADirectory = -46,
- kErrorDirectory = -47,
- kErrorBrokenSymlink = -48,
-};
-
-/// @brief System file interface
-
-class FileInterface final {
- public:
- explicit FileInterface(const char *path) {
- CA_MUST_PASS(path);
-
- mHandle = kApplicationObject->Invoke(
- kApplicationObject, kProcessCallOpenHandle, kFileOpenInterface, path);
- }
-
- ~FileInterface() {
- CA_MUST_PASS(kApplicationObject);
-
- kApplicationObject->Invoke(kApplicationObject, kProcessCallCloseHandle,
- kFileOpenInterface, mHandle);
- }
-
- public:
- CA_COPY_DEFAULT(FileInterface);
-
- public:
- PtrVoidType ReadFork(const CharacterTypeUTF8* name, UIntPtrType off, SizeType sz) {
- return (PtrVoidType)kApplicationObject->Invoke(kApplicationObject, mHandle,
- 2, name, off, sz);
- }
-
- PtrVoidType ReadFork(const CharacterTypeUTF8* name, SizeType sz) {
- return (PtrVoidType)kApplicationObject->Invoke(kApplicationObject, mHandle,
- name, 3, sz);
- }
-
- void WriteFork(const CharacterTypeUTF8* name, PtrVoidType buf, UIntPtrType off, SizeType sz) {
- kApplicationObject->Invoke(kApplicationObject, mHandle, 4, name, buf, off, sz);
- }
-
- void WriteFork(const CharacterTypeUTF8* name, PtrVoidType buf, SizeType sz) {
- kApplicationObject->Invoke(kApplicationObject, mHandle, 5, name, buf, sz);
- }
-
- void SeekFork(const CharacterTypeUTF8* name) {
- kApplicationObject->Invoke(kApplicationObject, mHandle, 6, name);
- }
-
- void RewindFork() { kApplicationObject->Invoke(kApplicationObject, mHandle, 7); }
-
- public:
- const CharacterTypeUTF8 *MIME() {
- return (const char *)kApplicationObject->Invoke(kApplicationObject, mHandle,
- 8);
- }
-
- void MIME(const CharacterTypeUTF8 *mime) {
- CA_MUST_PASS(mime);
-
- kApplicationObject->Invoke(kApplicationObject, mHandle, 9, mime);
- }
-
- private:
- FSRef mHandle;
-};
-
-typedef FileInterface *FilePtr;
-
-/// @brief file exception
-/// Throws when the file isn't found or invalid.
-class FileException : public SystemException {
- public:
- explicit FileException() = default;
- virtual ~FileException() = default;
-
- public:
- CA_COPY_DEFAULT(FileException);
-
- public:
- const char *Name() override { return "FileException"; }
- const char *Reason() override { return mReason; }
-
- private:
- const char *mReason{"System.Core: FileException: Catastrophic failure!"};
-};
-
-inline IntPtrType FSMakeAlias(const char *from, const char *outputWhere) {
- CA_MUST_PASS(from);
- CA_MUST_PASS(outputWhere);
-
- return kApplicationObject->Invoke(kApplicationObject, kProcessCallOpenHandle,
- kFileAliasInterface, from);
-}
-} // namespace System
-
-#endif // ifndef __FILE_API__