JS::AutoVectorRooter 编辑
This article covers features introduced in SpiderMonkey 17
Base class that roots an internal variable-size array of type T
.
Syntax
JS::AutoVectorRooter(JSContext* cx);
Methods
Method | Description |
---|---|
size_t length() const | Returns the length of the array. |
bool empty() const | Determines if the array is empty (length is zero). |
bool append(const T &v) | Appends an element v to the array. |
bool append(const T *ptr, size_t len) | Appends a sequence of T specified with a pointer ptr and length len to the array. |
bool appendAll(const AutoVectorRooter<T> &other) | Appends all elements of other to the array. |
bool insert(T *p, const T &val) | Inserts an element val at the position specified by p . |
void infallibleAppend(const T &v) | Appends an element v to the array. For use when space has already been reserved. |
void popBack() | Pops an element from the array. |
T popCopy() | Pops an element from the array and returns it. |
bool growBy(size_t inc) | Grows the array by inc . |
bool resize(size_t newLength) | Resizes the array to newLength. |
void clear() | Clears all elements. |
bool reserve(size_t newLength) | Reserves the array with newLength . |
JS::MutableHandle<T> operator[](size_t i) | Returns to the i -th element as JS::MutableHandle<T> . |
JS::Handle<T> operator[](size_t i) const | Returns to the i -th element as JS::Handle<T> . |
const T *begin() const | Returns a pointer to the first element. |
T *begin() | Returns a pointer to the first element. |
const T *end() const | Returns a pointer to the element next to the last element. |
T *end() | Returns a pointer to the element next to the last element. |
Range all() | Returns the Range of the array. |
const T &back() const | Returns the last element. |
Description
JS::AutoVectorRooter<T>
holds a variable-size rooted array of type T
.
There are derived classes for the main types:
Class | Parent class |
---|---|
JS::AutoValueVector | AutoVectorRooter<Value> |
JS::AutoIdVector | AutoVectorRooter<jsid> |
JS::AutoObjectVector Added in SpiderMonkey 24 | AutoVectorRooter<JSObject *> |
JS::AutoFunctionVector Added in SpiderMonkey 31 | AutoVectorRooter<JSFunction *> |
JS::AutoScriptVector | AutoVectorRooter<JSScript *> |
See Also
- MXR ID Search for
JS::AutoVectorRooter
- MXR ID Search for
JS::AutoValueVector
- MXR ID Search for
JS::AutoIdVector
- MXR ID Search for
JS::AutoObjectVector
- MXR ID Search for
JS::AutoFunctionVector
- MXR ID Search for
JS::AutoScriptVector
JS::AutoValueArray<N>
- fixed-size array ofJS::Value
- bug 677079
- bug 868580 - expose
JS::AutoObjectVector
- bug 848592 - added
JS::AutoFunctionVector
- bug 676281 - added
JS::AutoScriptVector
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论