diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-26 13:44:38 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-26 13:47:32 +0100 |
| commit | 66e4f909bd1a495d3f1c34d2e1b5cd71099ab1ae (patch) | |
| tree | d64cc867d352d190dfd5693262a42b31e28b9239 /Public/Developer/System.Core/Headers/File.hxx | |
| parent | dbe4573f61ae059c9dafb8e7623370121d443451 (diff) | |
Kernel and System.Core: kernel related fixes and :boom: on User API.
- UserHeap.cxx: Document code and fix issue in ke_free_heap_internal.
- Scheduler: Rename ProcessManager to ProcessScheduler.
- The System API has been reworked to improve it's design, such as no
more C++ to improve it's portability.
- Moved containers into it's own API.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Public/Developer/System.Core/Headers/File.hxx')
| -rw-r--r-- | Public/Developer/System.Core/Headers/File.hxx | 120 |
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__ |
