aboutsummaryrefslogtreecommitdiff
path: root/src/unstable/blobbuilder.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2019-06-25 16:33:14 -0700
committerMike Buland <eichlan@xagasoft.com>2019-06-25 16:33:14 -0700
commit9e4d15b6dec9a7f9358855faeb96b1ac767a15e6 (patch)
tree5a71d51a6f2456cc9ab0f6784d4a5dfbdc83da55 /src/unstable/blobbuilder.h
parentbfc1e2d595452c068a2b66be1436aa34f1083f3d (diff)
downloadlibbu++-9e4d15b6dec9a7f9358855faeb96b1ac767a15e6.tar.gz
libbu++-9e4d15b6dec9a7f9358855faeb96b1ac767a15e6.tar.bz2
libbu++-9e4d15b6dec9a7f9358855faeb96b1ac767a15e6.tar.xz
libbu++-9e4d15b6dec9a7f9358855faeb96b1ac767a15e6.zip
Got most of the functions in, now to test them.
Diffstat (limited to '')
-rw-r--r--src/unstable/blobbuilder.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/unstable/blobbuilder.h b/src/unstable/blobbuilder.h
index 9b5e390..483de43 100644
--- a/src/unstable/blobbuilder.h
+++ b/src/unstable/blobbuilder.h
@@ -16,6 +16,7 @@ namespace Bu
16 class Blob; 16 class Blob;
17 class BlobBuilder; 17 class BlobBuilder;
18 18
19 /** @cond DEVEL */
19 class BlobBuilderCore 20 class BlobBuilderCore
20 { 21 {
21 friend class BlobBuilder; 22 friend class BlobBuilder;
@@ -29,6 +30,15 @@ namespace Bu
29 30
30 void append( const char *&pSrc, int32_t &iLength ); 31 void append( const char *&pSrc, int32_t &iLength );
31 32
33 /**
34 * Splits this chunk into two chunks, and fixes the links.
35 *@param iIndex The first byte to be in the new chunk, if this is
36 * zero or less then it has no effect.
37 *@returns A pointer to the new chunk, or null if no work was
38 * done.
39 */
40 Chunk *split( int32_t iIndex );
41
32 int32_t iLength; 42 int32_t iLength;
33 char *pData; 43 char *pData;
34 Chunk *pNext; 44 Chunk *pNext;
@@ -40,12 +50,16 @@ namespace Bu
40 50
41 void clear(); 51 void clear();
42 void append( const char *pSrc, int32_t iLength ); 52 void append( const char *pSrc, int32_t iLength );
53 void prepend( const char *pSrc, int32_t iLength );
54 void insert( int32_t iBefore, const char *pSrc, int32_t iLength );
43 void set( const char *pSrc, int32_t iLength ); 55 void set( const char *pSrc, int32_t iLength );
56 void copyTo( void *pDestRaw, int32_t iLength ) const;
44 57
45 Chunk *pFirst; 58 Chunk *pFirst;
46 Chunk *pLast; 59 Chunk *pLast;
47 int32_t iLength; 60 int32_t iLength;
48 }; 61 };
62 /** @endcond */
49 63
50 class BlobBuilder : public Bu::SharedCore<BlobBuilder, BlobBuilderCore> 64 class BlobBuilder : public Bu::SharedCore<BlobBuilder, BlobBuilderCore>
51 { 65 {
@@ -61,16 +75,21 @@ namespace Bu
61 75
62 void set( const Blob &rSrc ); 76 void set( const Blob &rSrc );
63 void set( const char *pSrc, int32_t iLength ); 77 void set( const char *pSrc, int32_t iLength );
78 void set( const char *pSrc );
64 void append( const Blob &rSrc ); 79 void append( const Blob &rSrc );
65 void append( const char *pSrc, int32_t iLength ); 80 void append( const char *pSrc, int32_t iLength );
81 void append( const char *pSrc );
66 void prepend( const Blob &rSrc ); 82 void prepend( const Blob &rSrc );
67 void prepend( const char *pSrc, int32_t iLength ); 83 void prepend( const char *pSrc, int32_t iLength );
84 void prepend( const char *pSrc );
68 void insert( int32_t iBefore, const Blob &rSrc ); 85 void insert( int32_t iBefore, const Blob &rSrc );
69 void insert( int32_t iBefore, const char *pSrc, const Blob &rSrc ); 86 void insert( int32_t iBefore, const char *pSrc, int32_t iLength );
87 void insert( int32_t iBefore, const char *pSrc );
70 void clear(); 88 void clear();
71 int32_t getSize() const;
72 89
90 int32_t getSize() const;
73 Blob getBlob() const; 91 Blob getBlob() const;
92 void copyTo( void *pDestRaw, int32_t iDestSize ) const;
74 93
75 BlobBuilder &operator=( const Blob &rSrc ); 94 BlobBuilder &operator=( const Blob &rSrc );
76 BlobBuilder &operator=( const char *pSrc ); 95 BlobBuilder &operator=( const char *pSrc );