Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index fb10c71576da0a92963b4decfe4dde60067a34fb..587455a73a1f5271d774b3feb8d874ebe6a60c91 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -80,9 +80,11 @@ namespace v8 { |
class Context; |
class String; |
+class BoxedString; |
class Value; |
class Utils; |
class Number; |
+class BoxedNumber; |
class Object; |
class Array; |
class Int32; |
@@ -90,6 +92,7 @@ class Uint32; |
class External; |
class Primitive; |
class Boolean; |
+class BoxedBoolean; |
class Integer; |
class Function; |
class Date; |
@@ -929,6 +932,31 @@ class Value : public Data { |
V8EXPORT bool IsDate() const; |
/** |
+ * Returns true if this value is a boxed Boolean. |
+ */ |
+ V8EXPORT bool IsBoxedBoolean() const; |
Vyacheslav Egorov (Chromium)
2011/07/12 20:38:12
Lets call them IsXXXObject instead of IsBoxedXXX.
zarko
2011/07/12 21:42:06
Done.
|
+ |
+ /** |
+ * Returns true if this value is a boxed Number. |
+ */ |
+ V8EXPORT bool IsBoxedNumber() const; |
+ |
+ /** |
+ * Returns true if this value is a boxed String. |
+ */ |
+ V8EXPORT bool IsBoxedString() const; |
+ |
+ /** |
+ * Returns true if this value is a NativeError. |
+ */ |
+ V8EXPORT bool IsNativeError() const; |
+ |
+ /** |
+ * Returns true if this value is the native Math object. |
+ */ |
+ V8EXPORT bool IsMath() const; |
+ |
+ /** |
* Returns true if this value is a RegExp. |
*/ |
V8EXPORT bool IsRegExp() const; |
@@ -1745,6 +1773,65 @@ class Date : public Object { |
/** |
+ * An instance of the built-in Number constructor (ECMA-262, 15.7). |
+ */ |
+class BoxedNumber : public Object { |
Vyacheslav Egorov (Chromium)
2011/07/12 20:38:12
XXXObject
zarko
2011/07/12 21:42:06
Done.
|
+ 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 BoxedNumber* 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 BoxedBoolean : 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 BoxedBoolean* 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 BoxedString : public Object { |
+ public: |
+ V8EXPORT static Local<Value> New(Handle<String> value); |
+ |
+ /** |
+ * Returns the String held by the box. |
+ */ |
+ V8EXPORT Local<String> StringValue() const; |
+ |
+ static inline BoxedString* 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 +4122,30 @@ Date* Date::Cast(v8::Value* value) { |
} |
+BoxedString* BoxedString::Cast(v8::Value* value) { |
+#ifdef V8_ENABLE_CHECKS |
+ CheckCast(value); |
+#endif |
+ return static_cast<BoxedString*>(value); |
+} |
+ |
+ |
+BoxedNumber* BoxedNumber::Cast(v8::Value* value) { |
+#ifdef V8_ENABLE_CHECKS |
+ CheckCast(value); |
+#endif |
+ return static_cast<BoxedNumber*>(value); |
+} |
+ |
+ |
+BoxedBoolean* BoxedBoolean::Cast(v8::Value* value) { |
+#ifdef V8_ENABLE_CHECKS |
+ CheckCast(value); |
+#endif |
+ return static_cast<BoxedBoolean*>(value); |
+} |
+ |
+ |
RegExp* RegExp::Cast(v8::Value* value) { |
#ifdef V8_ENABLE_CHECKS |
CheckCast(value); |