sofa::helper::system::SetDirectory Class Reference

#include <SetDirectory.h>

Collaboration diagram for sofa::helper::system::SetDirectory:

Collaboration graph
[legend]

Public Member Functions

 SetDirectory (const char *filename)
 SetDirectory (const std::string &filename)
 ~SetDirectory ()

Static Public Member Functions

static bool IsAbsolute (const std::string &filename)
 Return true if the given file has an absolute path.
static std::string GetCurrentDir ()
 Get the current directory.
static std::string GetParentDir (const char *filename)
 Get the parent directory of a given file, i.e. if given "a/b/c", return "a/b".
static std::string GetFileName (const char *filename)
 Get the filename from an absolute path description, i.e. if given"a/b/c", return "c".
static std::string GetExtension (const char *filename)
 Get the extension of a file from an absolute path description, i.e. if given"a/b/c.d", return "d".
static std::string GetProcessFullPath (const char *filename)
 Get the full path of the current process. The given filename should be the value of argv[0].
static std::string GetRelativeFromDir (const char *filename, const char *basename)
 Get the file relative to a directory, i.e. if given "../e" and "a/b/c", return "a/b/e".
static std::string GetRelativeFromFile (const char *filename, const char *basename)
 Get the file relative to another file path, i.e. if given "../e" and "a/b/c", return "a/e".
static std::string GetRelativeFromProcess (const char *filename, const char *basename=NULL)
 Get the file relative to current process path, i.e. if given "../e" and "a/b/c", return "a/e".

Data Fields

std::string previousDir
std::string directory

Detailed Description

Definition at line 42 of file SetDirectory.h.


Constructor & Destructor Documentation

sofa::helper::system::SetDirectory::SetDirectory ( const char *  filename  ) 

Definition at line 51 of file SetDirectory.cpp.

References directory, GetCurrentDir(), GetParentDir(), and previousDir.

sofa::helper::system::SetDirectory::SetDirectory ( const std::string &  filename  ) 

Definition at line 66 of file SetDirectory.cpp.

References directory, GetCurrentDir(), GetParentDir(), and previousDir.

sofa::helper::system::SetDirectory::~SetDirectory (  ) 

Definition at line 81 of file SetDirectory.cpp.

References directory, and previousDir.


Member Function Documentation

std::string sofa::helper::system::SetDirectory::GetCurrentDir (  )  [static]

std::string sofa::helper::system::SetDirectory::GetExtension ( const char *  filename  )  [static]

Get the extension of a file from an absolute path description, i.e. if given"a/b/c.d", return "d".

Definition at line 138 of file SetDirectory.cpp.

Referenced by sofa::simulation::tree::Simulation::load().

std::string sofa::helper::system::SetDirectory::GetFileName ( const char *  filename  )  [static]

std::string sofa::helper::system::SetDirectory::GetParentDir ( const char *  filename  )  [static]

std::string sofa::helper::system::SetDirectory::GetProcessFullPath ( const char *  filename  )  [static]

Get the full path of the current process. The given filename should be the value of argv[0].

Definition at line 181 of file SetDirectory.cpp.

Referenced by GetRelativeFromProcess(), and sofa::gui::qt::RealGUI::init().

std::string sofa::helper::system::SetDirectory::GetRelativeFromDir ( const char *  filename,
const char *  basename 
) [static]

Get the file relative to a directory, i.e. if given "../e" and "a/b/c", return "a/b/e".

Definition at line 148 of file SetDirectory.cpp.

References GetParentDir(), and IsAbsolute().

Referenced by sofa::helper::system::FileRepository::findFile(), sofa::helper::system::FileRepository::findFileIn(), GetRelativeFromFile(), sofa::gui::qt::RealGUI::init(), and sofa::simulation::tree::xml::processXMLLoading().

std::string sofa::helper::system::SetDirectory::GetRelativeFromFile ( const char *  filename,
const char *  basename 
) [static]

Get the file relative to another file path, i.e. if given "../e" and "a/b/c", return "a/e".

Definition at line 168 of file SetDirectory.cpp.

References GetParentDir(), and GetRelativeFromDir().

Referenced by GetRelativeFromProcess(), and sofa::helper::io::MeshOBJ::readOBJ().

std::string sofa::helper::system::SetDirectory::GetRelativeFromProcess ( const char *  filename,
const char *  basename = NULL 
) [static]

Get the file relative to current process path, i.e. if given "../e" and "a/b/c", return "a/e".

Definition at line 174 of file SetDirectory.cpp.

References GetProcessFullPath(), and GetRelativeFromFile().

Referenced by sofa::helper::system::FileRepository::FileRepository().

bool sofa::helper::system::SetDirectory::IsAbsolute ( const std::string &  filename  )  [static]

Return true if the given file has an absolute path.

Definition at line 95 of file SetDirectory.cpp.

Referenced by sofa::helper::system::FileRepository::findFile(), and GetRelativeFromDir().


Field Documentation

Definition at line 46 of file SetDirectory.h.

Referenced by SetDirectory(), and ~SetDirectory().

Definition at line 45 of file SetDirectory.h.

Referenced by SetDirectory(), and ~SetDirectory().


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

Generated on Sun Nov 23 04:24:20 2008 for Sofa by  doxygen 1.5.7.1