IFileSystemEntity

This is the base class for all physical file system entities and objects.

Do not derive your own classes from this class.


IFileSystemEntity - Member Functions and Data by Group

Constructors & Destructor

Use the functions in this group to construct and destroy objects of class IFileSystemEntity.


[view class]
~IFileSystemEntity
public:
virtual ~IFileSystemEntity()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IFileSystemEntity
Constucts a file system entity.


Overload 1
Constucts an entity from a host-specific path name to a file system object.
public:
IFileSystemEntity( const IHostPathName& hostPath, const ICompoundNameParser& = defaultParser ( ) )
Use this constructor to create a file system entity from a host-specific path name to a file system object.

parser
The path name parser which should be used to format the returned host-specific path. If no parser is specified, the default for the current system is used.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
Constucts an entity from a portable path name to a file system object.
public:
IFileSystemEntity(const IPathName& path)
Use this constructor to create an entity from a portable path name to a file system object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
Copy constructor.
public:
IFileSystemEntity(const IFileSystemEntity& copy)
Use this constructor to create a file system entity that is copied from the given one.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 4
Constructs a file system entity from the given file system record.
public:
IFileSystemEntity(IFSRecord* Record)
Use this constructor to create a file system entity from a file system record.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 5
Default constructor.
public:
IFileSystemEntity()
Use the default constructor to create an empty file system entity object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator =
public:
virtual IFileSystemEntity& operator =( const IFileSystemEntity& right )
Use this assignment operator to assign the given file system entity.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Accessing File System Properties and Entities

Use the functions in this group to access file system entities and obtain information about them. For example, you can obtain this information: the file system entity name, a portable path name for the entity, the time when the entity was last modified, the host path name, whether the entity is temporary, and the file system record for the entity. You can also set set the current file system entity to the given one.


[view class]
getRecord
public:
IFSRecord* getRecord() const
Returns the file system record.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
hostPath
public:
IHostPathName hostPath( const ICompoundNameParser& parser = defaultParser ( ) ) const
Obtains a host path name, using the specified parser.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
modificationTime
public:
ITimeStamp modificationTime() const
Returns the time of the most recent modification to the on-disk entity.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

Windows Considerations
On Windows 95, this method for IVolume is not supported and it throws an IAccessError exception.

[view class]
name
public:
IFileName name() const
Returns the name of this file system entity.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
path
public:
IPathName path() const
Returns a portable path name for this entity.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setName
Changes the name of this file system entity.
public:
void setName(const IFileName& newName) const
Sets the name of the current file system entity to the given one.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
temporary
public:
bool temporary() const
Checks whether this entity is temporary.

This does not check to see whether the entity resides in any particular system temporary directory; it simply returns true if the entity was created with IFile::createTemporary or IVolume::createTemporary.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Checking the Type of a File System Entity

Use the functions in this group to verify the file system entity type.


[view class]
isA
public:
bool isA(const IFileKind& kind) const
Checks whether this entity is of the specified type.

kind
The type of entity to check for.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
typeSafeAssign
protected:
void typeSafeAssign( const IFileSystemEntity& right, const IFileKind& kind )

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Class Constants

Constants that are nested within the IFileSystemEntity class.


[view class]
defaultParser
Returns the default path name parser for this operating system.
public:
static const ICompoundNameParser& defaultParser()
Return the default path name parser for this operating system. This member function is a syntactic convenience; it always returns the same parser as IPathName::defaultParser.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
uniqueName
public:
static const IFileName& uniqueName()
Returns a unique name to be used for a file system entity.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Manipulating File System Entities

Use the functions in this group to move, copy, and delete file system entities.


[view class]
copyTo
public:
IFileSystemEntity copyTo( IDirectory& destination, const IFileName& newName = "", EFailureAction action = kStop ) const
Copies the entity to a different parent directory. If the entity is a directory or volume, all of its children are copied too.

destination
The directory to which this entity should be copied.
newName
An optional new name for the new copy of the entity. If no new name is provided, the current name is used.
action
What to do if an error occurs during the copy.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
deleteSelf
public:
void deleteSelf(bool deleteChildren = false)
Deletes this entity and, optionally, its children.

