iaux::iaPath Class Reference

#include <iaPath.h>

Public Member Functions

 iaPath (const iaString &path)
 
 iaPath ()
 
iaPath operator= (const iaString &path)
 
bool operator== (const iaString &other)
 
bool operator!= (const iaString &other)
 
const iaString getAbsolutePath () const
 
const iaString getName () const
 
const iaString getParentPath () const
 
const iaString getStem () const
 
const iaString getExtension () const
 
std::vector< iaPathgetDirectories (bool recursive=false, bool orderAlphabetically=true) const
 
std::vector< iaFilegetFiles (const iaString &searchPattern=L"*", bool recursive=false, bool orderAlphabetically=true) const
 
bool isDirectory () const
 
bool isFile () const
 
bool isSymlink () const
 
bool exists () const
 
bool isRoot ()
 
iaTime getLastModifiedTime () const
 

Static Public Member Functions

static const iaString getName (const iaString &path)
 
static const iaString getParentPath (const iaString &path)
 
static const iaString getStem (const iaString &path)
 
static const iaString getExtension (const iaString &path)
 
static iaString getRelativePath (const iaString &from, const iaString &to)
 
static void setCurrentDirectory (const iaString &path)
 
static iaString getCurrentDirectory ()
 
static bool directoryIsAbsolute (const iaString &path)
 
static bool isDirectory (const iaString &path)
 
static bool isFile (const iaString &path)
 
static bool isSymlink (const iaString &path)
 
static void remove (const iaString &path)
 
static void copy (const iaString &src, const iaString &dst)
 
static void rename (const iaString &src, const iaString &dst, bool replaceExisting=false)
 
static void makeDirectory (const iaString &path)
 
static bool exists (const iaString &path)
 
static bool isEmpty (const iaString &path)
 
static iaString fixPath (const iaString &path)
 
static iaString generateUniqueFilename (const iaString &filename)
 
static iaTime getLastModifiedTime (const iaString &path)
 

Detailed Description

handles directories and containing files

Constructor & Destructor Documentation

◆ iaPath() [1/2]

iaux::iaPath::iaPath ( const iaString path)

creates an object for some directory

Parameters
pathpath of directory

◆ iaPath() [2/2]

iaux::iaPath::iaPath ( )

empty directory ctor

Member Function Documentation

◆ copy()

void iaux::iaPath::copy ( const iaString src,
const iaString dst 
)
static

copys the file to a new destination

Parameters
newFileNamename of copy destination

◆ directoryIsAbsolute()

bool iaux::iaPath::directoryIsAbsolute ( const iaString path)
static
Returns
true: if a path is absolute; false: if path is relative
Parameters
paththe given path

◆ exists() [1/2]

bool iaux::iaPath::exists ( ) const
Returns
true if given directory exists

◆ exists() [2/2]

bool iaux::iaPath::exists ( const iaString path)
static
Returns
true if given directory exists

relative to current or absolute

Parameters
paththe given path

◆ fixPath()

iaString iaux::iaPath::fixPath ( const iaString path)
static

fixes the path from something like "../bla\blubber/temp.txt" to an absolute c:\bla\blubber\temp.txt

Parameters
pathpath to fix
Returns
fixed path

◆ generateUniqueFilename()

iaString iaux::iaPath::generateUniqueFilename ( const iaString filename)
static
Returns
valid unique filename for given filename
Parameters
filenamethe given filename

◆ getAbsolutePath()

const iaString iaux::iaPath::getAbsolutePath ( ) const
Returns
get the absolute path (if possible)

To generate an absolute path it check if it exists relative to the current directory

◆ getCurrentDirectory()

iaString iaux::iaPath::getCurrentDirectory ( )
static
Returns
the current or working directory

◆ getDirectories()

std::vector< iaPath > iaux::iaPath::getDirectories ( bool  recursive = false,
bool  orderAlphabetically = true 
) const
Returns
all sub directories
Parameters
recursivetrue: search recursively; false: search only in current directory
orderAlphabeticallytrue: returns directories in alphabetical order

◆ getExtension() [1/2]

const iaString iaux::iaPath::getExtension ( ) const
Returns
the file extension

◆ getExtension() [2/2]

const iaString iaux::iaPath::getExtension ( const iaString path)
static
Returns
the file extension from given path
Parameters
paththe given path

◆ getFiles()

std::vector< iaFile > iaux::iaPath::getFiles ( const iaString searchPattern = L"*",
bool  recursive = false,
bool  orderAlphabetically = true 
) const
Returns
files of given directory

