V8 API Reference Guide generated from the header files
Data Structures | Public Member Functions | Protected Member Functions | Static Protected Member Functions
v8::PersistentValueMapBase< K, V, Traits > Class Template Reference

#include <v8-util.h>

Inheritance diagram for v8::PersistentValueMapBase< K, V, Traits >:
v8::GlobalValueMap< K, V, Traits > v8::PersistentValueMap< K, V, Traits > v8::StdGlobalValueMap< K, V, Traits > v8::StdPersistentValueMap< K, V, Traits >

Data Structures

class  PersistentValueReference
 

Public Member Functions

IsolateGetIsolate ()
 
size_t Size ()
 
bool IsWeak ()
 
Local< V > Get (const K &key)
 
bool Contains (const K &key)
 
bool SetReturnValue (const K &key, ReturnValue< Value > returnValue)
 
void RegisterExternallyReferencedObject (K &key)
 
Global< V > Remove (const K &key)
 
void Clear ()
 
PersistentValueReference GetReference (const K &key)
 

Protected Member Functions

 PersistentValueMapBase (Isolate *isolate)
 
Isolateisolate ()
 
Traits::Impl * impl ()
 
void RemoveWeak (const K &key)
 

Static Protected Member Functions

static V * FromVal (PersistentContainerValue v)
 
static PersistentContainerValue ClearAndLeak (Global< V > *persistent)
 
static PersistentContainerValue Leak (Global< V > *persistent)
 
static Global< V > Release (PersistentContainerValue v)
 

Detailed Description

template<typename K, typename V, typename Traits>
class v8::PersistentValueMapBase< K, V, Traits >

A map wrapper that allows using Global as a mapped value. C++11 embedders don't need this class, as they can use Global directly in std containers.

The map relies on a backing map, whose type and accessors are described by the Traits class. The backing map will handle values of type PersistentContainerValue, with all conversion into and out of V8 handles being transparently handled by this class.

Member Function Documentation

◆ Clear()

template<typename K , typename V , typename Traits >
void v8::PersistentValueMapBase< K, V, Traits >::Clear ( )
inline

Traverses the map repeatedly, in case side effects of disposal cause insertions.

◆ Contains()

template<typename K , typename V , typename Traits >
bool v8::PersistentValueMapBase< K, V, Traits >::Contains ( const K &  key)
inline

Check whether a value is contained in the map.

◆ Get()

template<typename K , typename V , typename Traits >
Local<V> v8::PersistentValueMapBase< K, V, Traits >::Get ( const K &  key)
inline

Get value stored in map.

◆ GetReference()

template<typename K , typename V , typename Traits >
PersistentValueReference v8::PersistentValueMapBase< K, V, Traits >::GetReference ( const K &  key)
inline

Get a reference to a map value. This enables fast, repeated access to a value stored in the map while the map remains unchanged.

Careful: This is potentially unsafe, so please use with care. The value will become invalid if the value for this key changes in the underlying map, as a result of Set or Remove for the same key; as a result of the weak callback for the same key; or as a result of calling Clear() or destruction of the map.

◆ IsWeak()

template<typename K , typename V , typename Traits >
bool v8::PersistentValueMapBase< K, V, Traits >::IsWeak ( )
inline

Return whether the map holds weak persistents.

◆ RegisterExternallyReferencedObject()

template<typename K , typename V , typename Traits >
void v8::PersistentValueMapBase< K, V, Traits >::RegisterExternallyReferencedObject ( K &  key)
inline

Call V8::RegisterExternallyReferencedObject with the map value for given key.

◆ Release()

template<typename K , typename V , typename Traits >
static Global<V> v8::PersistentValueMapBase< K, V, Traits >::Release ( PersistentContainerValue  v)
inlinestaticprotected

Return a container value as Global and make sure the weak callback is properly disposed of. All remove functionality should go through this.

◆ Remove()

template<typename K , typename V , typename Traits >
Global<V> v8::PersistentValueMapBase< K, V, Traits >::Remove ( const K &  key)
inline

Return value for key and remove it from the map.

◆ SetReturnValue()

template<typename K , typename V , typename Traits >
bool v8::PersistentValueMapBase< K, V, Traits >::SetReturnValue ( const K &  key,
ReturnValue< Value returnValue 
)
inline

Get value stored in map and set it in returnValue. Return true if a value was found.

◆ Size()

template<typename K , typename V , typename Traits >
size_t v8::PersistentValueMapBase< K, V, Traits >::Size ( )
inline

Return size of the map.


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