VizKit  3.3.7
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
VizKit::VisualFile Class Reference

Path information of file or directory and related operations. More...

#include <VisualFile.h>

Inheritance diagram for VizKit::VisualFile:
VizKit::VisualObject

List of all members.

Public Member Functions

 VisualFile ()
 The constructor.
 ~VisualFile ()
 The destructor.
 VisualFile (const VisualFile &other)
 Copy constructor.
VisualFileoperator= (const VisualFile &other)
 Assignment operator.
bool initWithDirectoryOfTemporaryItems (void)
 Initializes the file with the directory of temporary items.
bool initWithUserDesktopDirectory (void)
 Initializes the file with the destop directory of the current user.
bool initWithPreferenceStoreDirectory (void)
 Initializes the file with the directory where the preferences are stored.
virtual VisualFileclone (void) const
 Copies the current VisualFile and returns a pointer to a new VisualFile.
bool appendFileName (VisualString &aFileName)
 Appends a file name to the VisualFile.
bool open (void)
 Opens the file for write access.
bool close (void)
 Closes the file.
bool getData (void **data, size_t &size)
 Returns the data of the file.
bool remove (void)
 Deletes the file.
void getFilePath (VisualString &filePath) const
 Returns the file path as VisualString.
bool getSize (size_t &size) const
 Returns the size of the file in bytes.

Static Public Member Functions

static VisualFilecreateWithDirectoryOfTemporaryItems (void)
 Creates a file with the directory of temporary items.
static VisualFilecreateWithUserDesktopDirectory (void)
 Creates a file with the destop directory of the current user.
static VisualFilecreateWithPreferenceStoreDirectory (void)
 Creates a file with the directory into which the preferences are stored.
static bool writeDataToFile (void **data, size_t size, VisualFile &aFile)
 Writes the passed in data bytes into a file.

Private Member Functions

void copy (const VisualFile &other)
 Copy method for assignment operator and copy constructor.
void clear (void)
 Resets internally used variables and releases allocated memory.
sint8 readData (char *buffer, size_t &numberOfbytes, uint32 startOffset=0)
 Reads data from the file.

Private Attributes

bool isDirectory
 True if VisualFile denotes a directory.
bool knownWhetherFileOrDirectoryExists
 True if it is known whethere a file or directory at the location of the VisualFile exists.
bool doesExistBool
 True if a file or directory at the location of the VisualFile exists.

Detailed Description

Path information of file or directory and related operations.


Constructor & Destructor Documentation

The constructor.

The destructor.

VisualFile::VisualFile ( const VisualFile other)

Copy constructor.

Parameters:
otherReference to another VisualFile.

Member Function Documentation

Appends a file name to the VisualFile.

Parameters:
aFileNameA 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:
otherAnother VisualFile.

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.

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.

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]dataA pointer to a pointer to the data of the file.
[out]sizeThe 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]filePathThe file path as VisualString.
bool VisualFile::getSize ( size_t &  size) const

Returns the size of the file in bytes.

Parameters:
[out]sizeThe size of the file in bytes.
Returns:
True on success, false on failure.

Initializes the file with the directory of temporary items.

Returns:
True on success, false on failure.

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

Returns:
True on success, false on failure.

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:
otherReference to another VisualFile.
sint8 VisualFile::readData ( char *  buffer,
size_t &  numberOfbytes,
uint32  startOffset = 0 
) [private]

Reads data from the file.

Parameters:
[in,out]bufferThe buffer into which the data is to be written.
[in,out]numberOfbytesThe number of bytes requested. The actual number of bytes written on return.
startOffsetThe 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,
size_t  size,
VisualFile aFile 
) [static]

Writes the passed in data bytes into a file.

Parameters:
dataA pointer to a pointer to the data to write into file.
sizeThe number of bytes of the data.
aFileThe 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 May 3 2015 20:26:31 for VizKit by doxygen 1.8.0