summaryrefslogtreecommitdiff
path: root/src/misc/blob.hpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-03-19 22:46:22 +0000
committeryexo <yexo@openttd.org>2010-03-19 22:46:22 +0000
commitf439b5767aad0cca6c2f40354fb4af2e398053aa (patch)
tree19f992433c5959b765ada67ef7f0fcbb11b57e6f /src/misc/blob.hpp
parentaab88496618e01baae68abe38b603ef9ef5d9dfb (diff)
downloadopenttd-f439b5767aad0cca6c2f40354fb4af2e398053aa.tar.xz
(svn r19477) -Fix (r1946x): removed a few too functions including the copy constructor
Diffstat (limited to 'src/misc/blob.hpp')
-rw-r--r--src/misc/blob.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/misc/blob.hpp b/src/misc/blob.hpp
index ed8c52ac6..6c271cdcf 100644
--- a/src/misc/blob.hpp
+++ b/src/misc/blob.hpp
@@ -74,6 +74,12 @@ public:
/** default constructor - initializes empty blob */
FORCEINLINE ByteBlob() { InitEmpty(); }
+ /** copy constructor */
+ FORCEINLINE ByteBlob(const ByteBlob &src) {
+ InitEmpty();
+ AppendRaw(src);
+ }
+
/** move constructor - take ownership of blob data */
FORCEINLINE ByteBlob(BlobHeader * const & src)
{
@@ -216,6 +222,14 @@ public:
}
}
+ /** append bytes from given source blob to the end of existing data bytes - reallocates if necessary */
+ FORCEINLINE void AppendRaw(const ByteBlob& src)
+ {
+ if (!src.IsEmpty()) {
+ memcpy(Append(src.Length()), src.Begin(), src.Length());
+ }
+ }
+
/** Reallocate if there is no free space for num_bytes bytes.
* @return pointer to the new data to be added */
FORCEINLINE byte *Prepare(uint num_bytes)