Pyrogenesis  trunk
Public Member Functions | Private Attributes | List of all members
DefPersistentRooted< T > Class Template Reference

A default constructible wrapper around JS::PersistentRootedValue. More...

#include <ScriptVal.h>

Public Member Functions

 DefPersistentRooted ()
 
 DefPersistentRooted (JSRuntime *rt)
 
 DefPersistentRooted (JSRuntime *rt, JS::HandleValue val)
 
 DefPersistentRooted (JSContext *cx, JS::Handle< T > val)
 
void clear ()
 
bool uninitialized ()
 
JS::PersistentRooted< T > & get () const
 
void set (JSRuntime *rt, T val)
 
void set (JSContext *cx, T val)
 
DefPersistentRooted< T > & operator= (DefPersistentRooted< T > &&other)
 
 DefPersistentRooted (DefPersistentRooted< T > &&other)
 

Private Attributes

std::unique_ptr< JS::PersistentRooted< T > > m_Val
 

Detailed Description

template<typename T>
class DefPersistentRooted< T >

A default constructible wrapper around JS::PersistentRootedValue.

It's a very common case that we need to store JS::Values on the heap as class members and only need them conditionally or want to initialize them after the constructor because we don't have the runtime available yet. Use it in these cases, but prefer to use JS::PersistentRootedValue directly if initializing it with a runtime/context in the constructor isn't a problem.

Constructor & Destructor Documentation

template<typename T>
DefPersistentRooted< T >::DefPersistentRooted ( )
inline
template<typename T>
DefPersistentRooted< T >::DefPersistentRooted ( JSRuntime *  rt)
inline
template<typename T>
DefPersistentRooted< T >::DefPersistentRooted ( JSRuntime *  rt,
JS::HandleValue  val 
)
inline
template<typename T>
DefPersistentRooted< T >::DefPersistentRooted ( JSContext *  cx,
JS::Handle< T val 
)
inline
template<typename T>
DefPersistentRooted< T >::DefPersistentRooted ( DefPersistentRooted< T > &&  other)
inline

Member Function Documentation

template<typename T>
void DefPersistentRooted< T >::clear ( )
inline
template<typename T>
JS::PersistentRooted<T>& DefPersistentRooted< T >::get ( ) const
inline
template<typename T>
DefPersistentRooted<T>& DefPersistentRooted< T >::operator= ( DefPersistentRooted< T > &&  other)
inline
template<typename T>
void DefPersistentRooted< T >::set ( JSRuntime *  rt,
T  val 
)
inline
template<typename T>
void DefPersistentRooted< T >::set ( JSContext *  cx,
T  val 
)
inline
template<typename T>
bool DefPersistentRooted< T >::uninitialized ( )
inline

Member Data Documentation

template<typename T>
std::unique_ptr<JS::PersistentRooted<T> > DefPersistentRooted< T >::m_Val
private

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