deleteChildren
If this parameter is true and the entity is a directory, all entities within the directory is deleted too. If the entity is a non-empty directory and this parameter is false, IMustBeEmpty is thrown.

Exception

IMustBeEmpty Attempted to delete a non-empty directory without specifying deleteChildren = true.
IEntityInUse Attempted to delete an entity that is open or otherwise in use.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
getRecord
public:
IFSRecord* getRecord() const
Returns the file system record.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
moveTo
public:
void moveTo( IDirectory& destination, const IFileName& newName = "", EFailureAction action = kStop )
Moves the entity to a different parent directory.

destination
The directory to which this entity should be moved.
newName
An optional new name for this entity after it is moved. If no new name is provided, the current name is used.
action
What to do if an error occurs during the move.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Navigating the File System Directory

Use the functions in this group to navigate the directory hierarchy.


[view class]
parent
public:
IDirectory parent() const
Returns the directory in which this entity resides. If the entity has no parent, that is, it is a root directory, an invalid entity is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
topmostParent
public:
IDirectory topmostParent() const
Returns the root of the directory tree in which this entity resides. If the entity has no parent, e.g. it is a root directory, an invalid entity is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
volume
public:
IVolume volume() const
Returns the volume on which this entity resides.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Streaming Objects In and Out

Use the functions in this group to stream file system entities in or out using the given stream.


[view class]
readFromStream
Streams the file system entity object in from the given OpenClass polymorphic stream.
public:
virtual void readFromStream(IDataStream& fromwhere)
Reads this entity object from an OpenClass stream.

Generally you should use the global operator<<=, which will in turn call this method, rather than using this method directly.

fromWhere
The stream to use to stream in the object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
writeToStream
Streams the file system entity object out to the given OpenClass polymorphic stream
public:
virtual void writeToStream(IDataStream& towhere) const
Writes this entity object to an OpenClass stream.

Generally you should use the global operator>>=, which will in turn call this method, rather than using this method directly.

toWhere
The stream to use to stream out the object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Testing and Comparing File System Entity Objects

Use the functions and operators in this group to test and compare file system entities. For example, you can test two objects for equality, whether two entities point to the same physical object, and whether the current file system entity represents a physical, on-disk entity.


[view class]
connected
public:
bool connected() const
Test whether this object represents a physical, on-disk entity.

This member function goes to the disk to verify that the object points to a valid physical object on the file system.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator !=
Inequality operator.
public:
bool operator !=(const IFileSystemEntity& object) const
Tests the current file system entity and the given one for equality using the inequality operator.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator ==
Equality operator.
public:
bool operator ==(const IFileSystemEntity& object) const

Tests whether two entities point to the same physical object on the file system, even if they were constructed from different path names.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
valid
public:
bool valid() const
Tests whether this object represents an entity.

Valid returns false for entity objects that were created with the default constructor and for objects that have been deleted with deleteSelf.

This member function does NOT check to see whether the entity points to a valid physical object on the disk. To do so, use connected instead.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setInvalid
protected:
void setInvalid()
Renders this file system entity invalid.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IFileSystemEntity - Enumerations


[view class]
ECreateFlags
enum ECreateFlags { kMustExist, 
                    kCreateIfNeeded, 
                    kCreateOnly, 
                    kReplaceExisting }
Specifies whether constructors create entities when needed.

kMustExist Throw IObjectNotFound if the entity does not already exist. kCreateIfNeeded Create the disk entity if it does not already exist. kCreateOnly Always create; throw IAlreadyExists if it already exists. kReplaceExisting If the entity already exists, delete it and create a new one.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
EFailureAction
enum EFailureAction { kContinue, 
                      kStop }
Specifies the behavior of a move or copy operation when an error occurs.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IFileSystemEntity - Inherited Member Functions and Data

Inherited Public Functions

IMStreamable

Inherited Public Data

Inherited Protected Functions

IMStreamable

Inherited Protected Data