summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2008-12-22 14:40:05 +0000
committerMike Buland <eichlan@xagasoft.com>2008-12-22 14:40:05 +0000
commit262c1489b10663f817f7c2bb11a61d0c9a8d8439 (patch)
tree752d5d6f13eb26a3b64d5e9b2e2ecbec7ef2677f /src
parentb7a687b08e32adafbb609bec7aa79b54f161ee4c (diff)
downloadlibbu++-262c1489b10663f817f7c2bb11a61d0c9a8d8439.tar.gz
libbu++-262c1489b10663f817f7c2bb11a61d0c9a8d8439.tar.bz2
libbu++-262c1489b10663f817f7c2bb11a61d0c9a8d8439.tar.xz
libbu++-262c1489b10663f817f7c2bb11a61d0c9a8d8439.zip
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.
Diffstat (limited to '')
-rw-r--r--src/fstring.h7
-rw-r--r--src/unit/fstring.cpp12
2 files changed, 19 insertions, 0 deletions
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
516 return ret; 516 return ret;
517 } 517 }
518 518
519 MyType operator +( chr *pRight )
520 {
521 MyType ret( *this );
522 ret.append( pRight );
523 return ret;
524 }
525
519 /** 526 /**
520 * Reset your FString to this character array. 527 * Reset your FString to this character array.
521 *@param pData (const chr *) The character array to set your FString to. 528 *@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 @@
8#include "bu/fstring.h" 8#include "bu/fstring.h"
9#include "bu/unitsuite.h" 9#include "bu/unitsuite.h"
10 10
11#include <dirent.h>
12
11class Unit : public Bu::UnitSuite 13class Unit : public Bu::UnitSuite
12{ 14{
13public: 15public:
@@ -25,6 +27,7 @@ public:
25 addTest( Unit::add3 ); 27 addTest( Unit::add3 );
26 addTest( Unit::add4 ); 28 addTest( Unit::add4 );
27 addTest( Unit::add5 ); 29 addTest( Unit::add5 );
30 addTest( Unit::add6 );
28 addTest( Unit::subStr1 ); 31 addTest( Unit::subStr1 );
29 } 32 }
30 33
@@ -140,6 +143,15 @@ public:
140 unitTest( b == "hey, sup?" ); 143 unitTest( b == "hey, sup?" );
141 } 144 }
142 145
146 void add6()
147 {
148 Bu::FString a("Hello");
149 char b[256] = {"Dude"};
150 Bu::FString c = a + "/" + b;
151
152 unitTest( c == "Hello/Dude" );
153 }
154
143 void subStr1() 155 void subStr1()
144 { 156 {
145 Bu::FString a("abcdefghijklmnop"); 157 Bu::FString a("abcdefghijklmnop");