OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    OSD_Path Class Reference

    #include <OSD_Path.hxx>

    Public Member Functions

     OSD_Path ()
     Creates a Path object initialized to an empty string. i.e. current directory.
     OSD_Path (const TCollection_AsciiString &aDependentName, const OSD_SysType aSysType=OSD_Default)
     Creates a Path object initialized by dependent path. ex: OSD_Path me ("/usr/bin/myprog.sh",OSD_UnixBSD);.
     OSD_Path (const TCollection_AsciiString &aNode, const TCollection_AsciiString &aUsername, const TCollection_AsciiString &aPassword, const TCollection_AsciiString &aDisk, const TCollection_AsciiString &aTrek, const TCollection_AsciiString &aName, const TCollection_AsciiString &anExtension)
     Initializes a system independent path. By default , the Path conversion will be assumed using currently used system. A special syntax is used to specify a "aTrek" in an independent manner : a "|" represents directory separator a "^" means directory above (father) examples: "|usr|bin" - On UNIX -> "/usr/bin".
    void Values (TCollection_AsciiString &aNode, TCollection_AsciiString &aUsername, TCollection_AsciiString &aPassword, TCollection_AsciiString &aDisk, TCollection_AsciiString &aTrek, TCollection_AsciiString &aName, TCollection_AsciiString &anExtension) const
     Gets each component of a path.
    void SetValues (const TCollection_AsciiString &aNode, const TCollection_AsciiString &aUsername, const TCollection_AsciiString &aPassword, const TCollection_AsciiString &aDisk, const TCollection_AsciiString &aTrek, const TCollection_AsciiString &aName, const TCollection_AsciiString &anExtension)
     Sets each component of a path.
    void SystemName (TCollection_AsciiString &FullName, const OSD_SysType aType=OSD_Default) const
     Returns system dependent path <aType> is one among Unix,VMS ... This function is not private because you may need to display system dependent path on a front-end. It can be useful when communicating with another system. For instance when you want to communicate between VMS and Unix to transfer files, or to do a remote procedure call using files. example : OSD_Path myPath ("sparc4", "sga", "secret_passwd", "$5$dkb100","|users|examples"); Internal ( Dependent_name ); On UNIX sga"secret_passwd"@sparc4:/users/examples On VMS sparc4"sga secret_passwd"::$5$dkb100:[users.examples] Sets each component of a Path giving its system dependent name.
    void ExpandedName (TCollection_AsciiString &aName)
     Returns system dependent path resolving logical symbols.
    void UpTrek ()
     This removes the last directory name in <aTrek> and returns result. ex: me = "|usr|bin|todo.sh" me.UpTrek() gives me = "|usr|todo.sh" if <me> contains "|", me.UpTrek() will give again "|" without any error.
    void DownTrek (const TCollection_AsciiString &aName)
     This appends a directory name into the Trek. ex: me = "|usr|todo.sh" me.DownTrek("bin") gives me = "|usr|bin|todo.sh".
    int TrekLength () const
     Returns number of components in Trek of <me>. ex: me = "|usr|sys|etc|bin" me.TrekLength() returns 4.
    void RemoveATrek (const int where)
     This removes a component of Trek in <me> at position <where>. The first component of Trek is numbered 1. ex: me = "|usr|bin|" me.RemoveATrek(1) gives me = "|bin|" To avoid a 'NumericError' because of a bad <where>, use TrekLength() to know number of components of Trek in <me>.
    void RemoveATrek (const TCollection_AsciiString &aName)
     This removes <aName> from <me> in Trek. No error is raised if <aName> is not in <me>. ex: me = "|usr|sys|etc|doc" me.RemoveATrek("sys") gives me = "|usr|etc|doc".
    TCollection_AsciiString TrekValue (const int where) const
     Returns component of Trek in <me> at position <where>. ex: me = "|usr|bin|sys|" me.TrekValue(2) returns "bin".
    void InsertATrek (const TCollection_AsciiString &aName, const int where)
     This inserts <aName> at position <where> into Trek of <me>. ex: me = "|usr|etc|" me.InsertATrek("sys",2) gives me = "|usr|sys|etc".
    TCollection_AsciiString Node () const
     Returns Node of <me>.
    TCollection_AsciiString UserName () const
     Returns UserName of <me>.
    TCollection_AsciiString Password () const
     Returns Password of <me>.
    TCollection_AsciiString Disk () const
     Returns Disk of <me>.
    TCollection_AsciiString Trek () const
     Returns Trek of <me>.
    TCollection_AsciiString Name () const
     Returns file name of <me>. If <me> hasn't been initialized, it returns an empty AsciiString.
    TCollection_AsciiString Extension () const
     Returns my extension name. This returns an empty string if path contains no file name.
    void SetNode (const TCollection_AsciiString &aName)
     Sets Node of <me>.
    void SetUserName (const TCollection_AsciiString &aName)
     Sets UserName of <me>.
    void SetPassword (const TCollection_AsciiString &aName)
     Sets Password of <me>.
    void SetDisk (const TCollection_AsciiString &aName)
     Sets Disk of <me>.
    void SetTrek (const TCollection_AsciiString &aName)
     Sets Trek of <me>.
    void SetName (const TCollection_AsciiString &aName)
     Sets file name of <me>. If <me> hasn't been initialized, it returns an empty AsciiString.
    void SetExtension (const TCollection_AsciiString &aName)
     Sets my extension name.
    bool LocateExecFile (OSD_Path &aPath)
     Finds the full path of an executable file, like the "which" Unix utility. Uses the path environment variable. Returns False if executable file not found.

    Static Public Member Functions

    static bool IsValid (const TCollection_AsciiString &theDependentName, const OSD_SysType theSysType=OSD_Default)
     Returns TRUE if <theDependentName> is valid for this SysType.
    static TCollection_AsciiString RelativePath (const TCollection_AsciiString &DirPath, const TCollection_AsciiString &AbsFilePath)
     Returns the relative file path between the absolute directory path <DirPath> and the absolute file path <AbsFilePath>. If <DirPath> starts with "/", paths are handled as on Unix, if it starts with a letter followed by ":", as on WNT. In particular on WNT directory names are not key sensitive. If handling fails, an empty string is returned.
    static TCollection_AsciiString AbsolutePath (const TCollection_AsciiString &DirPath, const TCollection_AsciiString &RelFilePath)
     Returns the absolute file path from the absolute directory path <DirPath> and the relative file path returned by RelativePath(). If the RelFilePath is an absolute path, it is returned and the directory path is ignored. If handling fails, an empty string is returned.
    static void FolderAndFileFromPath (const TCollection_AsciiString &theFilePath, TCollection_AsciiString &theFolder, TCollection_AsciiString &theFileName)
     Split absolute filepath into folder path and file name. Example: IN theFilePath ='/media/cdrom/image.jpg' OUT theFolder ='/media/cdrom/' OUT theFileName ='image.jpg'.
    static void FileNameAndExtension (const TCollection_AsciiString &theFilePath, TCollection_AsciiString &theName, TCollection_AsciiString &theExtension)
     Return file extension from the name in lower case. Extension is expected to be within 20-symbols length, and determined as file name tail after last dot. Example: IN theFilePath ='Image.sbs.JPG' OUT theName ='Image.sbs' OUT theFileName ='jpg'.
    static bool IsDosPath (const char *thePath)
     Detect absolute DOS-path also used in Windows. The total path length is limited to 256 characters. Sample path: C:\folder\file.
    static bool IsNtExtendedPath (const char *thePath)
     Detect extended-length NT path (can be only absolute). Approximate maximum path is 32767 characters. Sample path: \?\D:\very long path File I/O functions in the Windows API convert "/" to "\" as part of converting the name to an NT-style name, except when using the "\?" prefix.
    static bool IsUncPath (const char *thePath)
     UNC is a naming convention used primarily to specify and map network drives in Microsoft Windows. Sample path: \server\share\file.
    static bool IsUncExtendedPath (const char *thePath)
     Detect extended-length UNC path. Sample path: \?\UNC\server\share.
    static bool IsUnixPath (const char *thePath)
     Detect absolute UNIX-path. Sample path: /media/cdrom/file.
    static bool IsContentProtocolPath (const char *thePath)
     Detect special URLs on Android platform. Sample path: content://filename.
    static bool IsRemoteProtocolPath (const char *thePath)
     Detect remote protocol path (http / ftp / ...). Actually shouldn't be remote... Sample path: http://domain/path/file.
    static bool IsRelativePath (const char *thePath)
     Method to recognize path is absolute or not. Detection is based on path syntax - no any filesystem / network access performed.
    static bool IsAbsolutePath (const char *thePath)
     Method to recognize path is absolute or not. Detection is based on path syntax - no any filesystem / network access performed.

    Constructor & Destructor Documentation

    ◆ OSD_Path() [1/3]

    OSD_Path::OSD_Path ( )

    Creates a Path object initialized to an empty string. i.e. current directory.

    ◆ OSD_Path() [2/3]

    OSD_Path::OSD_Path ( const TCollection_AsciiString & aDependentName,
    const OSD_SysType aSysType = OSD_Default )

    Creates a Path object initialized by dependent path. ex: OSD_Path me ("/usr/bin/myprog.sh",OSD_UnixBSD);.

    OSD_Path me ("sys$common:[syslib]cc.exe",OSD_OSF) will raise a ProgramError due to invalid name for this type of system. In order to avoid a 'ProgramError' , use IsValid(...) to ensure you the validity of <aDependentName>. Raises ConstructionError when the path is either null or contains characters not in range of ' '...'~'.

    ◆ OSD_Path() [3/3]

    OSD_Path::OSD_Path ( const TCollection_AsciiString & aNode,
    const TCollection_AsciiString & aUsername,
    const TCollection_AsciiString & aPassword,
    const TCollection_AsciiString & aDisk,
    const TCollection_AsciiString & aTrek,
    const TCollection_AsciiString & aName,
    const TCollection_AsciiString & anExtension )

    Initializes a system independent path. By default , the Path conversion will be assumed using currently used system. A special syntax is used to specify a "aTrek" in an independent manner : a "|" represents directory separator a "^" means directory above (father) examples: "|usr|bin" - On UNIX -> "/usr/bin".

    • On VMS -> "[usr.bin]"
    • On MSDOS-> "\usr\bin"
    • On MacOs-> ": usr : bin"

    "^|rep" - On UNIX -> "../rep"

    • On VMS -> "[-.rep]"
    • On MSDOS -> "..\rep"
    • On MacOS-> ":: rep"

    "subdir|" - On UNIX -> "subdir/"

    • On VMS -> "[.subdir.]"

    Member Function Documentation

    ◆ AbsolutePath()

    TCollection_AsciiString OSD_Path::AbsolutePath ( const TCollection_AsciiString & DirPath,
    const TCollection_AsciiString & RelFilePath )
    static

    Returns the absolute file path from the absolute directory path <DirPath> and the relative file path returned by RelativePath(). If the RelFilePath is an absolute path, it is returned and the directory path is ignored. If handling fails, an empty string is returned.

    ◆ Disk()

    TCollection_AsciiString OSD_Path::Disk ( ) const

    Returns Disk of <me>.

    ◆ DownTrek()

    void OSD_Path::DownTrek ( const TCollection_AsciiString & aName)

    This appends a directory name into the Trek. ex: me = "|usr|todo.sh" me.DownTrek("bin") gives me = "|usr|bin|todo.sh".

    ◆ ExpandedName()

    void OSD_Path::ExpandedName ( TCollection_AsciiString & aName)

    Returns system dependent path resolving logical symbols.

    ◆ Extension()

    TCollection_AsciiString OSD_Path::Extension ( ) const

    Returns my extension name. This returns an empty string if path contains no file name.

    ◆ FileNameAndExtension()

    void OSD_Path::FileNameAndExtension ( const TCollection_AsciiString & theFilePath,
    TCollection_AsciiString & theName,
    TCollection_AsciiString & theExtension )
    static

    Return file extension from the name in lower case. Extension is expected to be within 20-symbols length, and determined as file name tail after last dot. Example: IN theFilePath ='Image.sbs.JPG' OUT theName ='Image.sbs' OUT theFileName ='jpg'.

    Parameters
    [in]theFilePathfile path
    [out]theNamefile name without extension
    [out]theExtensionfile extension in lower case and without dot

    ◆ FolderAndFileFromPath()

    void OSD_Path::FolderAndFileFromPath ( const TCollection_AsciiString & theFilePath,
    TCollection_AsciiString & theFolder,
    TCollection_AsciiString & theFileName )
    static

    Split absolute filepath into folder path and file name. Example: IN theFilePath ='/media/cdrom/image.jpg' OUT theFolder ='/media/cdrom/' OUT theFileName ='image.jpg'.

    Parameters
    [in]theFilePathfile path
    [out]theFolderfolder path (with trailing separator)
    [out]theFileNamefile name

    ◆ InsertATrek()

    void OSD_Path::InsertATrek ( const TCollection_AsciiString & aName,
    const int where )

    This inserts <aName> at position <where> into Trek of <me>. ex: me = "|usr|etc|" me.InsertATrek("sys",2) gives me = "|usr|sys|etc".

    ◆ IsAbsolutePath()

    bool OSD_Path::IsAbsolutePath ( const char * thePath)
    inlinestatic

    Method to recognize path is absolute or not. Detection is based on path syntax - no any filesystem / network access performed.

    Returns
    true if path is complete (absolute)

    ◆ IsContentProtocolPath()

    bool OSD_Path::IsContentProtocolPath ( const char * thePath)
    inlinestatic

    Detect special URLs on Android platform. Sample path: content://filename.

    Returns
    true if content path syntax detected

    ◆ IsDosPath()

    bool OSD_Path::IsDosPath ( const char * thePath)
    inlinestatic

    Detect absolute DOS-path also used in Windows. The total path length is limited to 256 characters. Sample path: C:\folder\file.

    Returns
    true if DOS path syntax detected.

    ◆ IsNtExtendedPath()

    bool OSD_Path::IsNtExtendedPath ( const char * thePath)
    inlinestatic

    Detect extended-length NT path (can be only absolute). Approximate maximum path is 32767 characters. Sample path: \?\D:\very long path File I/O functions in the Windows API convert "/" to "\" as part of converting the name to an NT-style name, except when using the "\?" prefix.

    Returns
    true if extended-length NT path syntax detected.

    ◆ IsRelativePath()

    bool OSD_Path::IsRelativePath ( const char * thePath)
    inlinestatic

    Method to recognize path is absolute or not. Detection is based on path syntax - no any filesystem / network access performed.

    Returns
    true if path is incomplete (relative).

    ◆ IsRemoteProtocolPath()

    bool OSD_Path::IsRemoteProtocolPath ( const char * thePath)
    inlinestatic

    Detect remote protocol path (http / ftp / ...). Actually shouldn't be remote... Sample path: http://domain/path/file.

    Returns
    true if remote protocol path syntax detected.

    ◆ IsUncExtendedPath()

    bool OSD_Path::IsUncExtendedPath ( const char * thePath)
    inlinestatic

    Detect extended-length UNC path. Sample path: \?\UNC\server\share.

    Returns
    true if extended-length UNC path syntax detected.

    ◆ IsUncPath()

    bool OSD_Path::IsUncPath ( const char * thePath)
    inlinestatic

    UNC is a naming convention used primarily to specify and map network drives in Microsoft Windows. Sample path: \server\share\file.

    Returns
    true if UNC path syntax detected.

    ◆ IsUnixPath()

    bool OSD_Path::IsUnixPath ( const char * thePath)
    inlinestatic

    Detect absolute UNIX-path. Sample path: /media/cdrom/file.

    Returns
    true if UNIX path syntax detected.

    ◆ IsValid()

    bool OSD_Path::IsValid ( const TCollection_AsciiString & theDependentName,
    const OSD_SysType theSysType = OSD_Default )
    static

    Returns TRUE if <theDependentName> is valid for this SysType.

    ◆ LocateExecFile()

    bool OSD_Path::LocateExecFile ( OSD_Path & aPath)

    Finds the full path of an executable file, like the "which" Unix utility. Uses the path environment variable. Returns False if executable file not found.

    ◆ Name()

    TCollection_AsciiString OSD_Path::Name ( ) const

    Returns file name of <me>. If <me> hasn't been initialized, it returns an empty AsciiString.

    ◆ Node()

    TCollection_AsciiString OSD_Path::Node ( ) const

    Returns Node of <me>.

    ◆ Password()

    TCollection_AsciiString OSD_Path::Password ( ) const

    Returns Password of <me>.

    ◆ RelativePath()

    TCollection_AsciiString OSD_Path::RelativePath ( const TCollection_AsciiString & DirPath,
    const TCollection_AsciiString & AbsFilePath )
    static

    Returns the relative file path between the absolute directory path <DirPath> and the absolute file path <AbsFilePath>. If <DirPath> starts with "/", paths are handled as on Unix, if it starts with a letter followed by ":", as on WNT. In particular on WNT directory names are not key sensitive. If handling fails, an empty string is returned.

    ◆ RemoveATrek() [1/2]

    void OSD_Path::RemoveATrek ( const int where)

    This removes a component of Trek in <me> at position <where>. The first component of Trek is numbered 1. ex: me = "|usr|bin|" me.RemoveATrek(1) gives me = "|bin|" To avoid a 'NumericError' because of a bad <where>, use TrekLength() to know number of components of Trek in <me>.

    ◆ RemoveATrek() [2/2]

    void OSD_Path::RemoveATrek ( const TCollection_AsciiString & aName)

    This removes <aName> from <me> in Trek. No error is raised if <aName> is not in <me>. ex: me = "|usr|sys|etc|doc" me.RemoveATrek("sys") gives me = "|usr|etc|doc".

    ◆ SetDisk()

    void OSD_Path::SetDisk ( const TCollection_AsciiString & aName)

    Sets Disk of <me>.

    ◆ SetExtension()

    void OSD_Path::SetExtension ( const TCollection_AsciiString & aName)

    Sets my extension name.

    ◆ SetName()

    void OSD_Path::SetName ( const TCollection_AsciiString & aName)

    Sets file name of <me>. If <me> hasn't been initialized, it returns an empty AsciiString.

    ◆ SetNode()

    void OSD_Path::SetNode ( const TCollection_AsciiString & aName)

    Sets Node of <me>.

    ◆ SetPassword()

    void OSD_Path::SetPassword ( const TCollection_AsciiString & aName)

    Sets Password of <me>.

    ◆ SetTrek()

    void OSD_Path::SetTrek ( const TCollection_AsciiString & aName)

    Sets Trek of <me>.

    ◆ SetUserName()

    void OSD_Path::SetUserName ( const TCollection_AsciiString & aName)

    Sets UserName of <me>.

    ◆ SetValues()

    void OSD_Path::SetValues ( const TCollection_AsciiString & aNode,
    const TCollection_AsciiString & aUsername,
    const TCollection_AsciiString & aPassword,
    const TCollection_AsciiString & aDisk,
    const TCollection_AsciiString & aTrek,
    const TCollection_AsciiString & aName,
    const TCollection_AsciiString & anExtension )

    Sets each component of a path.

    ◆ SystemName()

    void OSD_Path::SystemName ( TCollection_AsciiString & FullName,
    const OSD_SysType aType = OSD_Default ) const

    Returns system dependent path <aType> is one among Unix,VMS ... This function is not private because you may need to display system dependent path on a front-end. It can be useful when communicating with another system. For instance when you want to communicate between VMS and Unix to transfer files, or to do a remote procedure call using files. example : OSD_Path myPath ("sparc4", "sga", "secret_passwd", "$5$dkb100","|users|examples"); Internal ( Dependent_name ); On UNIX sga"secret_passwd"@sparc4:/users/examples On VMS sparc4"sga secret_passwd"::$5$dkb100:[users.examples] Sets each component of a Path giving its system dependent name.

    ◆ Trek()

    TCollection_AsciiString OSD_Path::Trek ( ) const

    Returns Trek of <me>.

    ◆ TrekLength()

    int OSD_Path::TrekLength ( ) const

    Returns number of components in Trek of <me>. ex: me = "|usr|sys|etc|bin" me.TrekLength() returns 4.

    ◆ TrekValue()

    TCollection_AsciiString OSD_Path::TrekValue ( const int where) const

    Returns component of Trek in <me> at position <where>. ex: me = "|usr|bin|sys|" me.TrekValue(2) returns "bin".

    ◆ UpTrek()

    void OSD_Path::UpTrek ( )

    This removes the last directory name in <aTrek> and returns result. ex: me = "|usr|bin|todo.sh" me.UpTrek() gives me = "|usr|todo.sh" if <me> contains "|", me.UpTrek() will give again "|" without any error.

    ◆ UserName()

    TCollection_AsciiString OSD_Path::UserName ( ) const

    Returns UserName of <me>.

    ◆ Values()

    void OSD_Path::Values ( TCollection_AsciiString & aNode,
    TCollection_AsciiString & aUsername,
    TCollection_AsciiString & aPassword,
    TCollection_AsciiString & aDisk,
    TCollection_AsciiString & aTrek,
    TCollection_AsciiString & aName,
    TCollection_AsciiString & anExtension ) const

    Gets each component of a path.


    The documentation for this class was generated from the following file: