Class: TPathName

Declaration: FileSystemInterface.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

None.

Purpose:

This class provides a mechanism for specifying file system entities via portable paths.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Do not derive from this class.

Concurrency:

Not multithread safe.

Resource Use:

Allocates an array of TStandardText objects internally.

Member Function: TPathName::TPathName

  1. TPathName ()
  2. TPathName (const TPathName & copyMe)
  3. TPathName (const THostSpecificPathName & path, const TPathNameParser & aParser =TPathNameParser :: GetDefaultParser ())
  4. TPathName (const TFileSystemEntity & anEntity)
  5. TPathName (const TDirectory & startHere, const THostSpecificPathName & partialPath, const TPathNameParser & aParser =TPathNameParser :: GetDefaultParser ())
  6. TPathName (const TDirectory & startHere, const TPathName & partialPath)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.
  3. Converts a host-specific path to a TPathName object.
  4. Converts a file system entity to a TPathName object.
  5. Builds a TPathName object from the two supplied components.
  6. Builds a TPathName object by concatenating its two arguments.

Calling Context:

  1. Called by the stream-in operators and to create an uninitialized TPathName object for later assignment.
  2. Called to copy an object.
  3. Called to convert from a host-specific path string to a TPathName object.
  4. Called to find the path for a particular file system entity.
  5. Called to construct a path object from a directory and a partial path string.
  6. Called to construct a path object from a directory and another path object that is a partial

Parameters:

Return Value:

None.

Exceptions:

  1. Throws no exceptions, passes all exceptions through.
  2. Throws no exceptions, passes all exceptions through.
  3. Throws TFileSystemEntityNotAvailable for ill-formed paths (but not for well-formed paths specifying entities that do not exist; that is, the path must be well-formed but need not represent an existing on-disk entity).
  4. Throws TFileSystemEntityNotAvailable if the specified entity is invalid or does not exist on-disk.
  5. Throws TFileSystemEntityNotAvailable for ill-formed paths (but not for well-formed paths specifying entities that do not exist; that is, the path must be well-formed but need not represent an existing on-disk entity).
  6. Throws TFileSystemEntityNotAvailable if the specified TDirectory is invalid or does not exist on-disk.
  7. Throws TFileSystemEntityNotAvailable for ill-formed paths (but not for well-formed paths specifying entities that do not exist; that is, the path must be well-formed but need not represent an existing on-disk entity).
  8. Throws TFileSystemEntityNotAvailable if the specified TDirectory is invalid or does not exist on-disk.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPathName::GetTaligentRoot

static TDirectory GetTaligentRoot ()

Interface Category:

API.

Purpose:

Returns the topmost directory of the CommonPoint installation hierarchy.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The topmost directory of the the CommonPoint installation hierarchy.

Exceptions:

Throws TFileSystemEntityNotAvailable if the TaligentRoot environment variable is not set. (AIX only.) Throws TFileSystemEntityNotAvailable if the directory specified by the TaligentRoot environment variable cannot be found. Throws TFileSystemTypeMismatch if the pathname specified by the TaligentRoot environment variable is not a directory.

Concurrency:

Not multithread safe.

Other Considerations:

This will soon be made obsolete and removed from the interface. Use TMultipleRootLocator instead.

Member Function: TPathName::Hash

long Hash () const

Interface Category:

API.

Purpose:

Returns a hash value that can be used by collection classes.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The long hash value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPathName::GetComponentAt

void GetComponentAt (unsigned long index, TStandardText & fillIn) const

Interface Category:

API.

Purpose:

Extracts the path component at the requested index.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws TFileSystemEntityNotAvailable if the TPathName is uninitialized. Throws TCollectionException if the index is out of range.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPathName::GetNumberOfComponents

unsigned long GetNumberOfComponents () const

Interface Category:

API.

Purpose:

Returns the number of components in the path.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The number of components in the path.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The first component is defined as the volume name on systems that support such notion. On UNIX, the name space does not begin with a volume name, so the first component is empty. For example, /usr/include/sys/mode.h would return a count of 5, including one for the empty volume name.

Member Function: TPathName::Append

void Append (const TPathName & relativePath)

Interface Category:

API.

Purpose:

Appends a relative path to this path. Can be used to build an absolute or longer relative path.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws TFileSystemEntityNotAvailable for ill-formed paths (but not for well-formed paths specifying entities that do not exist; that is, the path must be well-formed but need not represent an existing on-disk entity).

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPathName::FactorCommonRoot

void FactorCommonRoot (const TPathName & anotherPath, TPathName & commonRoot, TPathName & fromRootToLeaf)

Interface Category:

API.

Purpose:

Extracts the common root of this and anotherPath, the initial part of the absolute path that is identical in both paths.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws TFileSystemEntityNotAvailable for uninitialized TPathNames. Throws TFileSystemPathNameError if fromRootToLeaf would be empty.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPathName::GetEntity

TFileSystemEntity GetEntity ()

Interface Category:

API.

Purpose:

Returns the file system entity represented by this path.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The file system entity represented by this path.

Exceptions:

Throws TFileSystemEntityNotAvailable if the entity cannot be found on-disk. Throws TFileSystemInternalError if the entity is not a recognized type (for example, not a file, directory, or volume).

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPathName::operator==

bool operator ==(const TPathName & anotherPath) const

Interface Category:

API.

Purpose:

Determines if this path is identical to another path.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if this and anotherPath are identical.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPathName::operator<<=

TStream & operator <<= (TStream & fromWhere)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPathName::operator>>=

TStream & operator >>=(TStream & toWhere) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPathName::operator=

TPathName & operator =(const TPathName & copyMe)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPathName::Truncate

  1. void Truncate (const TPathName & relativePath)
  2. void Truncate (unsigned long numberOfPathSegmentsToRemove)

Interface Category:

API.

Purpose:

  1. Truncates the path by removing the end string common to this path and another path.
  2. Removes the requested number of path components from the end of this path.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

  1. Throws TFileSystemEntityNotAvailable if this is not initialized.
  2. Throws TFileSystemPathNameError if the specified path has more components than this.
  3. Throws TFileSystemPathNameError if the specified path is not identical to the end of this.
  4. Throws TFileSystemEntityNotAvailable if this is not initialized.
  5. Throws TFileSystemPathNameError if numberOfPathSegmentsToRemove is greater than the number of components in the path.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPathName::~TPathName

virtual ~ TPathName ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.