: QScopedPointer<T>(ptr.leakRef())
{}
+ OwnPtr(const OwnPtr<T>& other)
+ : QScopedPointer<T>(const_cast<OwnPtr<T> &>(other).take())
+ {}
+
OwnPtr& operator=(const OwnPtr<T>& other)
{
this->reset(const_cast<OwnPtr<T> &>(other).take());
#include <wtf/NotFound.h>
#include <qalgorithms.h>
+enum WTF_UnusedOverflowMode {
+ UnsafeVectorOverflow
+};
+
namespace WTF {
-template <typename T, int capacity = 1>
+template <typename T, int capacity = 1, int overflowMode = UnsafeVectorOverflow>
class Vector : public std::vector<T> {
public:
Vector() {}
using std::vector<T>::insert;
+ inline void reserveInitialCapacity(size_t size) { this->reserve(size); }
+
inline void insert(size_t position, T value)
{ this->insert(this->begin() + position, value); }
inline void shrink(size_t size)
{ this->erase(this->begin() + size, this->end()); }
+ inline void shrinkToFit()
+ { this->shrink_to_fit(); }
+
inline void remove(size_t position)
{ this->erase(this->begin() + position); }
ctx->throwTypeError();
double t = self->value.asDouble();
- if (!isfinite(t))
+ if (!std::isfinite(t))
ctx->throwRangeError(ctx->thisObject);
QString result;
Value O = __qmljs_to_object(ctx, ctx->thisObject);
Value tv = __qmljs_to_primitive(O, ctx, NUMBER_HINT);
- if (tv.isNumber() && !isfinite(tv.toNumber(ctx)))
+ if (tv.isNumber() && !std::isfinite(tv.toNumber(ctx)))
return Value::nullValue();
FunctionObject *toIso = O.objectValue()->get(ctx, ctx->engine->newString(QStringLiteral("toISOString"))).asFunctionObject();
return Value::fromBoolean(true);
double d = v.toNumber(context);
- return Value::fromBoolean(isfinite(d));
+ return Value::fromBoolean(std::isfinite(d));
}
/// decodeURI [15.1.3.1]
if (value.isNumber()) {
double d = value.toNumber(ctx);
- return isfinite(d) ? value.toString(ctx)->toQString() : QStringLiteral("null");
+ return std::isfinite(d) ? value.toString(ctx)->toQString() : QStringLiteral("null");
}
if (Object *o = value.asObject()) {
if ((number >= 0 && number < D16))
return static_cast<ushort>(number);
- if (!isfinite(number))
+ if (!std::isfinite(number))
return +0;
double d = ::floor(::fabs(number));
- if (signbit(number))
+ if (std::signbit(number))
d = -d;
number = ::fmod(d , D16);
return static_cast<int>(number);
- if (!isfinite(number))
+ if (!std::isfinite(number))
return 0;
double d = ::floor(::fabs(number));
- if (signbit(number))
+ if (std::signbit(number))
d = -d;
number = ::fmod(d , D32);
if ((number >= 0 && number < D32))
return static_cast<uint>(number);
- if (!isfinite(number))
+ if (!std::isfinite(number))
return +0;
double d = ::floor(::fabs(number));
- if (signbit(number))
+ if (std::signbit(number))
d = -d;
number = ::fmod(d , D32);
else if (! number || isinf(number))
return number;
const double v = floor(fabs(number));
- return signbit(number) ? -v : v;
+ return std::signbit(number) ? -v : v;
}
Value Value::property(ExecutionContext *ctx, String *name) const