UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
io_helpers.h
1 /***************************************************************************
2  * Copyright (C) 2014 by Jan Stückrath <jan.stueckrath@uni-due.de> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA *
18  ***************************************************************************/
19 
20 #ifndef IO_HELPERS_H_
21 #define IO_HELPERS_H_
22 
23 #include "../basic_types/globals.h"
24 
25 namespace uncover {
26  namespace io {
27 
34  inline string removeFileExtension(string filename) {
35  size_t point = filename.rfind('.');
36  if(point == string::npos) {
37  return filename;
38  } else {
39  return filename.substr(0,point);
40  }
41  }
42 
49  inline string removeFilePath(string filename) {
50  size_t point = filename.rfind('/');
51  if(point == string::npos) {
52  return filename;
53  } else {
54  return filename.substr(point+1);
55  }
56  }
57 
58  }
59 }
60 
61 #endif /* IO_HELPERS_H_ */
string removeFileExtension(string filename)
Takes a filename and returns the filename without extension.
Definition: io_helpers.h:34
string removeFilePath(string filename)
Takes a filename including path and returns the filename without its path.
Definition: io_helpers.h:49