f1402849
dmayerich
renewed commit
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#include <string>
using namespace std;
#ifndef RTS_FILENAME_H
#define RTS_FILENAME_H
class rtsFilename
{
private:
string filename;
public:
string getFilename()
{
int pos = filename.find_last_of("/\\");
string name = filename.substr(pos+1, filename.size());
return name;
}
rtsFilename& operator=(const string str)
{
filename = str;
return *this;
}
rtsFilename(const string str){filename = str;}
rtsFilename(){filename = "";}
string getExtension()
{
int pos = filename.find_last_of(".");
string ext = filename.substr(pos+1, filename.size() - pos);
return ext;
}
string getDirectory()
{
int pos = filename.find_last_of("/\\");
string directory;
if(pos != -1)
directory = filename.substr(0, pos);
else
directory = "";
return directory;
}
string getPrefix()
{
int slash = filename.find_last_of("/\\");
int dot = filename.find_last_of(".");
string prefix;
prefix = filename.substr(slash+1, dot - slash - 1);
return prefix;
}
string getString()
{
return filename;
}
};
#endif
|