summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h37
1 files changed, 32 insertions, 5 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h
index dcfeb29..c378fd0 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h
@@ -21,16 +21,17 @@
#ifndef WTF_Vector_h
#define WTF_Vector_h
-#include "Assertions.h"
-#include "FastMalloc.h"
+#include "FastAllocBase.h"
#include "Noncopyable.h"
#include "NotFound.h"
#include "VectorTraits.h"
#include <limits>
-#include <stdlib.h>
-#include <string.h>
#include <utility>
+#if PLATFORM(QT)
+#include <QDataStream>
+#endif
+
namespace WTF {
using std::min;
@@ -433,7 +434,7 @@ namespace WTF {
};
template<typename T, size_t inlineCapacity = 0>
- class Vector {
+ class Vector : public FastAllocBase {
private:
typedef VectorBuffer<T, inlineCapacity> Buffer;
typedef VectorTypeOperations<T> TypeOperations;
@@ -566,6 +567,32 @@ namespace WTF {
Buffer m_buffer;
};
+#if PLATFORM(QT)
+ template<typename T>
+ QDataStream& operator<<(QDataStream& stream, const Vector<T>& data)
+ {
+ stream << qint64(data.size());
+ foreach (const T& i, data)
+ stream << i;
+ return stream;
+ }
+
+ template<typename T>
+ QDataStream& operator>>(QDataStream& stream, Vector<T>& data)
+ {
+ data.clear();
+ qint64 count;
+ T item;
+ stream >> count;
+ data.reserveCapacity(count);
+ for (qint64 i = 0; i < count; ++i) {
+ stream >> item;
+ data.append(item);
+ }
+ return stream;
+ }
+#endif
+
template<typename T, size_t inlineCapacity>
Vector<T, inlineCapacity>::Vector(const Vector& other)
: m_size(other.size())