Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

VizKit::VisualFile Class Reference

#include <VisualFile.h>

Inherits VizKit::VisualObject.

Collaboration diagram for VizKit::VisualFile:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 VisualFile ()
 ~VisualFile ()
 VisualFile (const VisualFile &other)
VisualFileoperator= (const VisualFile &other)
bool initWithDirectoryOfTemporaryItems (void)
bool initWithUserDesktopDirectory (void)
bool initWithPreferenceStoreDirectory (void)
virtual VisualFileclone (void) const
bool appendFileName (VisualString &aFileName)
bool open (void)
bool close (void)
bool getData (void **data, size_t &size)
bool remove (void)
void getFilePath (VisualString &filePath) const
bool getSize (size_t &size) const

Static Public Member Functions

static VisualFilecreateWithDirectoryOfTemporaryItems (void)
static VisualFilecreateWithUserDesktopDirectory (void)
static VisualFilecreateWithPreferenceStoreDirectory (void)
static bool writeDataToFile (void **data, uint32 size, VisualFile &aFile)

Private Member Functions

void copy (const VisualFile &other)
void clear (void)
sint8 readData (char *buffer, uint32 &numberOfbytes, uint32 startOffset=0)

Private Attributes

bool isDirectory
bool knownWhetherFileOrDirectoryExists
bool doesExistBool

Detailed Description

Path information of file or directory and related operations.


Constructor & Destructor Documentation

VisualFile::VisualFile (  ) 

The constructor.

VisualFile::~VisualFile (  ) 

The destructor.

VisualFile::VisualFile ( const VisualFile other  ) 

Copy constructor.

Parameters:
other Reference to another VisualFile.

Member Function Documentation

bool VisualFile::appendFileName ( VisualString aFileName  ) 

Appends a file name to the VisualFile.

Parameters:
aFileName A file name.
Returns:
True on success, false on failure.
void VisualFile::clear ( void   )  [private]

Resets internally used variables and releases allocated memory.

VisualFile * VisualFile::clone ( void   )  const [virtual]

Copies the current VisualFile and returns a pointer to a new VisualFile.

Implements VizKit::VisualObject.

bool VisualFile::close ( void   ) 

Closes the file.

Returns:
True on success, false on failure.
Remarks:
The file must have been opened first.
void VisualFile::copy ( const VisualFile other  )  [private]

Copy method for assignment operator and copy constructor.

Parameters:
other Another VisualImage.
VisualFile * VisualFile::createWithDirectoryOfTemporaryItems ( void   )  [static]

Creates a file with the directory of temporary items.

Returns:
Created instance of VisualFile.
Remarks:
The caller has to release the allocated memory by calling delete() on the returned VisualFile pointer.
VisualFile * VisualFile::createWithPreferenceStoreDirectory ( void   )  [static]

Creates a file with the directory into which the preferences are stored.

Returns:
Created instance of VisualFile.
Remarks:
The caller has to release the allocated memory by calling delete() on the returned VisualFile pointer.
VisualFile * VisualFile::createWithUserDesktopDirectory ( void   )  [static]

Creates a file with the destop directory of the current user.

Returns:
Created instance of VisualFile.
Remarks:
The caller has to release the allocated memory by calling delete() on the returned VisualFile pointer.
bool VisualFile::getData ( void **  data,
size_t &  size 
)

Returns the data of the file.

Parameters:
[out] data A pointer to a pointer to the data of the file.
[out] size The size of the read data in bytes.
Returns:
True on success, false on failure.
Remarks:
The memory has to be deallocated on the caller's side by calling free() on the returned buffer.
void VisualFile::getFilePath ( VisualString filePath  )  const

Returns the file path as VisualString.

Parameters:
[out] filePath The file path as VisualString.
bool VisualFile::getSize ( size_t &  size  )  const

Returns the size of the file in bytes.

Parameters:
[out] size The size of the file in bytes.
Returns:
True on success, false on failure.
bool VisualFile::initWithDirectoryOfTemporaryItems ( void   ) 

Initializes the file with the directory of temporary items.

Returns:
True on success, false on failure.
bool VisualFile::initWithPreferenceStoreDirectory ( void   ) 

Initializes the file with the directory where the preferences are stored.

Returns:
True on success, false on failure.
bool VisualFile::initWithUserDesktopDirectory ( void   ) 

Initializes the file with the destop directory of the current user.

Returns:
True on success, false on failure.
bool VisualFile::open ( void   ) 

Opens the file for write access.

Returns:
True on success, false on failure.
VisualFile & VisualFile::operator= ( const VisualFile other  ) 

Assignment operator.

Parameters:
other Reference to another VisualFile.
sint8 VisualFile::readData ( char *  buffer,
uint32 numberOfbytes,
uint32  startOffset = 0 
) [private]

Reads data from the file.

Parameters:
[in,out] buffer The buffer into which the data is to be written.
[in,out] numberOfbytes The number of bytes requested. The actual number of bytes written on return.
startOffset The offset from where reading is supposed to begin.
Returns:
1 if still data available, 0 on error, -1 on eof.
Remarks:
The buffer memory has to be allocated on the caller's side.
bool VisualFile::remove ( void   ) 

Deletes the file.

Returns:
True on success, false on failure.
Remarks:
Named remove instead of delete only because delete is a keyword for c++.
bool VisualFile::writeDataToFile ( void **  data,
uint32  size,
VisualFile aFile 
) [static]

Writes the passed in data bytes into a file.

Parameters:
data A pointer to a pointer to the data to write into file.
size The number of bytes of the data.
aFile The file into which to write the data.
Returns:
True on success, false on failure.

Member Data Documentation

True if a file or directory at the location of the VisualFile exists. False if not.

True if VisualFile denotes a directory. False if VisualFile denotes a file.

True if it is known whethere a file or directory at the location of the VisualFile exists. False if not known.


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

Generated on Sun Sep 26 2010 13:29:36 for VizKit by doxygen 1.7.1