📄 v8.h.svn-base
字号:
static Local<String> New(const uint16_t* data, int length = -1); /** Creates a symbol. Returns one if it exists already.*/ static Local<String> NewSymbol(const char* data, int length = -1); /** * Creates a new external string using the data defined in the given * resource. The resource is deleted when the external string is no * longer live on V8's heap. The caller of this function should not * delete or modify the resource. Neither should the underlying buffer be * deallocated or modified except through the destructor of the * external string resource. */ static Local<String> NewExternal(ExternalStringResource* resource); /** * Creates a new external string using the ascii data defined in the given * resource. The resource is deleted when the external string is no * longer live on V8's heap. The caller of this function should not * delete or modify the resource. Neither should the underlying buffer be * deallocated or modified except through the destructor of the * external string resource. */ static Local<String> NewExternal(ExternalAsciiStringResource* resource); /** Creates an undetectable string from the supplied ascii or utf-8 data.*/ static Local<String> NewUndetectable(const char* data, int length = -1); /** Creates an undetectable string from the supplied utf-16 data.*/ static Local<String> NewUndetectable(const uint16_t* data, int length = -1); /** * Converts an object to a utf8-encoded character array. Useful if * you want to print the object. */ class EXPORT Utf8Value { public: explicit Utf8Value(Handle<v8::Value> obj); ~Utf8Value(); char* operator*() { return str_; } int length() { return length_; } private: char* str_; int length_; }; /** * Converts an object to an ascii string. * Useful if you want to print the object. */ class EXPORT AsciiValue { public: explicit AsciiValue(Handle<v8::Value> obj); ~AsciiValue(); char* operator*() { return str_; } int length() { return length_; } private: char* str_; int length_; }; /** * Converts an object to a two-byte string. */ class EXPORT Value { public: explicit Value(Handle<v8::Value> obj); ~Value(); uint16_t* operator*() { return str_; } int length() { return length_; } private: uint16_t* str_; int length_; };};/** * A JavaScript number value (ECMA-262, 4.3.20) */class EXPORT Number : public Primitive { public: double Value(); static Local<Number> New(double value); static Number* Cast(v8::Value* obj); private: Number();};/** * A JavaScript value representing a signed integer. */class EXPORT Integer : public Number { public: static Local<Integer> New(int32_t value); int64_t Value(); static Integer* Cast(v8::Value* obj); private: Integer();};/** * A JavaScript value representing a 32-bit signed integer. */class EXPORT Int32 : public Integer { public: int32_t Value(); private: Int32();};/** * A JavaScript value representing a 32-bit unsigned integer. */class EXPORT Uint32 : public Integer { public: uint32_t Value(); private: Uint32();};/** * An instance of the built-in Date constructor (ECMA-262, 15.9). */class EXPORT Date : public Value { public: static Local<Value> New(double time);};enum PropertyAttribute { None = 0, ReadOnly = 1 << 0, DontEnum = 1 << 1, DontDelete = 1 << 2};/** * A JavaScript object (ECMA-262, 4.3.3) */class EXPORT Object : public Value { public: bool Set(Handle<Value> key, Handle<Value> value, PropertyAttribute attribs = None); Local<Value> Get(Handle<Value> key); // TODO(1245389): Replace the type-specific versions of these // functions with generic ones that accept a Handle<Value> key. bool Has(Handle<String> key); bool Delete(Handle<String> key); bool Has(uint32_t index); bool Delete(uint32_t index); /** * Get the prototype object. This does not skip objects marked to * be skipped by __proto__ and it does not consult the security * handler. */ Local<Value> GetPrototype(); /** * Call builtin Object.prototype.toString on this object. * This is different from Value::ToString() that may call * user-defined toString function. This one does not. */ Local<String> ObjectProtoToString(); /** Gets the number of internal fields for this Object. */ int InternalFieldCount(); /** Gets the value in an internal field. */ Local<Value> GetInternalField(int index); /** Sets the value in an internal field. */ void SetInternalField(int index, Handle<Value> value); // Testers for local properties. bool HasRealNamedProperty(Handle<String> key); bool HasRealIndexedProperty(uint32_t index); bool HasRealNamedCallbackProperty(Handle<String> key); /** * If result.IsEmpty() no real property was located in the prototype chain. * This means interceptors in the prototype chain are not called. */ Handle<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key); /** Tests for a named lookup interceptor.*/ bool HasNamedLookupInterceptor(); /** Tests for an index lookup interceptor.*/ bool HasIndexedLookupInterceptor(); static Local<Object> New(); static Object* Cast(Value* obj); private: Object();};/** * An instance of the built-in array constructor (ECMA-262, 15.4.2). */class EXPORT Array : public Object { public: uint32_t Length(); static Local<Array> New(int length = 0); static Array* Cast(Value* obj); private: Array();};/** * A JavaScript function object (ECMA-262, 15.3). */class EXPORT Function : public Object { public: Local<Object> NewInstance(); Local<Object> NewInstance(int argc, Handle<Value> argv[]); Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); void SetName(Handle<String> name); Handle<Value> GetName(); static Function* Cast(Value* obj); private: Function();};/** * A JavaScript value that wraps a c++ void*. This type of value is * mainly used to associate c++ data structures with JavaScript * objects. */class EXPORT External : public Value { public: static Local<External> New(void* value); static External* Cast(Value* obj); void* Value(); private: External();};// --- T e m p l a t e s ---/** * The superclass of object and function templates. */class EXPORT Template : public Data { public: /** Adds a property to each instance created by this template.*/ void Set(Handle<String> name, Handle<Data> value, PropertyAttribute attributes = None); inline void Set(const char* name, Handle<Data> value); private: Template(); friend class ObjectTemplate; friend class FunctionTemplate;};/** * The argument information given to function call callbacks. This * class provides access to information about the context of the call, * including the receiver, the number and values of arguments, and * the holder of the function. */class EXPORT Arguments { public: inline int Length() const; inline Local<Value> operator[](int i) const; inline Local<Function> Callee() const; inline Local<Object> This() const; inline Local<Object> Holder() const; inline bool IsConstructCall() const; inline Local<Value> Data() const; private: Arguments(); friend class ImplementationUtilities; inline Arguments(Local<Value> data, Local<Object> holder, Local<Function> callee, bool is_construct_call, void** values, int length); Local<Value> data_; Local<Object> holder_; Local<Function> callee_; bool is_construct_call_; void** values_; int length_;};/** * The information passed to an accessor callback about the context * of the property access. */class EXPORT AccessorInfo { public: inline AccessorInfo(Local<Object> self, Local<Value> data, Local<Object> holder) : self_(self), data_(data), holder_(holder) { } inline Local<Value> Data() const; inline Local<Object> This() const; inline Local<Object> Holder() const; private: Local<Object> self_; Local<Value> data_; Local<Object> holder_;};typedef Handle<Value> (*InvocationCallback)(const Arguments& args);typedef int (*LookupCallback)(Local<Object> self, Local<String> name);/** * Accessor[Getter|Setter] are used as callback functions when * setting|getting a particular property. See objectTemplate::SetAccessor. */typedef Handle<Value> (*AccessorGetter)(Local<String> property, const AccessorInfo& info);typedef void (*AccessorSetter)(Local<String> property, Local<Value> value, const AccessorInfo& info);/** * NamedProperty[Getter|Setter] are used as interceptors on object. * See ObjectTemplate::SetNamedPropertyHandler. */typedef Handle<Value> (*NamedPropertyGetter)(Local<String> property, const AccessorInfo& info);/** * Returns the value if the setter intercepts the request. * Otherwise, returns an empty handle. */typedef Handle<Value> (*NamedPropertySetter)(Local<String> property, Local<Value> value, const AccessorInfo& info);/** * Returns a non-empty handle if the interceptor intercepts the request. * The result is true if the property exists and false otherwise. */typedef Handle<Boolean> (*NamedPropertyQuery)(Local<String> property, const AccessorInfo& info);/** * Returns a non-empty handle if the deleter intercepts the request. * The return value is true if the property could be deleted and false * otherwise. */typedef Handle<Boolean> (*NamedPropertyDeleter)(Local<String> property, const AccessorInfo& info);/** * Returns an array containing the names of the properties the named * property getter intercepts. */typedef Handle<Array> (*NamedPropertyEnumerator)(const AccessorInfo& info);/** * Returns the value of the property if the getter intercepts the * request. Otherwise, returns an empty handle. */typedef Handle<Value> (*IndexedPropertyGetter)(uint32_t index, const AccessorInfo& info);/** * Returns the value if the setter intercepts the request. * Otherwise, returns an empty handle. */typedef Handle<Value> (*IndexedPropertySetter)(uint32_t index, Local<Value> value, const AccessorInfo& info);/** * Returns a non-empty handle if the interceptor intercepts the request. * The result is true if the property exists and false otherwise. */typedef Handle<Boolean> (*IndexedPropertyQuery)(uint32_t index, const AccessorInfo& info);/** * Returns a non-empty handle if the deleter intercepts the request. * The return value is true if the property could be deleted and false * otherwise. */typedef Handle<Boolean> (*IndexedPropertyDeleter)(uint32_t index, const AccessorInfo& info);/** * Returns an array containing the indices of the properties the * indexed property getter intercepts. */typedef Handle<Array> (*IndexedPropertyEnumerator)(const AccessorInfo& info);/** * Access control specifications. * * Some accessors should be accessible across contexts. These * accessors have an explicit access control parameter which specifies
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -