diff options
Diffstat (limited to '')
-rw-r--r-- | src/functiondirname.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/functiondirname.cpp b/src/functiondirname.cpp new file mode 100644 index 0000000..e8b728b --- /dev/null +++ b/src/functiondirname.cpp | |||
@@ -0,0 +1,38 @@ | |||
1 | #include "functiondirname.h" | ||
2 | |||
3 | FunctionDirName::FunctionDirName() | ||
4 | { | ||
5 | } | ||
6 | |||
7 | FunctionDirName::~FunctionDirName() | ||
8 | { | ||
9 | } | ||
10 | |||
11 | Bu::FString FunctionDirName::getName() const | ||
12 | { | ||
13 | return "dirName"; | ||
14 | } | ||
15 | |||
16 | Variable FunctionDirName::call( Variable &input, VarList /*lParams*/ ) | ||
17 | { | ||
18 | Bu::FString sFile; | ||
19 | sFile = input.getString(); | ||
20 | |||
21 | Bu::FString::const_iterator i = sFile.begin(); | ||
22 | Bu::FString::const_iterator io; | ||
23 | for(;;) | ||
24 | { | ||
25 | Bu::FString::const_iterator b = i.find('/'); | ||
26 | if( !b ) | ||
27 | { | ||
28 | return Variable( Bu::FString( sFile.begin(), io ) ); | ||
29 | } | ||
30 | io = b; | ||
31 | i = b+1; | ||
32 | if( !i ) | ||
33 | { | ||
34 | return Variable( Bu::FString( sFile.begin(), io ) ); | ||
35 | } | ||
36 | } | ||
37 | } | ||
38 | |||