Rogue Wave Views Foundation Package API Reference Guide |
Rogue Wave Views Documentation Home |
Class that manages path names in a portable way. More...
#include <ilog/pathname.h>
Public Types |
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... | |
IlPathName & | computeAllButLastSubDirectory () |
Replaces this IlPathName by its directory part, except the last level. More... | |
IlPathName & | computeDifferLeading (const IlPathName &path) |
IlPathName & | computeDifferTrailing (const IlPathName &path) |
IlPathName & | computeFirstSubDirectory () |
Query the top-most directory of this IlPathName . More... | |
IlPathName & | computeLastSubDirectory () |
Query the bottom-most directory of this IlPathName . More... | |
int | computeLevelNumber () const |
Computes the number of levels of the current path. More... | |
IlPathName & | computeRelativePath (const IlPathName &path) |
Computes the relative path of the current path name, relative to another IlPathName . More... | |
IlPathName & | computeSameLeading (const IlPathName &path) |
IlPathName & | computeSameTrailing (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... | |
IlPathName & | merge (const IlPathName &path) |
Appends a path name to this IlPathName . More... | |
IlPathName & | merge (const IlString &path) |
Appends a path name to this IlPathName . More... | |
IlPathName & | merge (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... | |
IlPathName & | operator+= (const IlPathName &path) |
Appends a path name to this IlPathName . More... | |
IlPathName & | operator+= (const IlString &path) |
Appends a path name to this IlPathName . More... | |
IlPathName & | operator+= (const char *path) |
Appends a path name to this IlPathName . More... | |
IlPathName & | operator= (const IlPathName &pathname) |
Assignment operator. More... | |
IlPathName & | operator= (const IlString &pathname) |
Assignment operator. More... | |
IlPathName & | operator= (const char *pathname) |
Assignment operator. More... | |
IlBoolean | operator== (const IlPathName &path) const |
The equality operator. More... | |
IlPathName & | prepend (const IlPathName &path) |
IlPathName & | prepend (const IlString &path) |
IlPathName & | prepend (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... | |
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:
C:
. IlPathName
objects can be absolute or relative paths.
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.
enum IlPathName::SortMode |
Path names sorting options.
Higher-level objets can sort IlPathName
objects. This enumeration allows for customizing how this sort is performed.
IlPathName::IlPathName | ( | ) |
Initializes an empty IlPathname
object.
All the fields are empty.
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:
path | The path that initializes this object. |
IlPathName::IlPathName | ( | const char * | path | ) |
Initializes an IlPathname
object from a C-style string.
The string is copied.
path | The path that initializes this object. |
IlPathName::IlPathName | ( | const IlPathName & | path | ) |
Copy constructor.
path | The source path name that is copied. |
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:
directory | The directory to append to the current path name. |
end | The index of the last character to use from directory. The default value of -1 indicates down to the end of the string. |
type | The syntax (system, Unix or DOS) that the provided string is using. The default is SystemPathType . |
start | The index of the first character to take from directory. The default value of 0 indicates the first character of the string. |
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.
directory | The directory to append to the current path name. |
end | The index of the last character to use from directory. The default value of -1 indicates down to the end of the string. |
start | The index of the first character to take from directory. The default value of 0 indicates the first character of the string. |
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.
directory | The directory to append to the current path name. |
end | The index of the last character to use from directory. The default value of -1 indicates down to the end of the string. |
start | The index of the first character to take from directory. The default value of 0 indicates the first character of the string. |
addDirectory()
, addDosDirectory()
. getUnixDirectory()
. IlBoolean IlPathName::changeCurrentDirectory | ( | ) | const |
Changes the current directory to this path name.
IlFalse
if an error occurs and IlTrue
if the operation is successful. 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.
newMode | The new mode that is set to the object referenced by this path name object, as defined in the "C" function chmod . |
IlTrue
if the method succeeds and IlFalse
if an error occurs. 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.
IlTrue
if the method succeeds and IlFalse
if an error occurs. 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& 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:
path | The path name to compare with. |
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:
path | The path name to compare with. |
computeDifferLeading()
. computeSameTrailing()
. IlPathName& IlPathName::computeFirstSubDirectory | ( | ) |
Query the top-most directory of this IlPathName
.
Example, on a Windows machine:
computeLastSubDirectory
(). IlPathName& IlPathName::computeLastSubDirectory | ( | ) |
Query the bottom-most directory of this IlPathName
.
Example, on a Windows machine:
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.
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:
path | The path name to compute the relative path from. Note that this must be a directory (its value should end with a directory separator). |
IlPathName& IlPathName::computeSameLeading | ( | const IlPathName & | path | ) |
Computes the part that is common at the beginning of two path names.
Example, on a Windows machine:
path | The path name to compare with. |
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:
path | The path name to compare with. |
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.
delete[]
operator when it is not used any more. new[]
, that contains an SFN-like version of this path name. get83DosValue()
, getDosValue()
. char* IlPathName::copyBaseName | ( | ) | const |
Returns a copy of the file name and the extension parts of this IlPathname
.
delete[]
operator when it is not used any more. new[]
, that contains the file name and the extension parts of this path name. getBaseName()
. char* IlPathName::copyDevice | ( | ) | const |
Returns a copy of the device part of this IlPathname
.
delete[]
operator when it is not used any more. new[]
, that contains the device part of this path name. getDevice()
. char* IlPathName::copyDirectory | ( | IlBoolean | finalSep = IlTrue , |
IlPathType | type = SystemPathType |
||
) | const |
Returns a copy of the directory part of this IlPathname
.
delete[]
operator when it is not used any more. finalSep | If IlTrue (which is the default), a final directory separator is added to the returned value. |
type | The syntax (system, Unix or DOS) that you want returned. The default is SystemPathType . |
new[]
, that contains the device part of this path name. 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.
delete[]
operator when it is not used any more. finalSep | If IlTrue (which is the default), a final directory separator is added to the returned value. |
type | The syntax (system, Unix or DOS) that you want returned. The default is SystemPathType . |
new[]
, that contains the concatenation of the device and the directory parts of this path name. getDirName()
. Returns a copy of the directory part of this IlPathname
in the DOS syntax.
This method is equivalent to copyDirectory(finalSep, DosPathType);
.
delete[]
operator when it is not used any more. finalSep | If IlTrue (which is the default), a final backslash character is added to the returned value. |
new[]
, that contains the directory part of this path name. 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);
.
delete[]
operator when it is not used any more. new[]
, that contains the representation of this path name. copyValue()
, getDosValue()
. char* IlPathName::copyExtension | ( | ) | const |
Returns a copy of the extension part of this IlPathname
.
delete[]
operator when it is not used any more. new[]
, that contains the extension part of this path name. getExtension()
. char* IlPathName::copyFileName | ( | ) | const |
Returns a copy of the file name part of this IlPathname
.
delete[]
operator when it is not used any more. new[]
, that contains the file name of this path name. getFileName()
. Returns a copy of the directory part of this IlPathname
in the Unix syntax.
This method is equivalent to copyDirectory(finalSep, UnixPathType);
.
delete[]
operator when it is not used any more. finalSep | If IlTrue (which is the default), a final slash character is added to the returned value. |
new[]
, that contains the directory part of this path name. 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);
.
delete[]
operator when it is not used any more. new[]
, that contains the representation of this path name. 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.
delete[]
operator when it is not used any more. type | The syntax (system, Unix or DOS) that you want returned. The default is SystemPathType . |
new[]
, that contains the concatenation of the the whole contentof this path name. getString()
. 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
.
mode | The 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. |
recursive | If 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. |
IlTrue
if the method succeeds and IlFalse
if an error occurs. remove()
, changeMode()
. IlBoolean IlPathName::doesExist | ( | ) | const |
Tests if this path name physically exists.
IlTrue
if the path name actually exits, physically, and IlFalse
otherwise. doesExist(const IlString&)
. isReadable()
. Tests if a path name physically exists.
pathname | The path name to test. This must be in the system syntax. |
IlTrue
if the referenced path actually exits on the file system and IlFalse
otherwise. 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.
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:
getDosValue()
, copy83DosValue()
. IlString IlPathName::getBaseName | ( | ) | const |
Returns the base file name of this path name.
The Example, on a Windows machine:
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:
setDevice()
, copyDevice()
. IlString IlPathName::getDirectory | ( | IlBoolean | finalSep = IlTrue , |
IlPathType | type = SystemPathType |
||
) | const |
Returns the directory part of this IlPathname
.
Example, on a Windows machine:
finalSep | If IlTrue (which is the default), a final directory separator is added to the returned value. |
type | The syntax (system, Unix or DOS) that you want returned. The default is SystemPathType . |
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:
finalSep | If IlTrue (which is the default), a final directory separator is added to the returned value. |
type | The syntax (system, Unix or DOS) that you want returned. The default is SystemPathType . |
Returns the directory part of this IlPathname
, with the DOS syntax.
finalSep | If IlTrue , the returned string ends with a backslash ('\' ) character. |
'\'
). 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 ".\\"
.
'\'
). getString()
. IlString IlPathName::getExtension | ( | ) | const |
Returns the extension part of this path name.
Example, on a Windows machine:
setExtension()
getBaseName()
. IlString IlPathName::getFileName | ( | ) | const |
Returns the file name part of this path name.
Example, on a Windows machine:
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.
type | The syntax (system, Unix or DOS) that you want returned. The default is SystemPathType . |
setValue()
. copyValue()
. getFileName()
, getExtension()
, getDevice()
, getDirectory()
, 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:
level | The 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). |
count | The 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. |
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:
level | How many sub-directories the result string contains. The default value is 2. |
level
sub-directories. getString()
. Returns the directory part of this IlPathname
, with the Unix syntax.
finalSep | If IlTrue , the returned string ends with a slash ('/' ) character. |
'/'
). 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 "./"
.
'/'
). getString()
. IlBoolean IlPathName::isAbsolute | ( | ) | const |
Tests if this path name is an absolute path.
IlTrue
if this object is an absolute path and IlFalse
otherwise. IlBoolean IlPathName::isCurrentDirectory | ( | ) | const |
Tests if this object is the current directory.
IlTrue
if the path name is a directory and the directory part is .
, and IlFalse
otherwise. 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.
IlTrue
if this object is a directory and IlFalse
otherwise. isSubDirectory()
. IlBoolean IlPathName::isEmpty | ( | ) | const |
Tests if the current path name is empty.
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.
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.
IlTrue
if the path name refers to an object that is executable, and IlFalse
otherwise.Tests if a path name has the execution permission set for the current user.
pathname | The path name to test. This must be in the system syntax. |
IlTrue
if the referenced path exists and has the execution permission for the current user and IlFalse
otherwise. IlBoolean IlPathName::isInCurrentDirectory | ( | ) | const |
Tests if this object is in the current directory.
IlTrue
if the directory part is .
(the current directory), and IlFalse
otherwise. 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.
path | The path name object to compare the last modification with. |
IlTrue
if the method succeeds and IlFalse
if an error occurs. queryModificationTime()
. IlBoolean IlPathName::isReadable | ( | ) | const |
Tests if this path name refers to an object that can be read from.
IlTrue
if the path name refers to an object that can be read, and IlFalse
otherwise. Tests if a path name has the read permission set for the current user.
pathname | The path name to test. This must be in the system syntax. |
IlTrue
if the referenced path exists and has the read permission for the current user and IlFalse
otherwise. IlBoolean IlPathName::isSensitive | ( | ) | const |
Returns IlTrue
if the file system where this path name may be stored is case sensitive.
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
.
path | The path that is tested upon. |
IlTrue
if this object is a sub-directory of path, and IlFalse
otherwise. isInCurrentDirectory()
. IlBoolean IlPathName::isSystemDirectory | ( | ) | const |
Tests if this object is a physical directory.
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.
IlTrue
if the path name refers to an object that can be written, and IlFalse
otherwise. Tests if a path name has the write permission set for the current user.
pathname | The path name to test. This must be in the system syntax. |
IlTrue
if the referenced path exists and has the write permission for the current user and IlFalse
otherwise. 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=*
. filter | The filter to match this path name against. |
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)
.
path | The path name to append to the current object. |
IlPathName& IlPathName::merge | ( | const IlString & | path | ) |
Appends a path name to this IlPathName
.
This method is equivalent to operator+(const IlString& path)
.
path | The path name to append to the current object. |
IlPathName& IlPathName::merge | ( | const char * | path | ) |
Appends a path name to this IlPathName
.
This method is equivalent to operator+(const IlString& path)
.
path | The path name to append to the current object. |
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:
IlTrue
if the method succeeds and IlFalse
if an error occurs. readDir()
, closeDir()
, rewindDir()
. IlPathName::operator const char * | ( | ) | const |
Returns the internal representation of the current object into a C-style string.
IlPathName
object. 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:
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.
IlTrue
if this object is empty, IlFalse
otherwise. isEmpty()
. IlBoolean IlPathName::operator!= | ( | const IlPathName & | path | ) | const |
The inequality operator.
This operator tests whether this object has a different value than another IlPathName
.
path | The object to compare this object to. |
IlTrue
if objects are not equal and IlFalse
otherwise. operator==()
. IlPathName IlPathName::operator+ | ( | const IlPathName & | path | ) | const |
Join operator.
This operator appends a IlPathName
to the current object.
Example, on a Windows machine:
path | The path name to append to the current object. |
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.
path | The path name to append to the current object. |
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.
path | The path name to append to the current object. This string is copied by this operator. |
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.
path | The path name to append to the current object. |
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.
path | The path name to append to the current object. This must be in the system syntax. |
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.
path | The path name to append to the current object. This must be in the system syntax. This string is copied internally. |
IlPathName& IlPathName::operator= | ( | const IlPathName & | pathname | ) |
Assignment operator.
Copies pathname into the current object.
pathname | The object that is copied. |
IlPathName& IlPathName::operator= | ( | const IlString & | pathname | ) |
Assignment operator.
Assigns pathname to this object.
pathname | The value that is assigned. |
IlPathName& IlPathName::operator= | ( | const char * | pathname | ) |
Assignment operator.
Assigns pathname to this object.
pathname | The value that is assigned. |
IlBoolean IlPathName::operator== | ( | const IlPathName & | path | ) | const |
The equality operator.
This operator tests whether this object has the same value as another IlPathName
.
path | The object to compare this object to. |
IlTrue
if both objects are equal and IlFalse
otherwise. operator!=()
. IlPathName& IlPathName::prepend | ( | const IlPathName & | path | ) |
Prepends a path name to this IlPathName
.
This method
path | The path name to prepend to the current object. |
IlPathName& IlPathName::prepend | ( | const IlString & | path | ) |
Prepends a path name to this IlPathName
.
path | The path name to prepend to the current object. This must be in the syntax of the system. |
IlPathName& IlPathName::prepend | ( | const char * | path | ) |
Prepends a path name to this IlPathName
.
path | The path name to prepend to the current object. This string is copied, and must be in the syntax of the system. |
IlBoolean IlPathName::queryAccessTime | ( | std::time_t & | time | ) | const |
Queries the last access time of the object referenced by this IlPathName
.
time | Is set to the last access time of the file system entity referenced by this path name object. |
IlTrue
if the method succeeds and IlFalse
if an error occurs. 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.
time | Is set to the time when the file system entity referenced by this path name object was last renamed (or created, on Windows). |
IlTrue
if the method succeeds and IlFalse
if an error occurs. 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.
drive | An 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. |
|
static |
Queries the current directory.
This method copies the absolute path name of the current directory into currentDir.
currentDir | The buffer where the path name of the current directory is stored. |
size | The 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. |
drive | An 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. |
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
.
mode | Is set to the permission bits of the file system entity referenced by this path name object. |
IlTrue
if the method succeeds and IlFalse
if an error occurs. changeMode()
. IlBoolean IlPathName::queryModificationTime | ( | std::time_t & | time | ) | const |
Queries the time the object referenced by this IlPathName
was last modified.
time | Is set to the last modification time of the file system entity referenced by this path name object. |
IlTrue
if the method succeeds and IlFalse
if an error occurs. 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.
result | On exit, holds the path name that was read from this opened directory path name. |
IlTrue
if the method succeeds and IlFalse
if an error occurs. You should stop reading entries when this method returns IlFalse
. openDir()
, closeDir()
, rewindDir()
. Physically removes the file or directory corresponding to this IlPathName
.
recursive | If 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. |
IlTrue
if the method succeeds and IlFalse
if an error occurs. 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.
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.
basename | The base name to set to the current object. |
end | The index of the last character to use from basename. The default value of -1 indicates down to the end of the string. |
start | The index of the first character to take from basename. The default value of 0 indicates the first character of the string. |
getBaseName()
. void IlPathName::setDevice | ( | const IlString & | device, |
int | end = -1 , |
||
int | start = 0 |
||
) |
Sets the device part of this IlPathName
.
device | The device to set to the current object. |
end | The index of the last character to use from device. The default value of -1 indicates down to the end of the string. |
start | The index of the first character to take from device. The default value of 0 indicates the first character of the string. |
getDevice()
. void IlPathName::setDirectory | ( | const IlString & | directory, |
int | end = -1 , |
||
IlPathType | type = SystemPathType , |
||
int | start = 0 |
||
) |
Sets the directory part of this IlPathName
.
directory | The directory to set to the current object. |
end | The index of the last character to use from directory. The default value of -1 indicates down to the end of the string. |
type | The syntax (system, Unix or DOS) that the provided string is using. The default is SystemPathType . |
start | The index of the first character to take from directory. The default value of 0 indicates the first character of the string. |
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.
dirName | The device and directory to set to the current object. |
end | The index of the last character to use from dirName. The default value of -1 indicates down to the end of the string. |
type | The syntax (system, Unix or DOS) that the provided string is using. The default is SystemPathType . |
start | The index of the first character to take from dirName. The default value of 0 indicates the first character of the string. |
getDirName()
. setDevice()
, setDirectory()
. void IlPathName::setDosDirectory | ( | const IlString & | directory, |
int | end = -1 , |
||
int | start = 0 |
||
) |
Sets the directory part of this IlPathName
.
directory | The directory to set to the current object. This must be in the DOS syntax. |
end | The index of the last character to use from directory. The default value of -1 indicates down to the end of the string. |
start | The index of the first character to take from directory. The default value of 0 indicates the first character of the string. |
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.
dirName | The device and directory to set to the current object. This must be in the DOS syntax. |
end | The index of the last character to use from dirName. The default value of -1 indicates down to the end of the string. |
start | The index of the first character to take from dirName. The default value of 0 indicates the first character of the string. |
setDirName()
, setUnixDirName()
. void IlPathName::setDosValue | ( | const IlString & | value, |
int | end = -1 , |
||
int | start = 0 |
||
) |
Sets the whole value of this IlPathName
.
value | The new value to set to the current object. This must be in the DOS syntax. |
end | The index of the last character to use from value. The default value of -1 indicates down to the end of the string. |
start | The index of the first character to take from value. The default value of 0 indicates the first character of the string. |
setValue()
. setUnixValue()
. void IlPathName::setExtension | ( | const IlString & | extension, |
int | end = -1 , |
||
int | start = 0 |
||
) |
Sets the extension part of this IlPathName
.
extension | The extension to set to the current object. |
end | The index of the last character to use from extension. The default value of -1 indicates down to the end of the string. |
start | The index of the first character to take from extension. The default value of 0 indicates the first character to use from extension. |
getExtension()
. void IlPathName::setFileName | ( | const IlString & | filename, |
int | end = -1 , |
||
int | start = 0 |
||
) |
Sets the file name part of this IlPathName
.
filename | The filename to set to the current object. |
end | The index of the last character to use from filename. The default value of -1 indicates down to the end of the string. |
start | The index of the first character to take from filename. The default value of 0 indicates the first character to use from filename. |
getFileName()
. void IlPathName::setUnixDirectory | ( | const IlString & | directory, |
int | end = -1 , |
||
int | start = 0 |
||
) |
Sets the directory part of this IlPathName
.
directory | The directory to set to the current object. This must be in the Unix syntax. |
end | The index of the last character to use from directory. The default value of -1 indicates down to the end of the string. |
start | The index of the first character to take from directory. The default value of 0 indicates the first character of the string. |
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.
dirName | The device and directory to set to the current object. This must be in the Unix syntax. |
end | The index of the last character to use from dirName. The default value of -1 indicates down to the end of the string. |
start | The index of the first character to take from dirName. The default value of 0 indicates the first character of the string. |
setDirName()
, setDosDirName()
. void IlPathName::setUnixValue | ( | const IlString & | value, |
int | end = -1 , |
||
int | start = 0 |
||
) |
Sets the whole value of this IlPathName
.
value | The new value to set to the current object. This must be in the Unix syntax. |
end | The index of the last character to use from value. The default value of -1 indicates down to the end of the string. |
start | The index of the first character to take from value. The default value of 0 indicates the first character of the string. |
setValue()
. setDosValue()
. void IlPathName::setValue | ( | const IlString & | value, |
int | end = -1 , |
||
IlPathType | type = SystemPathType , |
||
int | start = 0 |
||
) |
Sets the whole value of this IlPathName
.
value | The new value to set to the current object. |
end | The index of the last character to use from value. The default value of -1 indicates down to the end of the string. |
type | The syntax (system, Unix or DOS) that the provided string is using. The default is SystemPathType . |
start | The index of the first character to take from value. The default value of 0 indicates the first character of the string. |
getValue()
. © Copyright 2016, 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.