|
Melon
A C++ library designed for RadishOS.
|
Representation of a file stream. More...
#include <File.hpp>
Public Member Functions | |
| File (const String::String &path, const String::String &modes) | |
| Open constructor. | |
| File (FILE *stream) | |
| Constructs the object from an existing stream. | |
| ~File () | |
| Destructor. | |
| void | close (this File &self) |
| Close the file if it is open. | |
| Memory::Buffer< char > | readBytes (this File &self, Typing::USize bytes) |
| Read bytes from the file. | |
| Memory::Buffer< char > | read (this File &self) |
| Read until EOF. | |
| String::String | readLine (this File &self, Typing::USize lineno) |
| Read a line from the file. | |
| int | descriptor (this const File &self) |
| Gets the file descriptor of this stream. | |
| void | seek (this File &self, long offset, SeekOrigin origin) |
| Seek to a certain position in the file. | |
| void | write (this File &self, const Memory::Buffer< char > &buf, Typing::USize bytes) |
| Write bytes to a file. | |
| bool | isOpen (this const File &self) |
| Checks if the file is open. | |
Representation of a file stream.
| Melon::FileSystem::File::File | ( | const String::String & | path, |
| const String::String & | modes ) |
Open constructor.
| path | path to the file |
| modes | open modes |
| Melon::FileSystem::File::File | ( | FILE * | stream | ) |
Constructs the object from an existing stream.
| stream | base stream |
| int Melon::FileSystem::File::descriptor | ( | this const File & | self | ) |
Gets the file descriptor of this stream.
| bool Melon::FileSystem::File::isOpen | ( | this const File & | self | ) |
Checks if the file is open.
If the stream is not null, then it is considered as open.
| Memory::Buffer< char > Melon::FileSystem::File::read | ( | this File & | self | ) |
Read until EOF.
| Memory::Buffer< char > Melon::FileSystem::File::readBytes | ( | this File & | self, |
| Typing::USize | bytes ) |
Read bytes from the file.
| bytes | bytes count |
| String::String Melon::FileSystem::File::readLine | ( | this File & | self, |
| Typing::USize | lineno ) |
Read a line from the file.
The \n is not preserved.
| lineno | 0-based line number |
| void Melon::FileSystem::File::seek | ( | this File & | self, |
| long | offset, | ||
| SeekOrigin | origin ) |
Seek to a certain position in the file.
| offset | offset from origin |
| origin | seek from here |
| void Melon::FileSystem::File::write | ( | this File & | self, |
| const Memory::Buffer< char > & | buf, | ||
| Typing::USize | bytes ) |
Write bytes to a file.
| buf | bytes to write |
| bytes | byte count |