mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <AK/AKString.h>
|
|
#include <AK/Retainable.h>
|
|
#include <AK/Retained.h>
|
|
#include <AK/Types.h>
|
|
#include <Kernel/KResult.h>
|
|
#include <Kernel/LinearAddress.h>
|
|
|
|
class FileDescriptor;
|
|
class Process;
|
|
class Region;
|
|
|
|
class File : public Retainable<File> {
|
|
public:
|
|
virtual ~File();
|
|
|
|
virtual KResultOr<Retained<FileDescriptor>> open(int options);
|
|
virtual void close();
|
|
|
|
virtual bool can_read(FileDescriptor&) const = 0;
|
|
virtual bool can_write(FileDescriptor&) const = 0;
|
|
|
|
virtual ssize_t read(FileDescriptor&, byte*, ssize_t) = 0;
|
|
virtual ssize_t write(FileDescriptor&, const byte*, ssize_t) = 0;
|
|
virtual int ioctl(FileDescriptor&, unsigned request, unsigned arg);
|
|
virtual KResultOr<Region*> mmap(Process&, LinearAddress preferred_laddr, size_t offset, size_t size);
|
|
|
|
virtual String absolute_path(FileDescriptor&) const = 0;
|
|
|
|
virtual const char* class_name() const = 0;
|
|
|
|
virtual bool is_seekable() const { return false; }
|
|
|
|
virtual bool is_shared_memory() const { return false; }
|
|
virtual bool is_fifo() const { return false; }
|
|
virtual bool is_device() const { return false; }
|
|
virtual bool is_tty() const { return false; }
|
|
virtual bool is_master_pty() const { return false; }
|
|
virtual bool is_block_device() const { return false; }
|
|
virtual bool is_character_device() const { return false; }
|
|
virtual bool is_socket() const { return false; }
|
|
|
|
protected:
|
|
File();
|
|
};
|