AGX Dynamics  2.35.0.1
agxIO::FilePathContainer Class Reference

class for locating files More...

#include <FilePathContainer.h>

Public Types

typedef agx::List< agx::String > PathList
 

Public Member Functions

 FilePathContainer ()
 Constructor. More...
 
 FilePathContainer (const agx::String &env)
 Constructor - set the file path found in given environment variable. More...
 
 ~FilePathContainer ()
 Destructor. More...
 
void addFilePath (const agx::String &path)
 Adds a list of paths to the end previous one. More...
 
void clear ()
 Clear all added path. More...
 
agx::String find (const agx::String &filename) const
 First it will try to locate 'filename' in one of the specified directories. More...
 
PathList & getFilePathList ()
 
const PathList & getFilePathList () const
 
void pushbackPath (const agx::String &path)
 Adds a filepath to the end of the list. More...
 
void pushfrontPath (const agx::String &path)
 Adds a filepath to the beginning of the list. More...
 
void removeFilePath (const agx::String &path)
 Removes a list of paths. More...
 
void setFilePath (const agx::String &path)
 Set the file path directly. More...
 
void setFilePathList (const agx::String &paths, bool clearPrevious=true, const agx::String &delimiter=agxIO::FileSystem::PATH_DELIMITER)
 Set the file path using a single string delimited with given delimiter. More...
 
bool setFromEnvironmentVariable (const agx::String &env, bool clearPrevious=true)
 Set the file path found in given environment variable. More...
 

Detailed Description

class for locating files

Definition at line 32 of file FilePathContainer.h.

Member Typedef Documentation

◆ PathList

Constructor & Destructor Documentation

◆ FilePathContainer() [1/2]

agxIO::FilePathContainer::FilePathContainer ( )

Constructor.

◆ FilePathContainer() [2/2]

agxIO::FilePathContainer::FilePathContainer ( const agx::String &  env)

Constructor - set the file path found in given environment variable.

◆ ~FilePathContainer()

agxIO::FilePathContainer::~FilePathContainer ( )

Destructor.

Member Function Documentation

◆ addFilePath()

void agxIO::FilePathContainer::addFilePath ( const agx::String &  path)

Adds a list of paths to the end previous one.

Parameters
path- string of paths each separated with PATH_DELIMITER

◆ clear()

void agxIO::FilePathContainer::clear ( )

Clear all added path.

◆ find()

agx::String agxIO::FilePathContainer::find ( const agx::String &  filename) const

First it will try to locate 'filename' in one of the specified directories.

Then it will search for it as 'filename' (current dir).

Returns
path to given filename if file exists in any directory

◆ getFilePathList() [1/2]

PathList& agxIO::FilePathContainer::getFilePathList ( )
Returns
file path list

◆ getFilePathList() [2/2]

const PathList& agxIO::FilePathContainer::getFilePathList ( ) const
Returns
file path list

◆ pushbackPath()

void agxIO::FilePathContainer::pushbackPath ( const agx::String &  path)

Adds a filepath to the end of the list.

Parameters
path- string of paths each separated with PATH_DELIMITER \

◆ pushfrontPath()

void agxIO::FilePathContainer::pushfrontPath ( const agx::String &  path)

Adds a filepath to the beginning of the list.

Parameters
path- string of paths each separated with PATH_DELIMITER

◆ removeFilePath()

void agxIO::FilePathContainer::removeFilePath ( const agx::String &  path)

Removes a list of paths.

Parameters
path- string of paths each separated with PATH_DELIMITER

◆ setFilePath()

void agxIO::FilePathContainer::setFilePath ( const agx::String &  path)

Set the file path directly.

Clear previously set data.

◆ setFilePathList()

void agxIO::FilePathContainer::setFilePathList ( const agx::String &  paths,
bool  clearPrevious = true,
const agx::String &  delimiter = agxIO::FileSystem::PATH_DELIMITER 
)

Set the file path using a single string delimited with given delimiter.

Parameters
paths- PATH_DELIMITER separated string with paths
clearPrevious- clear previously added information to the path list of this instance
delimiter- the delimiter (PATH_DELIMITER) defaults to the os where the code is compiled

◆ setFromEnvironmentVariable()

bool agxIO::FilePathContainer::setFromEnvironmentVariable ( const agx::String &  env,
bool  clearPrevious = true 
)

Set the file path found in given environment variable.

Returns
true if env var found

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