ObjFW
Public Member Functions | Static Public Member Functions | Protected Attributes
OFFile Class Reference

A class which provides functions to read, write and manipulate files. More...

#include <OFFile.h>

Inheritance diagram for OFFile:
OFSeekableStream OFStream OFObject <OFObject>

List of all members.

Public Member Functions

id initWithPath:mode: (OFString *path,[mode] OFString *mode)
id initWithFileDescriptor: (int fd)

Static Public Member Functions

id fileWithPath:mode: (OFString *path,[mode] OFString *mode)
id fileWithFileDescriptor: (int fd)
OFStringcurrentDirectoryPath ()
BOOL fileExistsAtPath: (OFString *path)
BOOL directoryExistsAtPath: (OFString *path)
void createDirectoryAtPath: (OFString *path)
OFArrayfilesInDirectoryAtPath: (OFString *path)
void changeToDirectory: (OFString *path)
OFDatemodificationDateOfFile: (OFString *path)
void changeModeOfFile:toMode: (OFString *path,[toMode] mode_t mode)
void changeOwnerOfFile:toOwner:group: (OFString *path,[toOwner] OFString *owner,[group] OFString *group)
void copyFileAtPath:toPath: (OFString *from,[toPath] OFString *to)
void renameFileAtPath:toPath: (OFString *from,[toPath] OFString *to)
void deleteFileAtPath: (OFString *path)
void deleteDirectoryAtPath: (OFString *path)
void linkFileAtPath:toPath: (OFString *src,[toPath] OFString *dest)
void symlinkFileAtPath:toPath: (OFString *src,[toPath] OFString *dest)

Protected Attributes

int fd
BOOL closable
BOOL eos

Detailed Description

A class which provides functions to read, write and manipulate files.


Member Function Documentation

void OFFile::changeModeOfFile:toMode: ( OFString path,
[toMode] mode_t  mode 
) [static, virtual]

Changes the mode of a file.

Only changes read-only flag on Windows.

Parameters:
pathThe path to the file of which the mode should be changed as a string
modeThe new mode for the file
void OFFile::changeOwnerOfFile:toOwner:group: ( OFString path,
[toOwner] OFString owner,
[group] OFString group 
) [static, virtual]

Changes the owner of a file.

Not available on Windows.

Parameters:
pathThe path to the file of which the owner should be changed as a string
ownerThe new owner for the file
groupThe new group for the file
void OFFile::changeToDirectory: ( OFString path) [static, virtual]

Changes the current working directory.

Parameters:
pathThe new directory to change to
void OFFile::copyFileAtPath:toPath: ( OFString from,
[toPath] OFString to 
) [static, virtual]

Copies a file.

Parameters:
fromThe file to copy
toThe destination path
void OFFile::createDirectoryAtPath: ( OFString path) [static, virtual]

Creates a directory at the specified path.

Parameters:
pathThe path of the directory
OFString * OFFile::currentDirectoryPath ( ) [static, virtual]
Returns:
The path of the current working directory
void OFFile::deleteDirectoryAtPath: ( OFString path) [static, virtual]

Deletes an empty directory.

Parameters:
pathThe path to the directory which should be deleted as a string
void OFFile::deleteFileAtPath: ( OFString path) [static, virtual]

Deletes a file.

Parameters:
pathThe path to the file of which should be deleted as a string
BOOL OFFile::directoryExistsAtPath: ( OFString path) [static, virtual]
Parameters:
pathThe path to check
Returns:
A boolean whether there is a directory at the specified path
BOOL OFFile::fileExistsAtPath: ( OFString path) [static, virtual]
Parameters:
pathThe path to check
Returns:
A boolean whether there is a file at the specified path
OFArray * OFFile::filesInDirectoryAtPath: ( OFString path) [static, virtual]
Parameters:
pathThe path of the directory
Returns:
An array of OFStrings with the files at the specified path
id OFFile::fileWithFileDescriptor: ( int  fd) [static, virtual]
Parameters:
fdA file descriptor, returned from for example open(). It is not closed when the OFFile object is deallocated!
Returns:
A new autoreleased OFFile
id OFFile::fileWithPath:mode: ( OFString path,
[mode] OFString mode 
) [static, virtual]
Parameters:
pathThe path to the file to open as a string
modeThe mode in which the file should be opened as a string
Returns:
A new autoreleased OFFile
id OFFile::initWithFileDescriptor: ( int  fd) [virtual]

Initializes an already allocated OFFile.

Parameters:
fdA file descriptor, returned from for example open(). It is not closed when the OFFile object is deallocated!
id OFFile::initWithPath:mode: ( OFString path,
[mode] OFString mode 
) [virtual]

Initializes an already allocated OFFile.

Parameters:
pathThe path to the file to open as a string
modeThe mode in which the file should be opened as a string
Returns:
An initialized OFFile
void OFFile::linkFileAtPath:toPath: ( OFString src,
[toPath] OFString dest 
) [static, virtual]

Hardlinks a file.

Not available on Windows.

Parameters:
srcThe path to the file of which should be linked as a string
destThe path to where the file should be linked as a string
OFDate * OFFile::modificationDateOfFile: ( OFString path) [static, virtual]
Returns:
The date of the last modification of the file
void OFFile::renameFileAtPath:toPath: ( OFString from,
[toPath] OFString to 
) [static, virtual]

Renames a file.

Parameters:
fromThe file to rename
toThe new name
void OFFile::symlinkFileAtPath:toPath: ( OFString src,
[toPath] OFString dest 
) [static, virtual]

Symlinks a file.

Not available on Windows.

Parameters:
srcThe path to the file of which should be symlinked as a string
destThe path to where the file should be symlinked as a string

The documentation for this class was generated from the following files:
 All Classes Functions Variables