| Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
Class for accessing a file on disk. More...
#include <File.h>
Public Member Functions | |
| void | close () |
| bool | eof () |
| returns if file is at the end position | |
| File (const std::string &fileName, u32 fileAccess=FA_READ|FA_WRITE) | |
| void | flush () |
| flush any buffers by writing to the file. | |
| const std::string & | getFileName () |
| returns name of file | |
| u32 | getPos () |
| returns where in the file we are. | |
| bool | opened () |
| returns if file is open | |
| u32 | read (void *buffer, u32 size, u32 count) |
| u32 | read (void *buffer, u32 size) |
| returns how much was read | |
| u32 | read (std::string &str) |
| u32 | readLine (std::string &line) |
| bool | seek (s32 finalPos, bool relativeMovement=false) |
| u32 | size () |
| returns size of file. | |
| u32 | tell () const |
| returns the number of bytes from the beginning of the file. | |
| bool | write (const c8 *str) |
| bool | write (const std::string &str) |
| u32 | write (const void *buffer, u32 size, u32 count) |
| u32 | write (const void *buffer, u32 size) |
| writes an amount of bytes to the file. | |
| bool | writeLine (const std::string &line) |
| Writes a line to the file. | |
| ~File () | |
Private Member Functions | |
| void | openFile () |
| opens the file | |
Private Attributes | |
| u32 | mAccessMode |
| FILE * | mFile |
| std::string | mFileName |
Class for accessing a file on disk.
| platform::File::File | ( | const std::string & | fileName, |
| u32 | fileAccess = FA_READ | FA_WRITE |
||
| ) |
References mAccessMode, mFileName, and openFile().
| platform::File::~File | ( | ) |
References close().
| bool platform::File::eof | ( | ) |
returns if file is at the end position
References mFile.
Referenced by resource::FileDataStream::eof().
| void platform::File::flush | ( | ) |
flush any buffers by writing to the file.
References mFile.
| const std::string & platform::File::getFileName | ( | ) |
returns name of file
References mFileName.
| u32 platform::File::getPos | ( | ) |
| bool platform::File::opened | ( | ) |
| void platform::File::openFile | ( | ) | [private] |
opens the file
References platform::FA_APPEND, platform::FA_CREATE, platform::FA_READ, platform::FA_WRITE, mAccessMode, mFile, and mFileName.
Referenced by File().
| u32 platform::File::read | ( | std::string & | str | ) |
Reads the entire contents of a file into a single string.
| str,: | String to read the file's data into. return Returns how many bytes were read. |
References platform::FA_READ, mAccessMode, mFile, and size().
returns how much was read
References platform::FA_READ, mAccessMode, and mFile.
Referenced by resource::FileDataStream::read().
References platform::FA_READ, mAccessMode, and mFile.
| u32 platform::File::readLine | ( | std::string & | line | ) |
Reads a line from the file.
| line,: | Pointer to buffer where the line will be written to. return Returns how many bytes were read. |
References platform::FA_READ, mAccessMode, mFile, and size().
| bool platform::File::seek | ( | s32 | finalPos, |
| bool | relativeMovement = false |
||
| ) |
changes position in file, returns true if successful. if relativeMovement==true, the pos is changed relative to current pos, otherwise from begin of file.
References mFile.
Referenced by resource::FileDataStream::seek(), and resource::FileDataStream::skip().
| u32 platform::File::size | ( | ) |
returns size of file.
References getPos(), and mFile.
Referenced by resource::FileDataStream::FileDataStream(), read(), and readLine().
| u32 platform::File::tell | ( | ) | const |
returns the number of bytes from the beginning of the file.
References mFile.
Referenced by resource::FileDataStream::tell().
References platform::FA_APPEND, platform::FA_WRITE, mAccessMode, and mFile.
| bool platform::File::write | ( | const c8 * | str | ) |
writes a string to file. returns true on success.
References platform::FA_APPEND, platform::FA_WRITE, mAccessMode, and mFile.
writes an amount of bytes to the file.
References platform::FA_APPEND, platform::FA_WRITE, mAccessMode, and mFile.
Referenced by resource::Serializer::writeData().
| bool platform::File::write | ( | const std::string & | str | ) |
References platform::FA_APPEND, platform::FA_WRITE, mAccessMode, and mFile.
| bool platform::File::writeLine | ( | const std::string & | line | ) |
Writes a line to the file.
References platform::FA_APPEND, platform::FA_WRITE, mAccessMode, and mFile.
Referenced by resource::Serializer::writeString().
u32 platform::File::mAccessMode [private] |
Referenced by File(), openFile(), read(), readLine(), write(), and writeLine().
FILE* platform::File::mFile [private] |
Referenced by close(), eof(), flush(), getPos(), opened(), openFile(), read(), readLine(), seek(), size(), tell(), write(), and writeLine().
std::string platform::File::mFileName [private] |
Referenced by File(), getFileName(), and openFile().
|
The KG Game Engine
Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:08 by
Doxygen
(1.7.4)
|