Public Member Functions

nsAutoJSValHolder Class Reference

Simple class that looks and acts like a jsval except that it unroots itself automatically if Root() is ever called. More...

#include <nsAutoJSValHolder.h>

Collaboration diagram for nsAutoJSValHolder:

List of all members.

Public Member Functions

 nsAutoJSValHolder ()
virtual ~nsAutoJSValHolder ()
 Always release on destruction.
JSBool Hold (JSContext *aCx)
 Hold by rooting on the context's runtime.
JSBool Hold (JSRuntime *aRt)
 Hold by rooting on the runtime.
jsval Release ()
 Manually release, nullifying mVal, mGCThing, and mRt, but returning the original jsval.
JSBool IsHeld ()
 Determine if Hold has been called.
JSObjectToJSObject () const
 Explicit JSObject* conversion.
jsvalToJSValPtr ()
 operator jsval () const
 Pretend to be a jsval.
nsAutoJSValHolderoperator= (JSObject *aOther)
nsAutoJSValHolderoperator= (jsval aOther)

Detailed Description

Simple class that looks and acts like a jsval except that it unroots itself automatically if Root() is ever called.

Designed to be rooted on the context or runtime (but not both!).


Constructor & Destructor Documentation

nsAutoJSValHolder::nsAutoJSValHolder (  )  [inline]
virtual nsAutoJSValHolder::~nsAutoJSValHolder (  )  [inline, virtual]

Always release on destruction.


Member Function Documentation

JSBool nsAutoJSValHolder::Hold ( JSContext aCx  )  [inline]

Hold by rooting on the context's runtime.

JSBool nsAutoJSValHolder::Hold ( JSRuntime aRt  )  [inline]

Hold by rooting on the runtime.

Note that mGCThing may be JSVAL_NULL, which is not a problem.

JSBool nsAutoJSValHolder::IsHeld (  )  [inline]

Determine if Hold has been called.

nsAutoJSValHolder::operator jsval (  )  const [inline]

Pretend to be a jsval.

nsAutoJSValHolder& nsAutoJSValHolder::operator= ( JSObject aOther  )  [inline]
nsAutoJSValHolder& nsAutoJSValHolder::operator= ( jsval  aOther  )  [inline]
jsval nsAutoJSValHolder::Release (  )  [inline]

Manually release, nullifying mVal, mGCThing, and mRt, but returning the original jsval.

JSObject* nsAutoJSValHolder::ToJSObject (  )  const [inline]

Explicit JSObject* conversion.

jsval* nsAutoJSValHolder::ToJSValPtr (  )  [inline]

The documentation for this class was generated from the following file: