Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Types | Public Member Functions | Static Public Member Functions
IlPathName Class Reference

Class that manages path names in a portable way. More...

#include <ilog/pathname.h>

Public Types

enum  IlPathType { SystemPathType , UnixPathType , DosPathType }
 The different types of path names. More...
 
enum  SortMode {
  SortNone, SortAlphabetically, SortCaseInsensitive, SortReverse,
  GroupDirectories, GroupExtensions
}
 Path names sorting options. More...
 

Public Member Functions

 IlPathName ()
 Initializes an empty IlPathname object. More...
 
 IlPathName (const char *path)
 Initializes an IlPathname object from a C-style string. More...
 
 IlPathName (const IlPathName &path)
 Copy constructor. More...
 
 IlPathName (const IlString &path)
 Initializes an IlPathname object from an IlString. More...
 
void addDirectory (const IlString &directory, int end=-1, IlPathType type=SystemPathType, int start=0)
 Appends a directory to this IlPathName. More...
 
void addDosDirectory (const IlString &directory, int end=-1, int start=0)
 Appends a directory to this IlPathName. More...
 
void addUnixDirectory (const IlString &directory, int end=-1, int start=0)
 Appends a directory to this IlPathName. More...
 
IlBoolean changeCurrentDirectory () const
 Changes the current directory to this path name. More...
 
IlBoolean changeMode (short newMode) const
 Changes permissions of the object referenced by this IlPathName. More...
 
IlBoolean closeDir () const
 Closes this IlPathName. More...
 
IlPathNamecomputeAllButLastSubDirectory ()
 Replaces this IlPathName by its directory part, except the last level. More...
 
IlPathNamecomputeDifferLeading (const IlPathName &path)
 
IlPathNamecomputeDifferTrailing (const IlPathName &path)
 
IlPathNamecomputeFirstSubDirectory ()
 Query the top-most directory of this IlPathName. More...
 
IlPathNamecomputeLastSubDirectory ()
 Query the bottom-most directory of this IlPathName. More...
 
int computeLevelNumber () const
 Computes the number of levels of the current path. More...
 
IlPathNamecomputeRelativePath (const IlPathName &path)
 Computes the relative path of the current path name, relative to another IlPathName. More...
 
IlPathNamecomputeSameLeading (const IlPathName &path)
 
IlPathNamecomputeSameTrailing (const IlPathName &path)
 
char * copy83DosValue () const
 Returns a copy of the content of this IlPathname, truncated to 8.3 names, in the DOS syntax. More...
 
char * copyBaseName () const
 Returns a copy of the file name and the extension parts of this IlPathname. More...
 
char * copyDevice () const
 Returns a copy of the device part of this IlPathname. More...
 
char * copyDirectory (IlBoolean finalSep=IlTrue, IlPathType type=SystemPathType) const
 Returns a copy of the directory part of this IlPathname. More...
 
char * copyDirName (IlBoolean finalSep=IlTrue, IlPathType type=SystemPathType) const
 Returns a copy of the device and directory parts of this IlPathname. More...
 
char * copyDosDirectory (IlBoolean finalSep=IlTrue) const
 Returns a copy of the directory part of this IlPathname in the DOS syntax. More...
 
char * copyDosValue () const
 Returns a copy of the content of this IlPathname in the DOS syntax. More...
 
char * copyExtension () const
 Returns a copy of the extension part of this IlPathname. More...
 
char * copyFileName () const
 Returns a copy of the file name part of this IlPathname. More...
 
char * copyUnixDirectory (IlBoolean finalSep=IlTrue) const
 Returns a copy of the directory part of this IlPathname in the Unix syntax. More...
 
char * copyUnixValue () const
 Returns a copy of the content of this IlPathname in the Unix syntax. More...
 
char * copyValue (IlPathType type=SystemPathType) const
 Returns a copy of the whole path name stored of this IlPathname. More...
 
IlBoolean create (short mode=-1, IlBoolean recursive=IlTrue) const
 Physically creates a file or a directory corresponding to this IlPathName. More...
 
IlBoolean doesExist () const
 Tests if this path name physically exists. More...
 
void forceAbsolute ()
 Transforms to an absolute path name. More...
 
void forceDirectory ()
 Transforms to a directory. More...
 
void forceRelative ()
 Transforms to a relative path name. More...
 
IlString get83DosValue () const
 Returns the short pathname version of this IlPathname. More...
 
IlString getBaseName () const
 Returns the base file name of this path name. More...
 
IlString getDevice () const
 Returns the device part of this IlPathname. More...
 
IlString getDirectory (IlBoolean finalSep=IlTrue, IlPathType type=SystemPathType) const
 Returns the directory part of this IlPathname. More...
 
IlString getDirName (IlBoolean finalSep=IlTrue, IlPathType type=SystemPathType) const
 Returns the device and directory parts of this IlPathname. More...
 
IlString getDosDirectory (IlBoolean finalSep=IlTrue) const
 Returns the directory part of this IlPathname, with the DOS syntax. More...
 
IlString getDosValue () const
 Returns the whole path name stored in this IlPathname, with the DOS mode. More...
 
IlString getExtension () const
 Returns the extension part of this path name. More...
 
IlString getFileName () const
 Returns the file name part of this path name. More...
 
IlString getString (IlPathType type=SystemPathType) const
 Returns the whole path name stored in this IlPathname. More...
 
IlString getSubDirectory (IlInt level, IlInt count=1) const
 Returns a part of the sub-directories of the path. More...
 
IlString getTruncatedValue (int level=2) const
 Returns a partial representation of the directory part of this IlPathname, showing only the last sub-directories. More...
 
IlString getUnixDirectory (IlBoolean finalSep=IlTrue) const
 Returns the directory part of this IlPathname, with the Unix syntax. More...
 
IlString getUnixValue () const
 Returns the whole path name stored in this IlPathname, with the Unix syntax. More...
 
IlBoolean isAbsolute () const
 Tests if this path name is an absolute path. More...
 
IlBoolean isCurrentDirectory () const
 Tests if this object is the current directory. More...
 
IlBoolean isDirectory () const
 Tests if this path name is a directory. More...
 
IlBoolean isEmpty () const
 Tests if the current path name is empty. More...
 
IlBoolean isEmptyDirectory () const
 Tests if this object has no directory part. More...
 
IlBoolean isExecutable () const
 Tests if this path name refers to an object that can be executed. More...
 
IlBoolean isInCurrentDirectory () const
 Tests if this object is in the current directory. More...
 
IlBoolean isNewer (const IlPathName &path) const
 Tests if a file system object is newer than the one referenced by this IlPathName. More...
 
IlBoolean isReadable () const
 Tests if this path name refers to an object that can be read from. More...
 
IlBoolean isSensitive () const
 Returns IlTrue if the file system where this path name may be stored is case sensitive. More...
 
IlBoolean isSubDirectory (const IlPathName &path) const
 Tests if this object a sub-directory of another IlPathName. More...
 
IlBoolean isSystemDirectory () const
 Tests if this object is a physical directory. More...
 
IlBoolean isWritable () const
 Tests if this path name refers to an object that can be written to. More...
 
IlBoolean match (const IlPathName &filter) const
 Tests if this object matches a path name filter. More...
 
IlPathNamemerge (const char *path)
 Appends a path name to this IlPathName. More...
 
IlPathNamemerge (const IlPathName &path)
 Appends a path name to this IlPathName. More...
 
IlPathNamemerge (const IlString &path)
 Appends a path name to this IlPathName. More...
 
IlBoolean openDir () const
 Opens a directory for reading. More...
 
 operator const char * () const
 Returns the internal representation of the current object into a C-style string. More...
 
 operator IlString () const
 Returns the whole path name in an IlString. More...
 
IlBoolean operator! () const
 The not operator. More...
 
IlBoolean operator!= (const IlPathName &path) const
 The inequality operator. More...
 
IlPathName operator+ (const char *path) const
 Join operator. More...
 
IlPathName operator+ (const IlPathName &path) const
 Join operator. More...
 
IlPathName operator+ (const IlString &path) const
 Join operator. More...
 
IlPathNameoperator+= (const char *path)
 Appends a path name to this IlPathName. More...
 
IlPathNameoperator+= (const IlPathName &path)
 Appends a path name to this IlPathName. More...
 
IlPathNameoperator+= (const IlString &path)
 Appends a path name to this IlPathName. More...
 
IlPathNameoperator= (const char *pathname)
 Assignment operator. More...
 
IlPathNameoperator= (const IlPathName &pathname)
 Assignment operator. More...
 
IlPathNameoperator= (const IlString &pathname)
 Assignment operator. More...
 
IlBoolean operator== (const IlPathName &path) const
 The equality operator. More...
 
IlPathNameprepend (const char *path)
 
IlPathNameprepend (const IlPathName &path)
 
IlPathNameprepend (const IlString &path)
 
IlBoolean queryAccessTime (std::time_t &time) const
 Queries the last access time of the object referenced by this IlPathName. More...
 
IlBoolean queryChangedStatusTime (std::time_t &time) const
 Queries the last time the object referenced by this IlPathName was renamed. More...
 
void queryCurrentDirectory (IlString *drive=0)
 Queries the current directory. More...
 
IlBoolean queryMode (short &mode) const
 Queries the permissions of the object referenced by this IlPathName. More...
 
IlBoolean queryModificationTime (std::time_t &time) const
 Queries the time the object referenced by this IlPathName was last modified. More...
 
IlBoolean readDir (IlPathName &result) const
 Reads the next entry of this IlPathName. More...
 
IlBoolean remove (IlBoolean recursive=IlFalse) const
 Physically removes the file or directory corresponding to this IlPathName. More...
 
void rewindDir () const
 Restart the reading of this directory path name all over. More...
 
void setBaseName (const IlString &basename, int end=-1, int start=0)
 Sets the base name part of this IlPathName. More...
 
void setDevice (const IlString &device, int end=-1, int start=0)
 Sets the device part of this IlPathName. More...
 
void setDirectory (const IlString &directory, int end=-1, IlPathType type=SystemPathType, int start=0)
 Sets the directory part of this IlPathName. More...
 
void setDirName (const IlString &dirName, int end=-1, IlPathType type=SystemPathType, int start=0)
 Sets the dirname part of this IlPathName. More...
 
void setDosDirectory (const IlString &directory, int end=-1, int start=0)
 Sets the directory part of this IlPathName. More...
 
void setDosDirName (const IlString &dirName, int end=-1, int start=0)
 Sets the dirname part of this IlPathName. More...
 
void setDosValue (const IlString &value, int end=-1, int start=0)
 Sets the whole value of this IlPathName. More...
 
void setExtension (const IlString &extension, int end=-1, int start=0)
 Sets the extension part of this IlPathName. More...
 
void setFileName (const IlString &filename, int end=-1, int start=0)
 Sets the file name part of this IlPathName. More...
 
void setUnixDirectory (const IlString &directory, int end=-1, int start=0)
 Sets the directory part of this IlPathName. More...
 
void setUnixDirName (const IlString &dirName, int end=-1, int start=0)
 Sets the dirname part of this IlPathName. More...
 
void setUnixValue (const IlString &value, int end=-1, int start=0)
 Sets the whole value of this IlPathName. More...
 
void setValue (const IlString &value, int end=-1, IlPathType type=SystemPathType, int start=0)
 Sets the whole value of this IlPathName. More...
 

Static Public Member Functions

static IlBoolean doesExist (const IlString &pathname)
 Tests if a path name physically exists. More...
 
static IlBoolean isExecutable (const IlString &pathname)
 Tests if a path name has the execution permission set for the current user. More...
 
static IlBoolean isReadable (const IlString &pathname)
 Tests if a path name has the read permission set for the current user. More...
 
static IlBoolean isWritable (const IlString &pathname)
 Tests if a path name has the write permission set for the current user. More...
 
static void QueryCurrentDirectory (char currentDir[], int size, IlString *drive=0)
 Queries the current directory. More...
 

Detailed Description

Class that manages path names in a portable way.

Library: ilog

Usually, a path name is used to locate a file or a directory in a file system. However, the file or path corresponding to a given IlPathName does not necessarily exist.

A complete path name is made of:

IlPathName objects can be absolute or relative paths.

Member Enumeration Documentation

◆ IlPathType

The different types of path names.

This type indicates the syntax of a path name when it is translated into a string. In particular, it decides whether the directory separator character should be a slash, as on Unix, or a backslash, as on DOS.

Enumerator
SystemPathType 

The syntax of the actual system.

The directory separator character that is used is the one of the system you are running on.

UnixPathType 

The syntax of the Unix-like systems.

The directory separator character is a slash ('/').

DosPathType 

The syntax of the DOS-like systems.

The directory separator character is a backslash ('\').

◆ SortMode

Path names sorting options.

Higher-level objets can sort IlPathName objects. This enumeration allows for customizing how this sort is performed.

Enumerator
SortNone 

No sort on the path name is done.

SortAlphabetically 

Path names are sorted alphabetically.

SortCaseInsensitive 

Path names are sorted alphabetically, but in a case-insentitive manner.

SortReverse 

Path names are sorted in a reverse order.

GroupDirectories 

Paths identifying directories are grouped together.

GroupExtensions 

Paths identifying files with the same extension are grouped together.

Constructor & Destructor Documentation

◆ IlPathName() [1/4]

IlPathName::IlPathName ( )

Initializes an empty IlPathname object.

All the fields are empty.

See also
IlPathName(const IlString&), IlPathName(const char*), IlPathName(const IlPathName&).

◆ IlPathName() [2/4]

IlPathName::IlPathName ( const IlString path)

Initializes an IlPathname object from an IlString.

The string is parsed to initialize a new IlPathname the way you would expect: relative path names are resolved, empty segments are removed, and so on.

If IlPathName is initalized from a string that points to a directory it must end with a trailing slash, otherwise the directory name is treated as a file name.

Example, on a Windows machine:

Parameters
pathThe path that initializes this object.
See also
IlPathName(), IlPathName(const char*), IlPathName(const IlPathName&).

◆ IlPathName() [3/4]

IlPathName::IlPathName ( const char *  path)

Initializes an IlPathname object from a C-style string.

The string is copied.

Parameters
pathThe path that initializes this object.
See also
IlPathName(), IlPathName(const IlString&), IlPathName(const IlPathName&).

◆ IlPathName() [4/4]

IlPathName::IlPathName ( const IlPathName path)

Copy constructor.

Parameters
pathThe source path name that is copied.
See also
IlPathName(), IlPathName(const IlString&), IlPathName(const char*).

Member Function Documentation

◆ addDirectory()

void IlPathName::addDirectory ( const IlString directory,
int  end = -1,
IlPathType  type = SystemPathType,
int  start = 0 
)

Appends a directory to this IlPathName.

directory must be a relative path (not beginning with a directory separator), or the result is undefined.

Example, on a Windows machine:

Parameters
directoryThe directory to append to the current path name.
endThe index of the last character to use from directory. The default value of -1 indicates down to the end of the string.
typeThe syntax (system, Unix or DOS) that the provided string is using. The default is SystemPathType.
startThe index of the first character to take from directory. The default value of 0 indicates the first character of the string.
See also
getDirectory().

◆ addDosDirectory()

void IlPathName::addDosDirectory ( const IlString directory,
int  end = -1,
int  start = 0 
)

Appends a directory to this IlPathName.

directory must be a relative path (not beginning with a backslash character), and in the DOS syntax or the result is undefined.

Parameters
directoryThe directory to append to the current path name.
endThe index of the last character to use from directory. The default value of -1 indicates down to the end of the string.
startThe index of the first character to take from directory. The default value of 0 indicates the first character of the string.
See also
addDirectory(), addUnixDirectory().
getDosDirectory().

◆ addUnixDirectory()

void IlPathName::addUnixDirectory ( const IlString directory,
int  end = -1,
int  start = 0 
)

Appends a directory to this IlPathName.

directory must be a relative path (not beginning with a slash character), and in the Unix syntax or the result is undefined.

Parameters
directoryThe directory to append to the current path name.
endThe index of the last character to use from directory. The default value of -1 indicates down to the end of the string.
startThe index of the first character to take from directory. The default value of 0 indicates the first character of the string.
See also
addDirectory(), addDosDirectory().
getUnixDirectory().

◆ changeCurrentDirectory()

IlBoolean IlPathName::changeCurrentDirectory ( ) const

Changes the current directory to this path name.

Returns
IlFalse if an error occurs and IlTrue if the operation is successful.
See also
QueryCurrentDirectory() queryCurrentDirectory().

◆ changeMode()

IlBoolean IlPathName::changeMode ( short  newMode) const

Changes permissions of the object referenced by this IlPathName.

The value depends on the system. If an error occurs, then the functions returns IlFalse, IlTrue otherwise.

Parameters
newModeThe new mode that is set to the object referenced by this path name object, as defined in the "C" function chmod.
Returns
IlTrue if the method succeeds and IlFalse if an error occurs.
See also
queryMode().

◆ closeDir()

IlBoolean IlPathName::closeDir ( ) const

Closes this IlPathName.

The current path name must have been opened using openDir() before this method is invoked. When this method returns, you must not invoke readDir() or rewindDir any more.

Returns
IlTrue if the method succeeds and IlFalse if an error occurs.
See also
openDir(), readDir(), rewindDir().

◆ computeAllButLastSubDirectory()

IlPathName& IlPathName::computeAllButLastSubDirectory ( )

Replaces this IlPathName by its directory part, except the last level.

The file name part is dropped from this object.
If the directory part has no sub-directory (it refers to a device root directory) then it is not modified.

Example, on a Windows machine:

Returns
The resulting IlPathName object.

◆ computeDifferLeading()

IlPathName& IlPathName::computeDifferLeading ( const IlPathName path)

Computes the part that is different from the beginning of two path names.

This method stores the part of the two path names that in common, the the end of them.

Example, on a Windows machine:

Parameters
pathThe path name to compare with.
Returns
The current, modified object.
See also
computeDifferTrailing().
computeSameLeading().

◆ computeDifferTrailing()

IlPathName& IlPathName::computeDifferTrailing ( const IlPathName path)

Computes the part that is different from the beginning of two path names.

This method stores the part of the two path names that in common, at the end of them.

Example, on a Windows machine:

Parameters
pathThe path name to compare with.
Returns
The current, modified object.
See also
computeDifferLeading().
computeSameTrailing().

◆ computeFirstSubDirectory()

IlPathName& IlPathName::computeFirstSubDirectory ( )

Query the top-most directory of this IlPathName.

Example, on a Windows machine:

Returns
The current, modified object.
See also
computeLastSubDirectory().

◆ computeLastSubDirectory()

IlPathName& IlPathName::computeLastSubDirectory ( )

Query the bottom-most directory of this IlPathName.

Example, on a Windows machine:

Returns
The current, modified object.
See also
computeFirstSubDirectory().

◆ computeLevelNumber()

int IlPathName::computeLevelNumber ( ) const

Computes the number of levels of the current path.

This value is the number of sub-directories this IlPathName is made of.

Returns
The number of sub-directories stored in this object.
See also
getTruncatedValue().

◆ computeRelativePath()

IlPathName& IlPathName::computeRelativePath ( const IlPathName path)

Computes the relative path of the current path name, relative to another IlPathName.

The current object is assigned a relative path that is such that if it were appended to path, the resulting value would be the initial value of the current path name object.

Example, on a Windows machine:

Parameters
pathThe path name to compute the relative path from. Note that this must be a directory (its value should end with a directory separator).
Returns
The resulting IlPathName object, that holds the computed relative path.

◆ computeSameLeading()

IlPathName& IlPathName::computeSameLeading ( const IlPathName path)

Computes the part that is common at the beginning of two path names.

Example, on a Windows machine:

Parameters
pathThe path name to compare with.
Returns
The current, modified object.
See also
computeSameTrailing().
computeDifferLeading().

◆ computeSameTrailing()

IlPathName& IlPathName::computeSameTrailing ( const IlPathName path)

Computes the part that is common at the end of two path names.

Example, on a Windows machine:

Parameters
pathThe path name to compare with.
Returns
The current, modified object.
See also
computeSameLeading().
computeDifferLeading().

◆ copy83DosValue()

char* IlPathName::copy83DosValue ( ) const

Returns a copy of the content of this IlPathname, truncated to 8.3 names, in the DOS syntax.

This method is equivalent to get83DosValue().copyValue();.

This method builds a SFN version of the current path name, in the DOS syntax. If the path name is empty, it returns .\.

Note: The truncation is actually the result of removing the trailing characters of each part of the path name, if necessary. It leaves a maximum of eight characters for each part, and three characters for the extension part. This does not follow the SFN specification (see the 8.3 filename article on Wikipedia.

Warning
The returned string must be deleted with the delete[] operator when it is not used any more.
Returns
A new C-style string, allocated with new[], that contains an SFN-like version of this path name.
See also
get83DosValue(), getDosValue().

◆ copyBaseName()

char* IlPathName::copyBaseName ( ) const

Returns a copy of the file name and the extension parts of this IlPathname.

Warning
The returned string must be deleted with the delete[] operator when it is not used any more.
Returns
A new C-style string, allocated with new[], that contains the file name and the extension parts of this path name.
See also
getBaseName().

◆ copyDevice()

char* IlPathName::copyDevice ( ) const

Returns a copy of the device part of this IlPathname.

Warning
The returned string must be deleted with the delete[] operator when it is not used any more.
Returns
A new C-style string, allocated with new[], that contains the device part of this path name.
See also
getDevice().

◆ copyDirectory()

char* IlPathName::copyDirectory ( IlBoolean  finalSep = IlTrue,
IlPathType  type = SystemPathType 
) const

Returns a copy of the directory part of this IlPathname.

Warning
The returned string must be deleted with the delete[] operator when it is not used any more.
Parameters
finalSepIf IlTrue (which is the default), a final directory separator is added to the returned value.
typeThe syntax (system, Unix or DOS) that you want returned. The default is SystemPathType.
Returns
A new C-style string, allocated with new[], that contains the device part of this path name.
See also
getDirectory().

◆ copyDirName()

char* IlPathName::copyDirName ( IlBoolean  finalSep = IlTrue,
IlPathType  type = SystemPathType 
) const

Returns a copy of the device and directory parts of this IlPathname.

The two parts are concatenated.
Note that in the Unix form of the path names, the device part is always empty.

Warning
The returned string must be deleted with the delete[] operator when it is not used any more.
Parameters
finalSepIf IlTrue (which is the default), a final directory separator is added to the returned value.
typeThe syntax (system, Unix or DOS) that you want returned. The default is SystemPathType.
Returns
A new C-style string, allocated with new[], that contains the concatenation of the device and the directory parts of this path name.
See also
getDirName().

◆ copyDosDirectory()

char* IlPathName::copyDosDirectory ( IlBoolean  finalSep = IlTrue) const

Returns a copy of the directory part of this IlPathname in the DOS syntax.

This method is equivalent to copyDirectory(finalSep, DosPathType);.

Warning
The returned string must be deleted with the delete[] operator when it is not used any more.
Parameters
finalSepIf IlTrue (which is the default), a final backslash character is added to the returned value.
Returns
A new C-style string, allocated with new[], that contains the directory part of this path name.
See also
copyDirectory(), getDosDirectory().

◆ copyDosValue()

char* IlPathName::copyDosValue ( ) const

Returns a copy of the content of this IlPathname in the DOS syntax.

This method is equivalent to copyValue(DosPathType);.

Warning
The returned string must be deleted with the delete[] operator when it is not used any more.
Returns
A new C-style string, allocated with new[], that contains the representation of this path name.
See also
copyValue(), getDosValue().

◆ copyExtension()

char* IlPathName::copyExtension ( ) const

Returns a copy of the extension part of this IlPathname.

Warning
The returned string must be deleted with the delete[] operator when it is not used any more.
Returns
A new C-style string, allocated with new[], that contains the extension part of this path name.
See also
getExtension().

◆ copyFileName()

char* IlPathName::copyFileName ( ) const

Returns a copy of the file name part of this IlPathname.

Warning
The returned string must be deleted with the delete[] operator when it is not used any more.
Returns
A new C-style string, allocated with new[], that contains the file name of this path name.
See also
getFileName().

◆ copyUnixDirectory()

char* IlPathName::copyUnixDirectory ( IlBoolean  finalSep = IlTrue) const

Returns a copy of the directory part of this IlPathname in the Unix syntax.

This method is equivalent to copyDirectory(finalSep, UnixPathType);.

Warning
The returned string must be deleted with the delete[] operator when it is not used any more.
Parameters
finalSepIf IlTrue (which is the default), a final slash character is added to the returned value.
Returns
A new C-style string, allocated with new[], that contains the directory part of this path name.
See also
copyDirectory(), getUnixDirectory().

◆ copyUnixValue()

char* IlPathName::copyUnixValue ( ) const

Returns a copy of the content of this IlPathname in the Unix syntax.

This method is equivalent to copyValue(UnixPathType);.

Warning
The returned string must be deleted with the delete[] operator when it is not used any more.
Returns
A new C-style string, allocated with new[], that contains the representation of this path name.
See also
copyValue(), getUnixValue().

◆ copyValue()

char* IlPathName::copyValue ( IlPathType  type = SystemPathType) const

Returns a copy of the whole path name stored of this IlPathname.

If the path name is empty, this returns "." followed by the requested directory separator.

Warning
The returned string must be deleted with the delete[] operator when it is not used any more.
Parameters
typeThe syntax (system, Unix or DOS) that you want returned. The default is SystemPathType.
Returns
A new C-style string, allocated with new[], that contains the concatenation of the the whole contentof this path name.
See also
getString().

◆ create()

IlBoolean IlPathName::create ( short  mode = -1,
IlBoolean  recursive = IlTrue 
) const

Physically creates a file or a directory corresponding to this IlPathName.

You can specify the creation mode, at it is defined in the "C" function chmod.

Parameters
modeThe creation mode for this file system object. The default value of -1 indicates that the default mode (as specified by umask on Unix systems) must be used.
recursiveIf set to IlTrue, which is the default, then the entire directory structure will be created as neeeded to create the indicated file system object. Set this to IlFalse not to create this structure, and potentially fail to create the final object if the hierarchy does not exist.
Returns
IlTrue if the method succeeds and IlFalse if an error occurs.
See also
remove(), changeMode().

◆ doesExist() [1/2]

IlBoolean IlPathName::doesExist ( ) const

Tests if this path name physically exists.

Returns
IlTrue if the path name actually exists on the file system, and IlFalse otherwise.
See also
doesExist(const IlString&).
isReadable().

◆ doesExist() [2/2]

static IlBoolean IlPathName::doesExist ( const IlString pathname)
static

Tests if a path name physically exists.

Parameters
pathnameThe path name to test. This must be in the system syntax.
Returns
IlTrue if the referenced path actually exists on the file system and IlFalse otherwise.
See also
doesExist().
isReadable(const IlString& pathname), isWritable(const IlString&), isExecutable(const IlString&).

◆ forceAbsolute()

void IlPathName::forceAbsolute ( )

Transforms to an absolute path name.

If the current path name is not an absolute pathname, this method prepends a directory separator in front its whole directory part.

See also
forceRelative().

◆ forceDirectory()

void IlPathName::forceDirectory ( )

Transforms to a directory.

The file name and extension parts become the final part of the directory part.

◆ forceRelative()

void IlPathName::forceRelative ( )

Transforms to a relative path name.

If the current path name is an absolute pathname, this method removes the directory separator in front its whole directory part.

◆ get83DosValue()

IlString IlPathName::get83DosValue ( ) const

Returns the short pathname version of this IlPathname.

This method builds a SFN (Short File Name)version of the current path name, in the DOS syntax. If the path name is empty, it returns .\.

Note: The truncation is actually the result of removing the trailing characters of each part of the path name, if necessary. It leaves a maximum of eight characters for each part, and three characters for the extension part. This does not follow the SFN specification (see the 8.3 filename article on Wikipedia), but has similar consequences.

Example, on a Windows machine:

Returns
An SFN-like version of this path name.
See also
getDosValue(), copy83DosValue().

◆ getBaseName()

IlString IlPathName::getBaseName ( ) const

Returns the base file name of this path name.

The Example, on a Windows machine:

Returns
The base file name of this object.
See also
setBaseName().
copyBaseName().
getFileName(), getExtension().

◆ getDevice()

IlString IlPathName::getDevice ( ) const

Returns the device part of this IlPathname.

On a Windows platform, this method returns the drive letter of the path name.

Example, on a Windows machine:

Returns
The device part of this object.
See also
setDevice(), copyDevice().

◆ getDirectory()

IlString IlPathName::getDirectory ( IlBoolean  finalSep = IlTrue,
IlPathType  type = SystemPathType 
) const

Returns the directory part of this IlPathname.

Example, on a Windows machine:

Parameters
finalSepIf IlTrue (which is the default), a final directory separator is added to the returned value.
typeThe syntax (system, Unix or DOS) that you want returned. The default is SystemPathType.
Returns
The directory part of this object.
See also
setDirectory(), getDirName(), copyDirectory().

◆ getDirName()

IlString IlPathName::getDirName ( IlBoolean  finalSep = IlTrue,
IlPathType  type = SystemPathType 
) const

Returns the device and directory parts of this IlPathname.

The two parts are concatenated.
Note that in the Unix form of the path names, the device part is always empty.

Example, on a Windows machine:

Parameters
finalSepIf IlTrue (which is the default), a final directory separator is added to the returned value.
typeThe syntax (system, Unix or DOS) that you want returned. The default is SystemPathType.
Returns
The concatenation of the device and directory parts of this object.
See also
setDirName(const IlString&, int, IlPathType, int), getDevice(), copyDirName().

◆ getDosDirectory()

IlString IlPathName::getDosDirectory ( IlBoolean  finalSep = IlTrue) const

Returns the directory part of this IlPathname, with the DOS syntax.

Parameters
finalSepIf IlTrue, the returned string ends with a backslash ('\') character.
Returns
The directory part of this object, using the DOS directory separator backslash ('\').
See also
getDirectory().

◆ getDosValue()

IlString IlPathName::getDosValue ( ) const

Returns the whole path name stored in this IlPathname, with the DOS mode.

If the path name is empty, it returns ".\\".

Returns
The whole path name stored in this object, using the DOS directory separator backslash ('\').
See also
getString().

◆ getExtension()

IlString IlPathName::getExtension ( ) const

Returns the extension part of this path name.

Example, on a Windows machine:

Returns
The extension part of this object.
See also
setExtension() getBaseName().

◆ getFileName()

IlString IlPathName::getFileName ( ) const

Returns the file name part of this path name.

Example, on a Windows machine:

Returns
The file name part of this object.
See also
setFileName(), getBaseName().

◆ getString()

IlString IlPathName::getString ( IlPathType  type = SystemPathType) const

Returns the whole path name stored in this IlPathname.

If the path name is empty, this returns "." followed by the requested directory separator.

Parameters
typeThe syntax (system, Unix or DOS) that you want returned. The default is SystemPathType.
Returns
The whole path name stored in this object.
See also
setValue().
copyValue().
getFileName(), getExtension(), getDevice(), getDirectory(),

◆ getSubDirectory()

IlString IlPathName::getSubDirectory ( IlInt  level,
IlInt  count = 1 
) const

Returns a part of the sub-directories of the path.

This methods collects a series of successive sub-directories in the current path name object, and returns them using the current system syntax.

Example, on a Windows machine:

Parameters
levelThe starting sub-directory level into the path, starting at 1. If level is a negative value, this method will start collecting the sub-directories from the end (-1 indicates the last sub-directory of the path name).
countThe number of sub-directories that are collected. If this value is 0, the empty string is returned. If this value is negative, every sub-directory after level will be collected.
Returns
The requested sub-path.

◆ getTruncatedValue()

IlString IlPathName::getTruncatedValue ( int  level = 2) const

Returns a partial representation of the directory part of this IlPathname, showing only the last sub-directories.

The returns string contains the path name in the system syntax, but with only, at most, the last level sub-directories. If the path name contains more than level sub-directories, then the first sub-directory names are replaced by an ellipsis ("...").

If level is greater than the number of sub-directories in the current path name, then this method is equivalent to:

Example, on a Windows machine:

Parameters
levelHow many sub-directories the result string contains. The default value is 2.
Returns
A string that represents this object, but containing only the last level sub-directories.
See also
getString().

◆ getUnixDirectory()

IlString IlPathName::getUnixDirectory ( IlBoolean  finalSep = IlTrue) const

Returns the directory part of this IlPathname, with the Unix syntax.

Parameters
finalSepIf IlTrue, the returned string ends with a slash ('/') character.
Returns
The directory part of this object, using the Unix directory separator slash ('/').
See also
getDirectory().

◆ getUnixValue()

IlString IlPathName::getUnixValue ( ) const

Returns the whole path name stored in this IlPathname, with the Unix syntax.

If the path name is empty, it returns "./".

Returns
The whole path name stored in this object, using the Unix directory separator slash ('/').
See also
getString().

◆ isAbsolute()

IlBoolean IlPathName::isAbsolute ( ) const

Tests if this path name is an absolute path.

Returns
IlTrue if this object is an absolute path and IlFalse otherwise.

◆ isCurrentDirectory()

IlBoolean IlPathName::isCurrentDirectory ( ) const

Tests if this object is the current directory.

Returns
IlTrue if the path name is a directory and the directory part is ., and IlFalse otherwise.
See also
isInCurrentDirectory().

◆ isDirectory()

IlBoolean IlPathName::isDirectory ( ) const

Tests if this path name is a directory.

An IlPathName is a directory if it has is no file name and no extension.

Returns
IlTrue if this object is a directory and IlFalse otherwise.
See also
isSubDirectory().

◆ isEmpty()

IlBoolean IlPathName::isEmpty ( ) const

Tests if the current path name is empty.

Returns
IlTrue if the path is empty, that is all the parts of the path name are empty, and IlFalse otherwise.

◆ isEmptyDirectory()

IlBoolean IlPathName::isEmptyDirectory ( ) const

Tests if this object has no directory part.

Returns
IlTrue if this path has an empty directory part, and IlFalse otherwise.

◆ isExecutable() [1/2]

IlBoolean IlPathName::isExecutable ( ) const

Tests if this path name refers to an object that can be executed.

Returns
IlTrue if the path name refers to an object that is executable, and IlFalse otherwise.
See also
isExecutable(const IlString&).
doesExist(), isReadable(), isWritable().

◆ isExecutable() [2/2]

static IlBoolean IlPathName::isExecutable ( const IlString pathname)
static

Tests if a path name has the execution permission set for the current user.

Parameters
pathnameThe path name to test. This must be in the system syntax.
Returns
IlTrue if the referenced path exists and has the execution permission for the current user and IlFalse otherwise.
See also
isExecutable().
doesExist(const IlString&), isReadable(const IlString&), isWritable(const IlString&).

◆ isInCurrentDirectory()

IlBoolean IlPathName::isInCurrentDirectory ( ) const

Tests if this object is in the current directory.

Returns
Returns IlTrue if the directory part is . (the current directory), and IlFalse otherwise.
See also
isCurrentDirectory(), isSubDirectory().

◆ isNewer()

IlBoolean IlPathName::isNewer ( const IlPathName path) const

Tests if a file system object is newer than the one referenced by this IlPathName.

A file system is newer than another if it has been modified more recently than the other.

Parameters
pathThe path name object to compare the last modification with.
Returns
IlTrue if the method succeeds and IlFalse if an error occurs.
See also
queryModificationTime().

◆ isReadable() [1/2]

IlBoolean IlPathName::isReadable ( ) const

Tests if this path name refers to an object that can be read from.

Returns
IlTrue if the path name refers to an object that can be read, and IlFalse otherwise.
See also
isReadable(const IlString&).
doesExist(), isWritable(), isExecutable().

◆ isReadable() [2/2]

static IlBoolean IlPathName::isReadable ( const IlString pathname)
static

Tests if a path name has the read permission set for the current user.

Parameters
pathnameThe path name to test. This must be in the system syntax.
Returns
IlTrue if the referenced path exists and has the read permission for the current user and IlFalse otherwise.
See also
isReadable().
doesExist(const IlString&), isWritable(const IlString&), isExecutable(const IlString&).

◆ isSensitive()

IlBoolean IlPathName::isSensitive ( ) const

Returns IlTrue if the file system where this path name may be stored is case sensitive.

Returns
IlTrue if the file system is refers to an object that is executable, and IlFalse otherwise.

◆ isSubDirectory()

IlBoolean IlPathName::isSubDirectory ( const IlPathName path) const

Tests if this object a sub-directory of another IlPathName.

Parameters
pathThe path that is tested upon.
Returns
IlTrue if this object is a sub-directory of path, and IlFalse otherwise.
See also
isInCurrentDirectory().

◆ isSystemDirectory()

IlBoolean IlPathName::isSystemDirectory ( ) const

Tests if this object is a physical directory.

Returns
IlTrue if this path is an actual, physical, directory, and IlFalse otherwise.

◆ isWritable() [1/2]

IlBoolean IlPathName::isWritable ( ) const

Tests if this path name refers to an object that can be written to.

Returns
IlTrue if the path name refers to an object that can be written, and IlFalse otherwise.
See also
isWritable(const IlString&).
doesExist(), isReadable(), isExecutable().

◆ isWritable() [2/2]

static IlBoolean IlPathName::isWritable ( const IlString pathname)
static

Tests if a path name has the write permission set for the current user.

Parameters
pathnameThe path name to test. This must be in the system syntax.
Returns
IlTrue if the referenced path exists and has the write permission for the current user and IlFalse otherwise.
See also
isWritable().
doesExist(const IlString&), isReadable(const IlString&), isExecutable(const IlString&).

◆ match()

IlBoolean IlPathName::match ( const IlPathName filter) const

Tests if this object matches a path name filter.

This is useful only if the parameter is a filter (where the filename contains placeholders). Valid placeholders are star (‘’*') that matches with any string, and <i>question mark</i> ('?'`) that matches any character.

Note: The match succeeds only if the filter device part is identical to this object's.

Note: This function uses the Unix conventions:

  • *.* means filename=* and extension=?*.
  • * means filename=* and extension=*.

Here is a simple example of using a path name filter:

The filter can also contain one (and only one) alternate construct, using different patterns, separated by the '|' character (vertical bar, or pipe), between two parentheses. Here is an example of this:

Parameters
filterThe filter to match this path name against.
Returns
IlTrue if the current path matches filter, and IlFalse otherwise.

◆ merge() [1/3]

IlPathName& IlPathName::merge ( const char *  path)

Appends a path name to this IlPathName.

This method is equivalent to operator+(const IlString& path).

  • If path is an absolute path name, then it is copied into the current object.
  • If path is a relative path name, then the file name and extension parts of the result will be filled with the respective values from path, and the directory part will be the result of a of join of the current directory value and the one in path.
Parameters
pathThe path name to append to the current object.
Returns
The resulting IlPathName object. The string is copied and must be in the syntax of the system.
See also
operator+(const IlString&) const.
merge(const IlPathName&), merge(const IlString&).

◆ merge() [2/3]

IlPathName& IlPathName::merge ( const IlPathName path)

Appends a path name to this IlPathName.

This method is equivalent to operator+(const IlPathName& path).

  • If path is an absolute path name, then it is copied into the current object.
  • If path is a relative path name, then the file name and extension parts of the result will be filled with the respective values from path, and the directory part will be the result of a of join of the current directory value and the one in path.
Parameters
pathThe path name to append to the current object.
Returns
The resulting IlPathName object.
See also
operator+(const IlString&) const.
merge(const IlString&), merge(const char*).

◆ merge() [3/3]

IlPathName& IlPathName::merge ( const IlString path)

Appends a path name to this IlPathName.

This method is equivalent to operator+(const IlString& path).

  • If path is an absolute path name, then it is copied into the current object.
  • If path is a relative path name, then the file name and extension parts of the result will be filled with the respective values from path, and the directory part will be the result of a of join of the current directory value and the one in path.
Parameters
pathThe path name to append to the current object.
Returns
The resulting IlPathName object. The string must be in the syntax of the system.
See also
operator+(const IlString&) const.
merge(const IlPathName&), merge(const char*).

◆ openDir()

IlBoolean IlPathName::openDir ( ) const

Opens a directory for reading.

This method opens a directory for reading. Successive calls to readDir() can list a directory content. The path name must be closed using the closeDir() method.

Example, on a Windows machine:

Returns
IlTrue if the method succeeds and IlFalse if an error occurs.
See also
readDir(), closeDir(), rewindDir().

◆ operator const char *()

IlPathName::operator const char * ( ) const

Returns the internal representation of the current object into a C-style string.

Warning
The returned string must not be deleted nor modified. The lifetime of the returned string is the same as the one of the IlPathName object.
Returns
An internal C pointer to the path name value.

◆ operator IlString()

IlPathName::operator IlString ( ) const

Returns the whole path name in an IlString.

The path name is returned with the current system directory separator.

This method is equivalent to:

Returns
A string that reflects the object's content.
See also
operator const char*().

◆ operator!()

IlBoolean IlPathName::operator! ( ) const

The not operator.

This operator tests whether this object is empty, that is all the parts of the path name are empty.

Returns
IlTrue if this object is empty, IlFalse otherwise.
See also
isEmpty().

◆ operator!=()

IlBoolean IlPathName::operator!= ( const IlPathName path) const

The inequality operator.

This operator tests whether this object has a different value than another IlPathName.

Parameters
pathThe object to compare this object to.
Returns
IlTrue if objects are not equal and IlFalse otherwise.
See also
operator==().

◆ operator+() [1/3]

IlPathName IlPathName::operator+ ( const char *  path) const

Join operator.

This operator appends a path name stored in path to the current object, exactly as it is done in the operator+(const IlPathName&) const operator.

Parameters
pathThe path name to append to the current object. This string is copied by this operator.
Returns
The resulting IlPathName object.
See also
operator+(const IlPathName&) const, operator+(const IlString&) const.
operator+=(const char*).
merge(const char*).

◆ operator+() [2/3]

IlPathName IlPathName::operator+ ( const IlPathName path) const

Join operator.

This operator appends a IlPathName to the current object.

  • If path is an absolute path name, then it is copied into the current object.
  • If path is a relative path name, then the file name and extension parts of the result will be filled with the respective values from path, and the directory part will be the result of a of join of the current directory value and the one in path.

Example, on a Windows machine:

Parameters
pathThe path name to append to the current object.
Returns
The resulting IlPathName object.
See also
operator+(const IlString&) const, operator+(const char*) const.
operator+=(const IlPathName&).
merge(const IlPathName&).

◆ operator+() [3/3]

IlPathName IlPathName::operator+ ( const IlString path) const

Join operator.

This operator appends a path name stored in path to the current object, exactly as it is done in the operator+(const IlPathName&) const operator.

Parameters
pathThe path name to append to the current object.
Returns
The resulting IlPathName object.
See also
operator+(const IlPathName&) const, operator+(const char*) const,
operator+=(const IlString&).
merge(const IlString&).

◆ operator+=() [1/3]

IlPathName& IlPathName::operator+= ( const char *  path)

Appends a path name to this IlPathName.

If path is an absolute path name, then it is copied into the current object.
If path is a relative path name, then the file name and extension parts of the result will be filled with the respective values from path, and the directory part will be the result of a of join of the current directory value and the one in path.

Parameters
pathThe path name to append to the current object. This must be in the system syntax. This string is copied internally.
Returns
The resulting IlPathName object.
See also
operator+=(const IlPathName&), operator+=(const IlString&).
merge(const char*).

◆ operator+=() [2/3]

IlPathName& IlPathName::operator+= ( const IlPathName path)

Appends a path name to this IlPathName.

If path is an absolute path name, then it is copied into the current object.
If path is a relative path name, then the file name and extension parts of the result will be filled with the respective values from path, and the directory part will be the result of a of join of the current directory value and the one in path.

Parameters
pathThe path name to append to the current object.
Returns
The resulting IlPathName object.
See also
operator+=(const IlString&), operator+=(const char*).
merge(const IlPathName&).

◆ operator+=() [3/3]

IlPathName& IlPathName::operator+= ( const IlString path)

Appends a path name to this IlPathName.

If path is an absolute path name, then it is copied into the current object.
If path is a relative path name, then the file name and extension parts of the result will be filled with the respective values from path, and the directory part will be the result of a of join of the current directory value and the one in path.

Parameters
pathThe path name to append to the current object. This must be in the system syntax.
Returns
The resulting IlPathName object.
See also
operator+=(const IlPathName&), operator+=(const char*).
merge(const IlString&).

◆ operator=() [1/3]

IlPathName& IlPathName::operator= ( const char *  pathname)

Assignment operator.

Assigns pathname to this object.

Warning
pathname must be in the syntax of the system.
Parameters
pathnameThe value that is assigned.
Returns
The current, modified object.
See also
operator=(const IlPathName&), operator=(const IlString&).

◆ operator=() [2/3]

IlPathName& IlPathName::operator= ( const IlPathName pathname)

Assignment operator.

Copies pathname into the current object.

Parameters
pathnameThe object that is copied.
Returns
The current, modified object.
See also
operator=(const IlString&), operator=(const char*).

◆ operator=() [3/3]

IlPathName& IlPathName::operator= ( const IlString pathname)

Assignment operator.

Assigns pathname to this object.

Warning
pathname must be in the syntax of the system.
Parameters
pathnameThe value that is assigned.
Returns
The current, modified object.
See also
operator=(const IlPathName&), operator=(const char*).

◆ operator==()

IlBoolean IlPathName::operator== ( const IlPathName path) const

The equality operator.

This operator tests whether this object has the same value as another IlPathName.

Parameters
pathThe object to compare this object to.
Returns
IlTrue if both objects are equal and IlFalse otherwise.
See also
operator!=().

◆ prepend() [1/3]

IlPathName& IlPathName::prepend ( const char *  path)

Prepends a path name to this IlPathName.

  • If the current path name an absolute path name, it it not modified.
  • If the current path name is a relative path name, then the its directory part will be the result of a of join of the directory path of path and and the current one.
Parameters
pathThe path name to prepend to the current object. This string is copied, and must be in the syntax of the system.
Returns
The resulting IlPathName object.
See also
merge(const char*).
prepend(const IlPathName&), prepend(const IlString&).

◆ prepend() [2/3]

IlPathName& IlPathName::prepend ( const IlPathName path)

Prepends a path name to this IlPathName.

This method

  • If the current path name an absolute path name, it it not modified.
  • If the current path name is a relative path name, then the its directory part will be the result of a of join of the directory path of path and and the current one.
Parameters
pathThe path name to prepend to the current object.
Returns
The resulting IlPathName object.
See also
merge(const IlPathName&).
prepend(const IlString&), prepend(const char*).

◆ prepend() [3/3]

IlPathName& IlPathName::prepend ( const IlString path)

Prepends a path name to this IlPathName.

  • If the current path name an absolute path name, it it not modified.
  • If the current path name is a relative path name, then the its directory part will be the result of a of join of the directory path of path and and the current one.
Parameters
pathThe path name to prepend to the current object. This must be in the syntax of the system.
Returns
The resulting IlPathName object.
See also
merge(const IlString&).
prepend(const IlPathName&), prepend(const char*).

◆ queryAccessTime()

IlBoolean IlPathName::queryAccessTime ( std::time_t &  time) const

Queries the last access time of the object referenced by this IlPathName.

Parameters
timeIs set to the last access time of the file system entity referenced by this path name object.
Returns
IlTrue if the method succeeds and IlFalse if an error occurs.
See also
queryChangedStatusTime(), queryModificationTime().

◆ queryChangedStatusTime()

IlBoolean IlPathName::queryChangedStatusTime ( std::time_t &  time) const

Queries the last time the object referenced by this IlPathName was renamed.

Note that on Windows system, this value corresponds to the creation time.

Parameters
timeIs set to the time when the file system entity referenced by this path name object was last renamed (or created, on Windows).
Returns
IlTrue if the method succeeds and IlFalse if an error occurs.
See also
queryAccessTime(), queryModificationTime().

◆ QueryCurrentDirectory()

static void IlPathName::QueryCurrentDirectory ( char  currentDir[],
int  size,
IlString drive = 0 
)
static

Queries the current directory.

This method copies the absolute path name of the current directory into currentDir.

Parameters
currentDirThe buffer where the path name of the current directory is stored.
sizeThe maximal number, including the final 0, of characters than currentDir can hold. If the path name of the current directory is longer than this size, the result is undefined.
driveAn optional parameter that indicates what drive to query the directory for. It is relevant on system that use devices (such as Windows). The default value, 0, indicates that you want to query the current directory on the current device.
See also
queryCurrentDirectory().

◆ queryCurrentDirectory()

void IlPathName::queryCurrentDirectory ( IlString drive = 0)

Queries the current directory.

This method assigns the absolute path name of the current directory into this path name object.

Parameters
driveAn optional parameter that indicates what drive to query the directory for. It is relevant on system that use devices (such as Windows). The default value, 0, indicates that you want to query the current directory on the current device.
See also
QueryCurrentDirectory().
changeCurrentDirectory().

◆ queryMode()

IlBoolean IlPathName::queryMode ( short &  mode) const

Queries the permissions of the object referenced by this IlPathName.

The value depends on the system. If an error occurs, then the functions returns IlFalse; otherwise IlTrue.

Parameters
modeIs set to the permission bits of the file system entity referenced by this path name object.
Returns
IlTrue if the method succeeds and IlFalse if an error occurs.
See also
changeMode().

◆ queryModificationTime()

IlBoolean IlPathName::queryModificationTime ( std::time_t &  time) const

Queries the time the object referenced by this IlPathName was last modified.

Parameters
timeIs set to the last modification time of the file system entity referenced by this path name object.
Returns
IlTrue if the method succeeds and IlFalse if an error occurs.
See also
queryAccessTime(), queryChangedStatusTime().

◆ readDir()

IlBoolean IlPathName::readDir ( IlPathName result) const

Reads the next entry of this IlPathName.

The current path name must have been opened using openDir() before this method is invoked.

Parameters
resultOn exit, holds the path name that was read from this opened directory path name.
Returns
IlTrue if the method succeeds and IlFalse if an error occurs. You should stop reading entries when this method returns IlFalse.
See also
openDir(), closeDir(), rewindDir().

◆ remove()

IlBoolean IlPathName::remove ( IlBoolean  recursive = IlFalse) const

Physically removes the file or directory corresponding to this IlPathName.

Parameters
recursiveIf set to IlTrue and if this path name object represents a directory then the entire directory and all its content destroyed, including its sub-directories. The default value of IlFalse is used when the directory should be empty before removal.
Returns
IlTrue if the method succeeds and IlFalse if an error occurs.
See also
create().

◆ rewindDir()

void IlPathName::rewindDir ( ) const

Restart the reading of this directory path name all over.

After calling this function, the next value returned by readDir() will be the first entry of the directory. The current path name must have been opened using openDir() before this method is invoked.

See also
openDir(), readDir(), closeDir().

◆ setBaseName()

void IlPathName::setBaseName ( const IlString basename,
int  end = -1,
int  start = 0 
)

Sets the base name part of this IlPathName.

The base name is the concatenation of the filename and the extention parts.

Parameters
basenameThe base name to set to the current object.
endThe index of the last character to use from basename. The default value of -1 indicates down to the end of the string.
startThe index of the first character to take from basename. The default value of 0 indicates the first character of the string.
See also
getBaseName().

◆ setDevice()

void IlPathName::setDevice ( const IlString device,
int  end = -1,
int  start = 0 
)

Sets the device part of this IlPathName.

Parameters
deviceThe device to set to the current object.
endThe index of the last character to use from device. The default value of -1 indicates down to the end of the string.
startThe index of the first character to take from device. The default value of 0 indicates the first character of the string.
See also
getDevice().

◆ setDirectory()

void IlPathName::setDirectory ( const IlString directory,
int  end = -1,
IlPathType  type = SystemPathType,
int  start = 0 
)

Sets the directory part of this IlPathName.

Parameters
directoryThe directory to set to the current object.
endThe index of the last character to use from directory. The default value of -1 indicates down to the end of the string.
typeThe syntax (system, Unix or DOS) that the provided string is using. The default is SystemPathType.
startThe index of the first character to take from directory. The default value of 0 indicates the first character of the string.
See also
getDirectory().
setUnixDirectory(), setDosDirectory().

◆ setDirName()

void IlPathName::setDirName ( const IlString dirName,
int  end = -1,
IlPathType  type = SystemPathType,
int  start = 0 
)

Sets the dirname part of this IlPathName.

The dirname of a path name is the concatenation of the path name device and directory parts.

Parameters
dirNameThe device and directory to set to the current object.
endThe index of the last character to use from dirName. The default value of -1 indicates down to the end of the string.
typeThe syntax (system, Unix or DOS) that the provided string is using. The default is SystemPathType.
startThe index of the first character to take from dirName. The default value of 0 indicates the first character of the string.
See also
getDirName().
setDevice(), setDirectory().

◆ setDosDirectory()

void IlPathName::setDosDirectory ( const IlString directory,
int  end = -1,
int  start = 0 
)

Sets the directory part of this IlPathName.

Parameters
directoryThe directory to set to the current object. This must be in the DOS syntax.
endThe index of the last character to use from directory. The default value of -1 indicates down to the end of the string.
startThe index of the first character to take from directory. The default value of 0 indicates the first character of the string.
See also
getDosDirectory().
setDirectory(), setUnixDirectory().

◆ setDosDirName()

void IlPathName::setDosDirName ( const IlString dirName,
int  end = -1,
int  start = 0 
)

Sets the dirname part of this IlPathName.

The dirname of a path name is the concatenation of the path name device and directory parts.

Parameters
dirNameThe device and directory to set to the current object. This must be in the DOS syntax.
endThe index of the last character to use from dirName. The default value of -1 indicates down to the end of the string.
startThe index of the first character to take from dirName. The default value of 0 indicates the first character of the string.
See also
setDirName(), setUnixDirName().

◆ setDosValue()

void IlPathName::setDosValue ( const IlString value,
int  end = -1,
int  start = 0 
)

Sets the whole value of this IlPathName.

Parameters
valueThe new value to set to the current object. This must be in the DOS syntax.
endThe index of the last character to use from value. The default value of -1 indicates down to the end of the string.
startThe index of the first character to take from value. The default value of 0 indicates the first character of the string.
See also
setValue().
setUnixValue().

◆ setExtension()

void IlPathName::setExtension ( const IlString extension,
int  end = -1,
int  start = 0 
)

Sets the extension part of this IlPathName.

Parameters
extensionThe extension to set to the current object.
endThe index of the last character to use from extension. The default value of -1 indicates down to the end of the string.
startThe index of the first character to take from extension. The default value of 0 indicates the first character to use from extension.
See also
getExtension().

◆ setFileName()

void IlPathName::setFileName ( const IlString filename,
int  end = -1,
int  start = 0 
)

Sets the file name part of this IlPathName.

Parameters
filenameThe filename to set to the current object.
endThe index of the last character to use from filename. The default value of -1 indicates down to the end of the string.
startThe index of the first character to take from filename. The default value of 0 indicates the first character to use from filename.
See also
getFileName().

◆ setUnixDirectory()

void IlPathName::setUnixDirectory ( const IlString directory,
int  end = -1,
int  start = 0 
)

Sets the directory part of this IlPathName.

Parameters
directoryThe directory to set to the current object. This must be in the Unix syntax.
endThe index of the last character to use from directory. The default value of -1 indicates down to the end of the string.
startThe index of the first character to take from directory. The default value of 0 indicates the first character of the string.
See also
getUnixDirectory().
setDirectory(), setDosDirectory().

◆ setUnixDirName()

void IlPathName::setUnixDirName ( const IlString dirName,
int  end = -1,
int  start = 0 
)

Sets the dirname part of this IlPathName.

The dirname of a path name is the concatenation of the path name device and directory parts.

Parameters
dirNameThe device and directory to set to the current object. This must be in the Unix syntax.
endThe index of the last character to use from dirName. The default value of -1 indicates down to the end of the string.
startThe index of the first character to take from dirName. The default value of 0 indicates the first character of the string.
See also
setDirName(), setDosDirName().

◆ setUnixValue()

void IlPathName::setUnixValue ( const IlString value,
int  end = -1,
int  start = 0 
)

Sets the whole value of this IlPathName.

Parameters
valueThe new value to set to the current object. This must be in the Unix syntax.
endThe index of the last character to use from value. The default value of -1 indicates down to the end of the string.
startThe index of the first character to take from value. The default value of 0 indicates the first character of the string.
See also
setValue().
setDosValue().

◆ setValue()

void IlPathName::setValue ( const IlString value,
int  end = -1,
IlPathType  type = SystemPathType,
int  start = 0 
)

Sets the whole value of this IlPathName.

Parameters
valueThe new value to set to the current object.
endThe index of the last character to use from value. The default value of -1 indicates down to the end of the string.
typeThe syntax (system, Unix or DOS) that the provided string is using. The default is SystemPathType.
startThe index of the first character to take from value. The default value of 0 indicates the first character of the string.
See also
getValue().
IlPathName::getString
IlString getString(IlPathType type=SystemPathType) const
Returns the whole path name stored in this IlPathname.
IlPathName::SystemPathType
@ SystemPathType
The syntax of the actual system.
Definition: pathname.h:104