return true;
+}
+
+void SplitPathFilename(string *CalendarEntryHREF, string *EntryURIPath,
+ string *EntryFilename){
+
+ // Look for the last forward slash.
+
+ int LastForwardSlash = -1;
+ int CharSeek = 0;
+ string StringIterChar = "";
+
+ for (string::iterator StringIter = CalendarEntryHREF->begin();
+ StringIter != CalendarEntryHREF->end(); StringIter++){
+
+ StringIterChar = *StringIter;
+
+ if (StringIterChar == "/"){
+ LastForwardSlash = CharSeek;
+ }
+
+ CharSeek++;
+
+ }
+
+ if (LastForwardSlash == -1){
+
+ return;
+
+ }
+
+ // Get the string before the last hash for the path.
+
+ (*EntryURIPath) = CalendarEntryHREF->substr(0, (LastForwardSlash + 1));
+
+ // Get the string after the last hash for the filename.
+
+ (*EntryFilename) = CalendarEntryHREF->substr((LastForwardSlash + 1));
+
}
\ No newline at end of file
PropertyNameValue SplitNameValue(std::string InputData);
bool HexToInt(std::string *HexString, int *Number);
bool IntToHex(int *Number, std::string *HexString, int HexFill);
+void SplitPathFilename(std::string *CalendarEntryHREF, std::string *EntryURIPath,
+ std::string *EntryFilename);
#endif
\ No newline at end of file
}
+TEST(CommonFunctions, SplitPathFilename){
+
+ // Setup the file split.
+
+ string PathFilenameOriginal = "/example/file/yay.txt";
+ string Path = "";
+ string File = "";
+
+ SplitPathFilename(&PathFilenameOriginal, &Path, &File);
+
+ ASSERT_EQ("/example/file/", Path);
+ ASSERT_EQ("yay.txt", File);
+
+ PathFilenameOriginal = "/a/path/with/lots/of/bits/in/andthenthis.html";
+ Path.clear();
+ File.clear();
+
+ SplitPathFilename(&PathFilenameOriginal, &Path, &File);
+
+ ASSERT_EQ("/a/path/with/lots/of/bits/in/", Path);
+ ASSERT_EQ("andthenthis.html", File);
+
+ PathFilenameOriginal = "/one/more/for/a/laugh/hahaha.zip";
+ Path.clear();
+ File.clear();
+
+ SplitPathFilename(&PathFilenameOriginal, &Path, &File);
+
+ ASSERT_EQ("/one/more/for/a/laugh/", Path);
+ ASSERT_EQ("hahaha.zip", File);
+
+}
+
TEST(CommonFunctions, ColourStruct){
Colour Colour1;