class File

A stream file class. More...

Full nameTelEngine::File
Definition#include <yateclass.h>
InheritsTelEngine::Stream [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods

Protected Methods

Protected Members


Detailed Description

Class to encapsulate a system dependent file in a system independent abstraction

 File ()

File

Default constructor, creates a closed file

 File (HANDLE handle)

File

Constructor from an existing handle

Parameters:
handleOperating system handle to an open file

 ~File ()

~File

[virtual]

Destructor, closes the file

bool  openPath (const char* name, bool canWrite = false, bool canRead = true, bool create = false, bool append = false, bool binary = false)

openPath

[virtual]

Opens a file from the filesystem pathname

Parameters:
nameName of the file according to the operating system's conventions
canWriteOpen the file for writing
canReadOpen the file for reading
createCreate the file if it doesn't exist
appendSet the write pointer at the end of an existing file
binaryOpen the file in binary mode if applicable

Returns: True if the file was successfully opened

bool  terminate ()

terminate

[virtual]

Closes the file handle

Returns: True if the file was (already) closed, false if an error occured

Reimplemented from Stream.

void  attach (HANDLE handle)

attach

Attach an existing handle to the file, closes any existing first

Parameters:
handleOperating system handle to an open file

HANDLE  detach ()

detach

Detaches the object from the file handle

Returns: The handle previously owned by this object

inline HANDLE  handle ()

handle

[const]

Get the operating system handle to the file

Returns: File handle

bool  canRetry ()

canRetry

[const virtual]

Check if the last error code indicates a retryable condition

Returns: True if error was temporary and operation should be retried

Reimplemented from Stream.

bool  valid ()

valid

[const virtual]

Check if this file is valid

Returns: True if the file is valid, false if it's invalid or closed

Reimplemented from Stream.

HANDLE  invalidHandle ()

invalidHandle

[static]

Get the operating system specific handle value for an invalid file

Returns: Handle value for an invalid file

bool  setBlocking (bool block = true)

setBlocking

[virtual]

Set the blocking or non-blocking operation mode of the file

Parameters:
blockTrue if I/O operations should block, false for non-blocking

Returns: True if operation was successfull, false if an error occured

Reimplemented from Stream.

unsigned int  length ()

length

[virtual]

Find the length of the file if it has one

Returns: Length of the file or zero if length is not defined

int  writeData (const void* buffer, int length)

writeData

[virtual]

Write data to an open file

Parameters:
bufferBuffer for data transfer
lengthLength of the buffer

Returns: Number of bytes transferred, negative if an error occurred

Reimplemented from Stream.

int  readData (void* buffer, int length)

readData

[virtual]

Read data from an open file

Parameters:
bufferBuffer for data transfer
lengthLength of the buffer

Returns: Number of bytes transferred, negative if an error occurred

Reimplemented from Stream.

bool  remove (const char* name)

remove

[static]

Deletes a file entry from the filesystem

Parameters:
nameAbsolute path and name of the file to delete

Returns: True if the file was successfully deleted

bool  createPipe (File& reader, File& writer)

createPipe

[static]

Create a pair of unidirectionally pipe connected streams

Parameters:
readerReference to a File that becomes the reading side of the pipe
writerReference to a File that becomes the writing side of the pipe

Returns: True is the pipe was created successfully

void  copyError ()

copyError

[protected]

Copy the last error code from the operating system

HANDLE m_handle

m_handle

[protected]


Generated by: root on dragoshel on Sat Apr 14 01:50:50 2007, using kdoc 2.0a54.