From 262c1489b10663f817f7c2bb11a61d0c9a8d8439 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 22 Dec 2008 14:40:05 +0000 Subject: Hey, corrected a minor issue in Bu::FString. Turns out C++ is hardass enough that we need a concatination operator for both const chr * and chr *. This fixed a suprising number of problems. --- src/fstring.h | 7 +++++++ src/unit/fstring.cpp | 12 ++++++++++++ 2 files changed, 19 insertions(+) (limited to 'src') diff --git a/src/fstring.h b/src/fstring.h index 91251bc..5c70919 100644 --- a/src/fstring.h +++ b/src/fstring.h @@ -516,6 +516,13 @@ namespace Bu return ret; } + MyType operator +( chr *pRight ) + { + MyType ret( *this ); + ret.append( pRight ); + return ret; + } + /** * Reset your FString to this character array. *@param pData (const chr *) The character array to set your FString to. diff --git a/src/unit/fstring.cpp b/src/unit/fstring.cpp index 7be03a7..9430a83 100644 --- a/src/unit/fstring.cpp +++ b/src/unit/fstring.cpp @@ -8,6 +8,8 @@ #include "bu/fstring.h" #include "bu/unitsuite.h" +#include + class Unit : public Bu::UnitSuite { public: @@ -25,6 +27,7 @@ public: addTest( Unit::add3 ); addTest( Unit::add4 ); addTest( Unit::add5 ); + addTest( Unit::add6 ); addTest( Unit::subStr1 ); } @@ -140,6 +143,15 @@ public: unitTest( b == "hey, sup?" ); } + void add6() + { + Bu::FString a("Hello"); + char b[256] = {"Dude"}; + Bu::FString c = a + "/" + b; + + unitTest( c == "Hello/Dude" ); + } + void subStr1() { Bu::FString a("abcdefghijklmnop"); -- cgit v1.2.3