TalanSoft Toolkits  201707
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
cPath Class Reference

Detailed Description

Path utility class.

Public Member Functions

 cPath ()
 Empty constructor. More...
 
 cPath (const achar *aPath)
 UTF8 string constructor. More...
 
 cPath (const uchar *auszStr)
 Unicode string constructor. More...
 
 cPath (const achar *aszDirectory, const achar *aszFile)
 Directory + File constructor. More...
 
tBool IsEmpty () const
 Return eTrue if the path is empty. More...
 
tBool IsNotEmpty () const
 Return eTrue if the path is not empty. More...
 
tBool IsFile () const
 Return eTrue if this path is a file. More...
 
tBool IsDirectory () const
 Return eTrue if this path is a directory. More...
 
tBool HasDirectory () const
 Return eTrue if this path has a directory. More...
 
tBool IsAbsolute () const
 Return eTrue if the path is absolute. More...
 
tBool IsRelative () const
 Return eTrue if the path is relative to the app's directory. More...
 
cPathSetFile (const achar *aszFile)
 Set the file of the path. More...
 
const cStringGetFile () const
 Get the file of the path. More...
 
cPathSetFileNoExt (const achar *aFileName)
 
cString GetFileNoExt () const
 
cPathSetExtension (const achar *aszExtension)
 Set the file extension of the path. More...
 
const cString GetExtension () const
 Get the extension of this file. More...
 
cPathSetDirectory (const achar *aszDirectory)
 Set the directory of the path. More...
 
const cStringGetDirectory () const
 Get the directory of the path. More...
 
cString GetDirectoryNoProtocol () const
 Get the directory of the path without the protocol. More...
 
tBool HasProtocol () const
 Check whether the path has a protocol defined. More...
 
cPathSetProtocol (const achar *aszProtocol)
 Set the file protocol of the path. More...
 
const cString GetProtocol () const
 Get the protocol of this file. More...
 
cPathAddDirectoryFront (const achar *aszDirectory)
 Add a directory to the front of the path. More...
 
cPathAddDirectoryBack (const achar *aszDirectory)
 Add a directory to the bakc of the path. More...
 
cPathRemoveDirectoryBack ()
 Remove the directory on the right of the path. More...
 
cPathPushDirectory ()
 Push the current directory. More...
 
cPathPopDirectory ()
 Pop the latest pushed directory. More...
 
cPathSetPath (const achar *aszPath)
 Set the full path. More...
 
const cStringGetPath () const
 Get the full path. More...
 
cPathoperator= (const cPath &aPath)
 Set the full path. More...
 
cPathoperator= (const achar *aszPath)
 Set the full path. More...
 
cPathoperator= (const cString &aPath)
 Set the full path. More...
 

Static Public Member Functions

static cStringFixPath (cString &aOut, const achar *aaszPath)
 Convert a string to a standard path. More...
 

Constructor & Destructor Documentation

cPath ( )

Empty constructor.

cPath ( const achar aPath)

UTF8 string constructor.

cPath ( const uchar auszStr)

Unicode string constructor.

cPath ( const achar aszDirectory,
const achar aszFile 
)

Directory + File constructor.

Member Function Documentation

tBool IsEmpty ( ) const

Return eTrue if the path is empty.

tBool IsNotEmpty ( ) const

Return eTrue if the path is not empty.

tBool IsFile ( ) const

Return eTrue if this path is a file.

tBool IsDirectory ( ) const

Return eTrue if this path is a directory.

tBool HasDirectory ( ) const

Return eTrue if this path has a directory.

tBool IsAbsolute ( ) const

Return eTrue if the path is absolute.

tBool IsRelative ( ) const

Return eTrue if the path is relative to the app's directory.

cPath& SetFile ( const achar aszFile)

Set the file of the path.

const cString& GetFile ( ) const

Get the file of the path.

cPath& SetFileNoExt ( const achar aFileName)
cString GetFileNoExt ( ) const
cPath& SetExtension ( const achar aszExtension)

Set the file extension of the path.

const cString GetExtension ( ) const

Get the extension of this file.

cPath& SetDirectory ( const achar aszDirectory)

Set the directory of the path.

const cString& GetDirectory ( ) const

Get the directory of the path.

cString GetDirectoryNoProtocol ( ) const

Get the directory of the path without the protocol.

tBool HasProtocol ( ) const

Check whether the path has a protocol defined.

cPath& SetProtocol ( const achar aszProtocol)

Set the file protocol of the path.

const cString GetProtocol ( ) const

Get the protocol of this file.

cPath& AddDirectoryFront ( const achar aszDirectory)

Add a directory to the front of the path.

Remarks
Not meant be used with absolute directories. It'll lead to invalid paths, ex: 'N:/foo' -> 'front_dir/N:/foo'
cPath& AddDirectoryBack ( const achar aszDirectory)

Add a directory to the bakc of the path.

cPath& RemoveDirectoryBack ( )

Remove the directory on the right of the path.

cPath& PushDirectory ( )

Push the current directory.

cPath& PopDirectory ( )

Pop the latest pushed directory.

cPath& SetPath ( const achar aszPath)

Set the full path.

const cString& GetPath ( ) const

Get the full path.

cPath& operator= ( const cPath aPath)

Set the full path.

cPath& operator= ( const achar aszPath)

Set the full path.

cPath& operator= ( const cString aPath)

Set the full path.

static cString& FixPath ( cString aOut,
const achar aaszPath 
)
static

Convert a string to a standard path.