rwlogo

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 IlString &path)
 Initializes an IlPathname object from an IlString. More...
 
 IlPathName (const char *path)
 Initializes an IlPathname object from a C-style string. More...
 
 IlPathName (const IlPathName &path)
 Copy constructor. 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 IlPathName &path)
 Appends a path name to this IlPathName. More...
 
IlPathNamemerge (const IlString &path)
 Appends a path name to this IlPathName. More...
 
IlPathNamemerge (const char *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 IlPathName &path) const
 Join operator. More...
 
IlPathName operator+ (const IlString &path) const
 Join operator. More...
 
IlPathName operator+ (const char *path) const
 Join operator. 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 *path)
 Appends a path name to this IlPathName. More...
 
IlPathNameoperator= (const IlPathName &pathname)
 Assignment operator. More...
 
IlPathNameoperator= (const IlString &pathname)
 Assignment operator. More...
 
IlPathNameoperator= (const char *pathname)
 Assignment operator. More...
 
IlBoolean operator== (const IlPathName &path) const
 The equality operator. More...
 
IlPathNameprepend (const IlPathName &path)
 
IlPathNameprepend (const IlString &path)
 
IlPathNameprepend (const char *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 exit.

A complete path name is made of:

IlPathName objects can be absolute or relative paths.

Member Enumeration Documentation

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 ('\').

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::IlPathName ( )

Initializes an empty IlPathname object.

All the fields are empty.

See Also
IlPathName(const IlString&).
IlPathName(const char*).
IlPathName(const IlPathName&).
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.

Example, on a Windows machine:

IlPathName pathname1("/Dev/Rogue Wave/Views/file.ilv");
IlString path1(pathname1);
// On a Windows system, path1 is "\Dev\Rogue Wave\Views\file.ilv"
IlPathName pathname2("/Dev//Rogue Wave/Views/file.ilv");
IlString path2(pathname2);
// On a Windows system, path2 is "\Dev\Rogue Wave\Views\file.ilv":
// the double slash character was replaced by a single one.
IlPathName pathname3("/Dev//Rogue Wave/DB Link/../Views/file.ilv");
IlString path3(pathname3);
// On a Windows system, path3 is "\Dev\Rogue Wave\Views\file.ilv":
// Note how the fragment 'DB Link/../' was properly removed.
IlPathName pathname4("/Dev//Rogue Wave/./Views/file.ilv");
IlString path4(pathname4);
// On a Windows system, path4 is "\Dev\Rogue Wave\Views\file.ilv":
// The useless fragment './' was removed.
Parameters
pathThe path that initializes this object.
See Also
IlPathName().
IlPathName(const char*).
IlPathName(const IlPathName&).
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::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

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:

IlPathName pathname("D:\\Dev\\Rogue Wave\\");
pathname.addDirectory("a\\b\\");
// pathname is now "D:\Dev\Rogue Wave\a\b\"
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().
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().
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().
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().
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().
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().
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:

IlPathName pathname1("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
pathname1.computeAllButLastSubDirectory();
// pathname1 is 'D:\Dev\Rogue Wave\'
IlPathName pathname2("C:\\");
pathname2.computeAllButLastSubDirectory();
// pathname2 is 'C:\'
Returns
The resulting IlPathName object.
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:

IlPathName path1("D:\\Dev\\Rogue Wave\\Views\\somefile.txt");
IlPathName other1("D:\\Dev\\Rogue Wave\\DB Link\\somefile.txt");
path1.computeDifferLeading(other1);
// path1 is "Views\somefile.txt" (same leading directories)
IlPathName path2("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlPathName other2("C:\\windows\\system32\\xcopy.exe");
path2.computeDifferLeading(other2);
// path2 is unmodified (nothing in common)
Parameters
pathThe path name to compare with.
Returns
The current, modified object.
See Also
computeDifferTrailing().
computeSameLeading().
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:

IlPathName path1("D:\\Dev\\Rogue Wave\\Views\\somefile.txt");
IlPathName other1("D:\\Dev\\Rogue Wave\\DB Link\\somefile.txt");
path1.computeDifferTrailing(other1);
// path1 is "D:\Dev\Rogue Wave\Views\" (same end)
IlPathName path2("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlPathName other2("C:\\windows\\system32\\xcopy.exe");
path2.computeDifferTrailing(other2);
// path2 is unmodified (nothing in common)
Parameters
pathThe path name to compare with.
Returns
The current, modified object.
See Also
computeDifferLeading().
computeSameTrailing().
IlPathName& IlPathName::computeFirstSubDirectory ( )

Query the top-most directory of this IlPathName.

Example, on a Windows machine:

IlPathName path1("D:\\Dev\\Rogue Wave\\Views\\somefile.txt");
path1.computeFirstSubDirectory();
// path1 is "D:\Dev\"
IlPathName path2("filename.txt");
path2.computeFirstSubDirectory();
// path2 is ".\" (no root directory common)
Returns
The current, modified object.
See Also
computeLastSubDirectory().
IlPathName& IlPathName::computeLastSubDirectory ( )

Query the bottom-most directory of this IlPathName.

Example, on a Windows machine:

IlPathName path1("D:\\Dev\\Rogue Wave\\Views\\somefile.txt");
path1.computeLastSubDirectory();
// path1 is "Views\"
IlPathName path2("filename.txt");
path2.computeLastSubDirectory();
// path2 is ".\" (no directory)
Returns
The current, modified object.
See Also
computeFirstSubDirectory().
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().
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:

IlPathName pathname1("D:\\Dev\\Rogue Wave\\");
IlPathName relative1("D:\\Dev\\");
pathname1.computeRelativePath(relative1);
// pathname1 is 'Rogue Wave\'
IlPathName pathname2("D:\\Dev\\Rogue Wave\\");
IlPathName relative2("D:\\Dev\\Rogue Wave\\Views\\data\\");
pathname2.computeRelativePath(relative2);
// pathname2 is '..\..\'
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.
IlPathName& IlPathName::computeSameLeading ( const IlPathName path)

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

Example, on a Windows machine:

IlPathName path1("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlPathName other1("D:\\Dev\\Rogue Wave\\DB Link\\somefile.txt");
path1.computeSameLeading(other1);
// path1 is "D:\Dev\Rogue Wave\"
IlPathName path2("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlPathName other2("C:\\windows\\system32\\xcopy.exe");
path2.computeSameLeading(other2);
// path2 is ".\" (nothing in common)
Parameters
pathThe path name to compare with.
Returns
The current, modified object.
See Also
computeSameTrailing().
computeDifferLeading().
IlPathName& IlPathName::computeSameTrailing ( const IlPathName path)

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

Example, on a Windows machine:

IlPathName path1("D:\\Dev\\Rogue Wave\\Views\\somefile.txt");
IlPathName other1("D:\\Dev\\Rogue Wave\\DB Link\\somefile.txt");
path1.computeSameTrailing(other1);
// path1 is "somefile.txt"
IlPathName path2("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlPathName other2("C:\\windows\\system32\\xcopy.exe");
path2.computeSameTrailing(other2);
// path2 is ".\" (nothing in common)
Parameters
pathThe path name to compare with.
Returns
The current, modified object.
See Also
computeSameLeading().
computeDifferLeading().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
IlBoolean IlPathName::doesExist ( ) const

Tests if this path name physically exists.

Returns
IlTrue if the path name actually exits, physically, and IlFalse otherwise.
See Also
doesExist(const IlString&).
isReadable().
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 exits on the file system and IlFalse otherwise.
See Also
doesExist().
isReadable(const IlString& pathname), isWritable(const IlString&), isExecutable(const IlString&).
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().
void IlPathName::forceDirectory ( )

Transforms to a directory.

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

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.

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:

IlPathName pathname("D:\\Dev\\Rogue Wave\\Views\\myLongFile.extension");
IlString shortPathname(pathname.get83DosValue());
// shortPathname is "D:\Dev\Rogue Wa\Views\myLongFi.ext"
Returns
An SFN-like version of this path name.
See Also
getDosValue(), copy83DosValue().
IlString IlPathName::getBaseName ( ) const

Returns the base file name of this path name.

The Example, on a Windows machine:

IlPathName pathname("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlString baseName(pathname.getBaseName());
// baseName is "file.ilv"
Returns
The base file name of this object.
See Also
setBaseName().
copyBaseName().
getFileName(), getExtension().
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:

IlPathName pathname("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlString drive(pathname.getDevice());
// drive is "D"
Returns
The device part of this object.
See Also
setDevice(), copyDevice().
IlString IlPathName::getDirectory ( IlBoolean  finalSep = IlTrue,
IlPathType  type = SystemPathType 
) const

Returns the directory part of this IlPathname.

Example, on a Windows machine:

IlPathName pathname("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlString directory1(pathname.getDirectory());
// directory1 is "\Dev\Rogue Wave\Views\"
IlString directory2 = pathname.getDirectory(IlFalse,
// directory2 is "/Dev/Rogue Wave/Views"
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().
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:

IlPathName pathname("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlString directory1(pathname.getDirName());
// directory1 is "D:\Dev\Rogue Wave\Views\"
IlString directory2 = pathname.getDirName(IlFalse,
// directory2 is "/Dev/Rogue Wave/Views"
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().
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().
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().
IlString IlPathName::getExtension ( ) const

Returns the extension part of this path name.

Example, on a Windows machine:

IlPathName pathname("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlString extension(pathname.getExtension());
// extension is "ilv"
Returns
The extension part of this object.
See Also
setExtension() getBaseName().
IlString IlPathName::getFileName ( ) const

Returns the file name part of this path name.

Example, on a Windows machine:

IlPathName pathname("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlString filename(pathname.getFileName());
// filename is "file"
Returns
The file name part of this object.
See Also
setFileName(), getBaseName().
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(),
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:

IlPathName pathname("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlString subDirs1(pathname.getSubDirectory(1));
// subDirs1 is "Dev\" (the first directory)
IlString subDirs2(pathname.getSubDirectory(2));
// subDirs2 is "Rogue Wave\" (the second directory)
IlString subDirs3(pathname.getSubDirectory(1, 2));
// subDirs3 is "Dev\Rogue Wave\" (the two first directories)
IlString subDirs4(pathname.getSubDirectory(-2, 2));
// subDirs4 is "Rogue Wave\Views\" (the two last directories)
IlString subDirs5(pathname.getSubDirectory(2, -1));
// subDirs5 is "Rogue Wave\Views\" (everything except the top-most)
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.
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:

IlPathName pathname("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlString part1(pathname.getTruncatedValue(1));
// part1 is "D:...\Views\file.ilv"
IlString part2(pathname.getTruncatedValue(5));
// part2 is "D:\Dev\Rogue Wave\Views\file.ilv"
// (that is, the entire path name value)
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().
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().
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().
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.
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().
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().
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.
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.
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().
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&).
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().
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().
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().
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&).
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.
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().
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.
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().
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&).
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 question mark ('?') that matches any character.

Note: This function uses the Unix conventions:

  • *.* means filename=* and extension=?*.
  • * means filename=* and extension=*.
Parameters
filterThe filter to match this path name against.
Returns
IlTrue if the current path matches filter, and IlFalse otherwise.
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*).
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*).
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&).
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:

IlPathName directory("C:\\");
directory.openDir();
IlPathName pathname;
while (directory.readDir(pathname)) {
// do something with pathname...
}
directory.closeDir();
Returns
IlTrue if the method succeeds and IlFalse if an error occurs.
See Also
readDir(), closeDir(), rewindDir().
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.
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*().
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().
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==().
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:

IlPathName path1("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlPathName append1("\\Dev\\Rogue Wave\\DB Link");
IlPathName join1 = path1 + append1;
// join1 is "\Dev\Rogue Wave\DB Link" because append1 is an absolute path
IlPathName path2("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlPathName append2("data\\map.ilv");
IlPathName join2 = path2 + append2;
// join2 is "D:\Dev\Rogue Wave\Views\data\map.ilv"
IlPathName path3("D:\\Dev\\Rogue Wave\\Views\\file.ilv");
IlPathName append3("..\\DB Link\\somefile.txt");
IlPathName join3 = path3 + append3;
// join3 is "D:\Dev\Rogue Wave\DB Link\somefile.txt"
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&).
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&).
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*).
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&).
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&).
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*).
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*).
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*).
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&).
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!=().
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*).
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*).
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&).
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().

© Copyright 2015, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.