From fb28f6800864176be2ffca29e8e664b641f33170 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 21 Dec 2009 18:04:02 +0000 Subject: m3 is copied into trunk, we should be good to go, now. --- src/functiondirname.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/functiondirname.cpp (limited to 'src/functiondirname.cpp') 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 @@ +#include "functiondirname.h" + +FunctionDirName::FunctionDirName() +{ +} + +FunctionDirName::~FunctionDirName() +{ +} + +Bu::FString FunctionDirName::getName() const +{ + return "dirName"; +} + +Variable FunctionDirName::call( Variable &input, VarList /*lParams*/ ) +{ + Bu::FString sFile; + sFile = input.getString(); + + Bu::FString::const_iterator i = sFile.begin(); + Bu::FString::const_iterator io; + for(;;) + { + Bu::FString::const_iterator b = i.find('/'); + if( !b ) + { + return Variable( Bu::FString( sFile.begin(), io ) ); + } + io = b; + i = b+1; + if( !i ) + { + return Variable( Bu::FString( sFile.begin(), io ) ); + } + } +} + -- cgit v1.2.3