JS_ValueToId 编辑
Convert a JS::Value
to type jsid
.
Syntax
bool JS_ValueToId(JSContext *cx, JS::HandleValue v, JS::MutableHandleId idp); bool JS_StringToId(JSContext *cx, JS::HandleString s, JS::MutableHandleId idp); // Added in SpiderMonkey 38 bool JS_IndexToId(JSContext *cx, uint32_t index, JS::MutableHandleId idp); // Added in SpiderMonkey 17 bool JS_CharsToId(JSContext* cx, JS::TwoByteChars chars, JS::MutableHandleId idp); // Added in SpiderMonkey 24 void JS::ProtoKeyToId(JSContext *cx, JSProtoKey key, JS::MutableHandleId idp); // Added in SpiderMonkey 38
Name | Type | Description |
---|---|---|
cx | JSContext * | A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext . |
v | JS::HandleValue | The JS value to convert. |
s | JS::HandleString | The JS string to convert. |
index | uint32_t | An unsigned integer index of array to convert. |
chars | JS::TwoByteChars | The string to convert. |
key | JSProtoKey | The prototype key to convert. |
idp | JS::MutableHandleId | Out parameter. On success, *idp receives the converted jsid . |
Description
JS_ValueToId
converts a specified JS::Value
, v
, to a jsid
. If v
is an integer, *idp
receives an integer jsid
. Otherwise, if E4X support is enabled and v
is an object, *idp
receives an object jsid
. Otherwise, *idp
receives an interned string jsid
based on the value of v
. If v
is not a string, it is converted to a string as if by calling JS_ValueToString
.
JS_StringToId
and JS_CharsToId
convert a specified string to a jsid
.
JS_IndexToId
converts a specified integer index to an integer jsid
.
JS::ProtoKeyToId
converts a specified prototype key to a jsid
.
On success, JS_ValueToId
stores the converted value in *idp
and returns true
. Otherwise it returns false
.
The inverse of JS_ValueToId
is JS_IdToValue
.
MXR ID Search for JS_ValueToId
See Also
- MXR ID Search for
JS_IdToValue
- MXR ID Search for
JS_StringToId
- MXR ID Search for
JS_IndexToId
- MXR ID Search for
JS_CharsToId
- MXR ID Search for
JS::ProtoKeyToId
JS_ValueToId
- bug 698495 - added
JS_IndexToId
- bug 830500 - added
JS_CharsToId
- bug 959787 - added
JS_StringToId
- bug 987669 - added
JS::ProtoKeyToId
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论