source: trunk/IPs/systemC/processor/Morpheo/Common/src/Basename.cpp @ 131

Last change on this file since 131 was 131, checked in by rosiere, 15 years ago

1) add constant method
2) test with systemc 2.2.0

  • Property svn:keywords set to Id
File size: 495 bytes
Line 
1/*
2 * $Id: Basename.cpp 131 2009-07-08 18:40:08Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "../include/Basename.h"
9
10namespace morpheo {
11
12  std::string basename (std::string str, bool keep_extension)
13  {
14    std::string res = ::basename(str.c_str());
15   
16    if (not keep_extension)
17      {
18        std::string::size_type index = res.rfind('.');
19       
20        if(index != std::string::npos)
21          {
22            res = res.substr(0,index);
23          }
24      }
25   
26    return res;
27  }
28 
29}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.