diff options
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/StringUtil.cc | 9 | ||||
-rw-r--r-- | src/FbTk/StringUtil.hh | 6 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc index 26dbb84..e1af2c2 100644 --- a/src/FbTk/StringUtil.cc +++ b/src/FbTk/StringUtil.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: StringUtil.cc,v 1.5 2003/08/22 19:38:00 fluxgen Exp $ | 22 | // $Id: StringUtil.cc,v 1.6 2003/08/22 22:11:19 fluxgen Exp $ |
23 | 23 | ||
24 | #include "StringUtil.hh" | 24 | #include "StringUtil.hh" |
25 | 25 | ||
@@ -171,6 +171,13 @@ std::string toUpper(const std::string &conv) { | |||
171 | return ret; | 171 | return ret; |
172 | } | 172 | } |
173 | 173 | ||
174 | std::string basename(const std::string &filename) { | ||
175 | std::string::size_type first_pos = filename.find_last_of("/"); | ||
176 | if (first_pos != std::string::npos) | ||
177 | return filename.substr(first_pos + 1); | ||
178 | return filename; | ||
179 | } | ||
180 | |||
174 | }; // end namespace StringUtil | 181 | }; // end namespace StringUtil |
175 | 182 | ||
176 | }; // end namespace FbTk | 183 | }; // end namespace FbTk |
diff --git a/src/FbTk/StringUtil.hh b/src/FbTk/StringUtil.hh index 0c798ee..621f0fb 100644 --- a/src/FbTk/StringUtil.hh +++ b/src/FbTk/StringUtil.hh | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | //$Id: StringUtil.hh,v 1.4 2003/08/22 19:37:07 fluxgen Exp $ | 22 | //$Id: StringUtil.hh,v 1.5 2003/08/22 22:11:19 fluxgen Exp $ |
23 | 23 | ||
24 | #ifndef FBTK_STRINGUTIL_HH | 24 | #ifndef FBTK_STRINGUTIL_HH |
25 | #define FBTK_STRINGUTIL_HH | 25 | #define FBTK_STRINGUTIL_HH |
@@ -49,6 +49,10 @@ int getStringBetween(std::string& out, const char *instr, | |||
49 | std::string toLower(const std::string &conv); | 49 | std::string toLower(const std::string &conv); |
50 | /// @return upper case letters of conv | 50 | /// @return upper case letters of conv |
51 | std::string toUpper(const std::string &conv); | 51 | std::string toUpper(const std::string &conv); |
52 | #ifdef basename | ||
53 | #undef basename | ||
54 | #endif // basename | ||
55 | std::string basename(const std::string &basename); | ||
52 | 56 | ||
53 | /// Breaks a string into tokens | 57 | /// Breaks a string into tokens |
54 | template <typename Container> | 58 | template <typename Container> |