diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/unit/blobbuilder.unit | 21 | ||||
-rw-r--r-- | src/unstable/blobbuilder.cpp | 18 | ||||
-rw-r--r-- | src/unstable/blobbuilder.h | 3 |
3 files changed, 40 insertions, 2 deletions
diff --git a/src/unit/blobbuilder.unit b/src/unit/blobbuilder.unit index c9480bb..30aece7 100644 --- a/src/unit/blobbuilder.unit +++ b/src/unit/blobbuilder.unit | |||
@@ -17,13 +17,11 @@ suite BlobBuilder | |||
17 | { | 17 | { |
18 | test append | 18 | test append |
19 | { | 19 | { |
20 | |||
21 | Bu::BlobBuilder a; | 20 | Bu::BlobBuilder a; |
22 | a.append("a"); | 21 | a.append("a"); |
23 | a.append("bc"); | 22 | a.append("bc"); |
24 | a += "def"; | 23 | a += "def"; |
25 | a.append("abcdef"); | 24 | a.append("abcdef"); |
26 | |||
27 | } | 25 | } |
28 | 26 | ||
29 | test appendChar | 27 | test appendChar |
@@ -35,4 +33,23 @@ suite BlobBuilder | |||
35 | } | 33 | } |
36 | unitTest( a.getBlob() == "AAAAAAAAAAAAAAAAAAAA" ); | 34 | unitTest( a.getBlob() == "AAAAAAAAAAAAAAAAAAAA" ); |
37 | } | 35 | } |
36 | |||
37 | test operators1 | ||
38 | { | ||
39 | Bu::BlobBuilder a; | ||
40 | |||
41 | a << "Hello" << " " << Bu::Blob("there") << " how are you?"; | ||
42 | unitTest( a.getBlob() == "Hello there how are you?" ); | ||
43 | } | ||
44 | |||
45 | test operators2 | ||
46 | { | ||
47 | Bu::BlobBuilder a; | ||
48 | |||
49 | a += "Hello"; | ||
50 | a += " "; | ||
51 | a += Bu::Blob("there"); | ||
52 | a += " how are you?"; | ||
53 | unitTest( a.getBlob() == "Hello there how are you?" ); | ||
54 | } | ||
38 | } | 55 | } |
diff --git a/src/unstable/blobbuilder.cpp b/src/unstable/blobbuilder.cpp index 901c72e..3c55e3c 100644 --- a/src/unstable/blobbuilder.cpp +++ b/src/unstable/blobbuilder.cpp | |||
@@ -396,3 +396,21 @@ Bu::BlobBuilder &Bu::BlobBuilder::operator+=( const char chr ) | |||
396 | return *this; | 396 | return *this; |
397 | } | 397 | } |
398 | 398 | ||
399 | Bu::BlobBuilder &Bu::BlobBuilder::operator<<( const Blob &rSrc ) | ||
400 | { | ||
401 | append( rSrc ); | ||
402 | return *this; | ||
403 | } | ||
404 | |||
405 | Bu::BlobBuilder &Bu::BlobBuilder::operator<<( const char *pSrc ) | ||
406 | { | ||
407 | append( pSrc ); | ||
408 | return *this; | ||
409 | } | ||
410 | |||
411 | Bu::BlobBuilder &Bu::BlobBuilder::operator<<( const char chr ) | ||
412 | { | ||
413 | append( chr ); | ||
414 | return *this; | ||
415 | } | ||
416 | |||
diff --git a/src/unstable/blobbuilder.h b/src/unstable/blobbuilder.h index 7ad4255..fd368fa 100644 --- a/src/unstable/blobbuilder.h +++ b/src/unstable/blobbuilder.h | |||
@@ -120,6 +120,9 @@ namespace Bu | |||
120 | BlobBuilder &operator+=( const Blob &rSrc ); | 120 | BlobBuilder &operator+=( const Blob &rSrc ); |
121 | BlobBuilder &operator+=( const char *pSrc ); | 121 | BlobBuilder &operator+=( const char *pSrc ); |
122 | BlobBuilder &operator+=( const char chr ); | 122 | BlobBuilder &operator+=( const char chr ); |
123 | BlobBuilder &operator<<( const Blob &rSrc ); | ||
124 | BlobBuilder &operator<<( const char *pSrc ); | ||
125 | BlobBuilder &operator<<( const char chr ); | ||
123 | private: | 126 | private: |
124 | }; | 127 | }; |
125 | }; | 128 | }; |