Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index fb10c71576da0a92963b4decfe4dde60067a34fb..435486a147b6030ede454847c8bcb10ac3cf8cd5 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -80,9 +80,11 @@ namespace v8 { |
class Context; |
class String; |
+class StringObject; |
class Value; |
class Utils; |
class Number; |
+class NumberObject; |
class Object; |
class Array; |
class Int32; |
@@ -90,6 +92,7 @@ class Uint32; |
class External; |
class Primitive; |
class Boolean; |
+class BooleanObject; |
class Integer; |
class Function; |
class Date; |
@@ -929,6 +932,26 @@ class Value : public Data { |
V8EXPORT bool IsDate() const; |
/** |
+ * Returns true if this value is an instance of the Boolean constructor. |
Vyacheslav Egorov (Chromium)
2011/07/13 09:10:17
I suggest clearer wording:
"Returns true if this
|
+ */ |
+ V8EXPORT bool IsBooleanObject() const; |
+ |
+ /** |
+ * Returns true if this value is an instance of the Number constructor. |
+ */ |
+ V8EXPORT bool IsNumberObject() const; |
+ |
+ /** |
+ * Returns true if this value is an instance of the String constructor. |
+ */ |
+ V8EXPORT bool IsStringObject() const; |
+ |
+ /** |
+ * Returns true if this value is a NativeError. |
+ */ |
+ V8EXPORT bool IsNativeError() const; |
+ |
+ /** |
* Returns true if this value is a RegExp. |
*/ |
V8EXPORT bool IsRegExp() const; |
@@ -1745,6 +1768,65 @@ class Date : public Object { |
/** |
+ * An instance of the built-in Number constructor (ECMA-262, 15.7). |
+ */ |
+class NumberObject : public Object { |
+ public: |
+ V8EXPORT static Local<Value> New(double value); |
+ |
+ /** |
+ * A specialization of Value::NumberValue that is more efficient |
+ * because we know the structure of this object. |
+ */ |
+ V8EXPORT double NumberValue() const; |
+ |
+ static inline NumberObject* Cast(v8::Value* obj); |
+ |
+ private: |
+ V8EXPORT static void CheckCast(v8::Value* obj); |
+}; |
+ |
+ |
+/** |
+ * An instance of the built-in Boolean constructor (ECMA-262, 15.6). |
+ */ |
+class BooleanObject : public Object { |
+ public: |
+ V8EXPORT static Local<Value> New(bool value); |
+ |
+ /** |
+ * A specialization of Value::BooleanValue that is more efficient |
+ * because we know the structure of this object. |
+ */ |
+ V8EXPORT bool BooleanValue() const; |
+ |
+ static inline BooleanObject* Cast(v8::Value* obj); |
+ |
+ private: |
+ V8EXPORT static void CheckCast(v8::Value* obj); |
+}; |
+ |
+ |
+/** |
+ * An instance of the built-in String constructor (ECMA-262, 15.5). |
+ */ |
+class StringObject : public Object { |
+ public: |
+ V8EXPORT static Local<Value> New(Handle<String> value); |
+ |
+ /** |
+ * Returns the String held by the object. |
+ */ |
+ V8EXPORT Local<String> StringValue() const; |
+ |
+ static inline StringObject* Cast(v8::Value* obj); |
+ |
+ private: |
+ V8EXPORT static void CheckCast(v8::Value* obj); |
+}; |
+ |
+ |
+/** |
* An instance of the built-in RegExp constructor (ECMA-262, 15.10). |
*/ |
class RegExp : public Object { |
@@ -4035,6 +4117,30 @@ Date* Date::Cast(v8::Value* value) { |
} |
+StringObject* StringObject::Cast(v8::Value* value) { |
+#ifdef V8_ENABLE_CHECKS |
+ CheckCast(value); |
+#endif |
+ return static_cast<StringObject*>(value); |
+} |
+ |
+ |
+NumberObject* NumberObject::Cast(v8::Value* value) { |
+#ifdef V8_ENABLE_CHECKS |
+ CheckCast(value); |
+#endif |
+ return static_cast<NumberObject*>(value); |
+} |
+ |
+ |
+BooleanObject* BooleanObject::Cast(v8::Value* value) { |
+#ifdef V8_ENABLE_CHECKS |
+ CheckCast(value); |
+#endif |
+ return static_cast<BooleanObject*>(value); |
+} |
+ |
+ |
RegExp* RegExp::Cast(v8::Value* value) { |
#ifdef V8_ENABLE_CHECKS |
CheckCast(value); |