ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

TODO: vital to document this core class properly!!! For both users and implementors. More...

#include <file.h>

Inheritance diagram for Common::File:
Collaboration diagram for Common::File:

List of all members.

Public Member Functions

 File ()
virtual ~File ()
virtual bool open (const String &filename)
 Try to open the file with the given filename, by searching SearchMan.
virtual bool open (const String &filename, Archive &archive)
 Try to open the file with the given filename from within the given archive.
virtual bool open (const FSNode &node)
 Try to open the file corresponding to the give node.
virtual bool open (SeekableReadStream *stream, const String &name)
 Try to 'open' the given stream.
virtual void close ()
 Close the file, if open.
bool isOpen () const
 Checks if the object opened a file successfully.
const char * getName () const
 Returns the filename of the opened file for debugging purposes.
bool err () const
void clearErr ()
bool eos () const
int32 pos () const
int32 size () const
bool seek (int32 offs, int whence=SEEK_SET)
uint32 read (void *dataPtr, uint32 dataSize)

Static Public Member Functions

static bool exists (const String &filename)
 Checks if a given file exists in any of the current default paths, as defined by SearchMan.

Protected Attributes

SeekableReadStream_handle
 File handle to the actual file; 0 if no file is open.
String _name
 The name of this file, kept for debugging purposes.

Detailed Description

TODO: vital to document this core class properly!!! For both users and implementors.

Definition at line 39 of file file.h.


Constructor & Destructor Documentation

Common::File::File (  ) 

Definition at line 33 of file file.cpp.

Common::File::~File (  )  [virtual]

Definition at line 37 of file file.cpp.


Member Function Documentation

void Common::File::clearErr (  ) 

Definition at line 116 of file file.cpp.

void Common::File::close (  )  [virtual]

Close the file, if open.

Definition at line 102 of file file.cpp.

bool Common::File::eos (  )  const

Definition at line 121 of file file.cpp.

bool Common::File::err (  )  const

Definition at line 111 of file file.cpp.

bool Common::File::exists ( const String filename  )  [static]

Checks if a given file exists in any of the current default paths, as defined by SearchMan.

Parameters:
filename the file to check for
Returns:
true if the file exists, false otherwise

Definition at line 90 of file file.cpp.

const char* Common::File::getName (  )  const [inline]

Returns the filename of the opened file for debugging purposes.

Returns:
: the filename

Definition at line 118 of file file.h.

bool Common::File::isOpen (  )  const

Checks if the object opened a file successfully.

Returns:
: true if any file is opened, false otherwise.

Definition at line 107 of file file.cpp.

bool Common::File::open ( const FSNode node  )  [virtual]

Try to open the file corresponding to the give node.

Will check whether the node actually refers to an existing file (and not a directory), and handle those cases gracefully.

Note:
Must not be called if this file already is open (i.e. if isOpen returns true).
Parameters:
node the node to consider.
Returns:
true if file was opened successfully, false otherwise

Definition at line 62 of file file.cpp.

bool Common::File::open ( const String filename  )  [virtual]

Try to open the file with the given filename, by searching SearchMan.

Note:
Must not be called if this file already is open (i.e. if isOpen returns true).
Parameters:
filename the name of the file to open
Returns:
true if file was opened successfully, false otherwise

Definition at line 41 of file file.cpp.

bool Common::File::open ( SeekableReadStream stream,
const String name 
) [virtual]

Try to 'open' the given stream.

That is, we just wrap around it, and if stream is a NULL pointer, we gracefully treat this as if opening failed.

Note:
Must not be called if this file already is open (i.e. if isOpen returns true).
Parameters:
stream a pointer to a SeekableReadStream, or 0
name a string describing the 'file' corresponding to stream
Returns:
true if stream was non-zero, false otherwise

Definition at line 77 of file file.cpp.

bool Common::File::open ( const String filename,
Archive archive 
) [virtual]

Try to open the file with the given filename from within the given archive.

Note:
Must not be called if this file already is open (i.e. if isOpen returns true).
Parameters:
filename the name of the file to open
archive the archive in which to search for the file
Returns:
true if file was opened successfully, false otherwise

Definition at line 45 of file file.cpp.

int32 Common::File::pos (  )  const

Definition at line 126 of file file.cpp.

uint32 Common::File::read ( void *  dataPtr,
uint32  dataSize 
)

Definition at line 141 of file file.cpp.

bool Common::File::seek ( int32  offs,
int  whence = SEEK_SET 
)

Definition at line 136 of file file.cpp.

int32 Common::File::size (  )  const

Definition at line 131 of file file.cpp.


Member Data Documentation

File handle to the actual file; 0 if no file is open.

Definition at line 42 of file file.h.

The name of this file, kept for debugging purposes.

Definition at line 45 of file file.h.


The documentation for this class was generated from the following files:


Generated on Sat Nov 16 2019 05:02:45 for ResidualVM by doxygen 1.7.1
curved edge   curved edge