BaseName.hpp File Reference

#include <string>

Include dependency graph for BaseName.hpp:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::string baseName (const std::string &str)


Function Documentation

std::string baseName ( const std::string &  str  )  [inline]

Gets the basename of a file (removing the directory)

Parameters:
str given path
Returns:
basename

Definition at line 32 of file BaseName.hpp.

Referenced by CommandLineParser::showUsage().

00033 {
00034   size_t begin = 0;
00035   size_t end = str.length();
00036 
00037   for (size_t i=0; i<str.length(); ++i) {
00038     if (str[i] == '/') begin = i+1;
00039   }
00040 
00041   return str.substr(begin,end);
00042 }


Generated on Wed Nov 19 00:00:23 2008 for FreeFEM3D (aka ff3d) by  doxygen 1.5.6