assuming path is an existing directory

Parameters
searchPatternwhat to search for using regular expression
recursivetrue: search recursively; false: search only in current directory
orderAlphabeticallytrue: returns files in alphabetical order

◆ getLastModifiedTime() [1/2]

iaTime iaux::iaPath::getLastModifiedTime ( ) const
Returns
last modified time of path

◆ getLastModifiedTime() [2/2]

iaTime iaux::iaPath::getLastModifiedTime ( const iaString path)
static
Returns
last modified time of given path
Parameters
paththe given path

◆ getName() [1/2]

const iaString iaux::iaPath::getName ( ) const
Returns
the last name in path

examples: "c:\foo\bar" -> "bar" "/foo/bar.txt" -> "bar.txt"

◆ getName() [2/2]

const iaString iaux::iaPath::getName ( const iaString path)
static
Returns
the last name from given path

examples: "c:\foo\bar" -> "bar" "/foo/bar.txt" -> "bar.txt"

Parameters
paththe given path

◆ getParentPath() [1/2]

const iaString iaux::iaPath::getParentPath ( ) const
Returns
the absolute path name of parent directory

e.g. if the path is c:\foo\bar then this returns c:\foo

◆ getParentPath() [2/2]

const iaString iaux::iaPath::getParentPath ( const iaString path)
static
Returns
the absolute path name of parent directory from given path

e.g. if the path is c:\foo\bar then this returns c:\foo

Parameters
paththe given path

◆ getRelativePath()

iaString iaux::iaPath::getRelativePath ( const iaString from,
const iaString to 
)
static
Returns
relative path from path to path
Parameters
fromthe path from where the relative path comes from (can also be a full file path)
tothe path the relative path will point to

◆ getStem() [1/2]

const iaString iaux::iaPath::getStem ( ) const
Returns
filename without extension

"" if this is not a file

◆ getStem() [2/2]

const iaString iaux::iaPath::getStem ( const iaString path)
static
Returns
filename without extension from given path

"" if this is not a file

Parameters
paththe given path

◆ isDirectory() [1/2]

bool iaux::iaPath::isDirectory ( ) const
Returns
true: if a path is directory; false: if path is not a directory

◆ isDirectory() [2/2]

bool iaux::iaPath::isDirectory ( const iaString path)
static
Returns
true: if a path is directory; false: if path is not a directory
Parameters
paththe given path

◆ isEmpty()

bool iaux::iaPath::isEmpty ( const iaString path)
static
Returns
true if given directory is empty
Parameters
paththe given directory

◆ isFile() [1/2]

bool iaux::iaPath::isFile ( ) const
Returns
true: if a path is a file or a symbolic link

◆ isFile() [2/2]

bool iaux::iaPath::isFile ( const iaString path)
static
Returns
true: if a path is a file or a symbolic link
Parameters
paththe given path

◆ isRoot()

bool iaux::iaPath::isRoot ( )
Returns
true: if root folder

eg c:, d: (windows) / (linux)

◆ isSymlink() [1/2]

bool iaux::iaPath::isSymlink ( ) const
Returns
true if given path is a symbolic link

◆ isSymlink() [2/2]

bool iaux::iaPath::isSymlink ( const iaString path)
static
Returns
true if given path is a symbolic link
Parameters
paththe given path

◆ makeDirectory()

void iaux::iaPath::makeDirectory ( const iaString path)
static

creates directory at given path

Parameters
pathgiven path

◆ operator!=()

bool iaux::iaPath::operator!= ( const iaString other)

unequal operator

Parameters
otherthe other path to compare with

◆ operator=()

iaPath iaux::iaPath::operator= ( const iaString path)

copy operator

Parameters
pathpath of directory

◆ operator==()

bool iaux::iaPath::operator== ( const iaString other)

equal operator

Parameters
otherthe other path to compare with

◆ remove()

void iaux::iaPath::remove ( const iaString path)
static

deletes/removes path from filesystem

Parameters
paththe file or directory to remove

◆ rename()

void iaux::iaPath::rename ( const iaString src,
const iaString dst,
bool  replaceExisting = false 
)
static

renames path to a new name

Parameters
srcthe source path
dstthe destination path
replaceExistingtrue: destination will be replaced; false: no action will be taken if destination already exists

◆ setCurrentDirectory()

void iaux::iaPath::setCurrentDirectory ( const iaString path)
static

set's the current or working directory

Parameters
paththe directory path

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