UnixFile Class Reference

[File-Date-StringUtils Index] [File-Date-StringUtils Hierarchy] [Headers]


Represents files/directories on Unix filesystems More...

#include <UnixFile.hpp>

Inherits: File

Public Members

Protected Members


Detailed Description

This class' instances represent files that appear on an Unix filesystem, including all types like regular files, directories, symbolic links and other 'special' files. The file represented may or may not exist on the filesystem.

Instances are created by giving the file's access path. A special mode may be used: "AS_IS" for stating (symbolic) links as they are (default) or "DEREF" for automatically 'dereferencing' a symbolic link. The file's existence and properties may be queried.

Most proporties are defined only on existing files. Only the following properties may be queried in any case: File name, path, existance. The actual meaning of some properties may depend on the operating system and/or the actual file type.

(Almost) all properties are cached by the respective instance. The properties are read initially on creation and are updated on calls to sync().


enum State ( NOT_EXISTING, ACCESS_DENIED, NORMAL)

enumeration type for the internal state's values

virtual bool isNavigable() const

Queries if the file behaves as a containerfor other files. Primarily this is true for direcories. On Unix filesystems, this function also returns true if file is a symbolic

bool isSubNavigable() const

true if the file is 'navigable' and something like

virtual bool exists() const

Queries the file's existence.

Returns:
true if file exists (and information about it true if file exists (and information about it

virtual bool equals( UnixFile& f) const

check for 'file equality' (same name and path)

bool isExecutable() const

Returns if a regular file is an executable (applies on

virtual string getName() const

Returns the file's name (without path)

virtual string getParent() const

Returns the file's access path (without its own name).The result is generally a pathname of the directory the file is contained in. Precisely, the result is access path part of the path specificaton the object was created from, and if that was given as a relative path the result is also a relative path.

If the file has no path specification (the file is contained in the current direcory), '.' is returned. The parent of the root directory is '/' (by definition).

virtual string getFullName() const

Returns the file's complete path with name

virtual string getNameExtension() const

Returns the file name extension or an empty string if the file has none

string getLinkName() const

Returns the link name for symbolic links, as it is stored on the filesystem.

mode_t getMode() const

Returns the file's mode (as an integer value)

string getOwner( bool = false) const

Return the user name (login). An empty string indicates thatthere is no name corresponding to the user ID.

UnixFile* linkedFile

Points to an object representing the linked-to file, ifif the instance represents a symbolic link, NULL otherwise.

Important! That object still has the name and path from the the instance, because it was created with UnixFile(...,DEREF)


  • Author: Michael Weers
  • Version: 0.7.2 1999-01-22
  • Documentation generated by mw@nemea on Mit Nov 24 00:09:19 CET 1999
Kdoc