#include <BaseFile.h>
Inheritance diagram for clawsoft::BaseFile:
This class does not implement buffering
Public Types | |
enum | chmodBits { SET_UID = 04000, SET_GID = 02000, STICKY = 01000, OWNER_READ = 00400, OWNER_WRITE = 00200, OWNER_EXEC = 00100, GROUP_READ = 00040, GROUP_WRITE = 00020, GROUP_EXEC = 00010, OTHER_READ = 00004, OTHER_WRITE = 00002, OTHER_EXEC = 00001 } |
To set permissions on a file please use an ORed combination of the following data. More... | |
enum | OffsetStartingPoint { FROM_THE_BEGINING, FROM_CURRENT_POSITION, FROM_THE_END } |
Use this enum when u want to call the setOffset method. More... | |
enum | FileOpenMode { READ_ONLY, WRITE_ONLY, READ_WRITE, APPEND } |
Use this enum to identify the type of the file to be open. More... | |
Public Methods | |
BaseFile () | |
Default constructor initializes the filename to /dev/null. | |
BaseFile (const char *fname) | |
This will initialize the filename to the specified by fname. | |
virtual void | open (FileOpenMode mode) |
This method will open a file with the given openmode. | |
virtual void | open (const char *fname, FileOpenMode mode) |
This method will open a file with the given openmode and will set the filename to fname. | |
virtual void | open (const String &fname, FileOpenMode mode) |
This method will open a file with the given openmode and will set the filename to fname. | |
virtual Uint32 | getOffset () |
This method will give you the offset for the file pointer, is very usefull when you are dealing with random files. | |
virtual Uint32 | setOffset (Uint32 off, OffsetStartingPoint from=BaseFile::FROM_THE_BEGINING) |
This method will set the offset for the file pointer, is very usefull when you are dealing with random files. | |
virtual void | close () |
Calling this will close the currently opened file. | |
virtual void | flush () |
This will write all content in the file buffers to the destination file. | |
Uint32 | getSize () |
Obtain the size of the current file it doesn't matter if the file is already opened or not. | |
int | chmod (int perms) |
Change the reading permission per file as in the chmod system call. | |
virtual Uint32 | write (const void *buffer, Uint32 size) |
Sends the data buffer specified by buffer to the current file which has size bytes. | |
virtual Uint32 | write (const char *buffer) |
Sends the data buffer specified by buffer to the current file. | |
virtual Uint32 | read (void *buffer, Uint32 size) |
Retrieves size bytes from the data buffer specified by buffer from the current file. | |
bool | isOpen () |
Will tell you if the file is currently open. | |
const char * | getClassName () |
Returns the name of the current class. | |
Static Public Methods | |
int | installedCPUs () |
This will return how many CPUs are installed in the system. | |
double | cpuSpeed () |
This will return the CPU speed in megahertz. | |
int | totalMemory () |
Will return the total amount of system memory. | |
int | freeMemory () |
Will return the total amount of free system memory. | |
void | usleep (Uint32 usec) |
Will freeze the software for usec microseconds. | |
Protected Methods | |
void | setClassName (const char *n) |
Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging. | |
Protected Attributes | |
int | handler |
Base file handler, this is just a reference pointer to the opened file in the OS. | |
String | filename |
This will store the associated filename. | |
int | filemode |
This variable stores the current file opening mode. | |
bool | _opened |
This flag will say if the file is currently opened or not. |
|
To set permissions on a file please use an ORed combination of the following data.
|
|
Use this enum to identify the type of the file to be open.
|
|
Use this enum when u want to call the setOffset method.
|
|
Default constructor initializes the filename to /dev/null.
|
|
This will initialize the filename to the specified by fname.
|
|
Change the reading permission per file as in the chmod system call.
|
|
Calling this will close the currently opened file.
|
|
This will return the CPU speed in megahertz.
|
|
This will write all content in the file buffers to the destination file.
|
|
Will return the total amount of free system memory.
|
|
Returns the name of the current class.
|
|
This method will give you the offset for the file pointer, is very usefull when you are dealing with random files.
|
|
Obtain the size of the current file it doesn't matter if the file is already opened or not.
|
|
This will return how many CPUs are installed in the system.
|
|
Will tell you if the file is currently open.
|
|
This method will open a file with the given openmode and will set the filename to fname.
|
|
This method will open a file with the given openmode and will set the filename to fname.
|
|
This method will open a file with the given openmode.
|
|
Retrieves size bytes from the data buffer specified by buffer from the current file.
|
|
Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.
|
|
This method will set the offset for the file pointer, is very usefull when you are dealing with random files.
|
|
Will return the total amount of system memory.
|
|
Will freeze the software for usec microseconds.
|
|
Sends the data buffer specified by buffer to the current file.
|
|
Sends the data buffer specified by buffer to the current file which has size bytes.
|
|
This flag will say if the file is currently opened or not.
|
|
This variable stores the current file opening mode.
|
|
This will store the associated filename.
|
|
Base file handler, this is just a reference pointer to the opened file in the OS.
|
Authors:
Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara
Powered by: