wrenbind17::Map #
Module: Wrenbind17
Holds native Wren map.
#include <map.hpp>
Public Functions #
Name | |
---|---|
Map() | |
Map(const std::shared_ptr< Handle > & handle) | |
~Map() | |
Handle & | getHandle() |
const Handle & | getHandle() const |
operator bool() const | |
void | reset() |
template <typename Key > bool | contains(const Key & key) constChecks if a key exists in this map. |
template <typename T ,typename Key > T | get(const Key & key) constReturns a value specified by T from the map by a key. |
template <typename Key > bool | erase(const Key & key) constErases a key from the map. |
size_t | count() constReturns the size of the map. |
Public Functions Documentation #
function Map #
inline Map()
function Map #
inline Map(
const std::shared_ptr< Handle > & handle
)
function ~Map #
inline ~Map()
function getHandle #
inline Handle & getHandle()
function getHandle #
inline const Handle & getHandle() const
function operator bool #
inline operator bool() const
function reset #
inline void reset()
function contains #
template <typename Key >
inline bool contains(
const Key & key
) const
Checks if a key exists in this map.
Exceptions:
- RuntimeError if this is an invalid map or the Wren VM has terminated
Note: This function accepts any type you want. Integers, strings, booleans, does not matter as long as Wren map supports that key type.
Warning: If using strings, make sure that you use std::string because raw C-strings are not allowed.
function get #
template <typename T ,
typename Key >
inline T get(
const Key & key
) const
Returns a value specified by T from the map by a key.
Exceptions:
- NotFound if the key does not exist in the map
- RuntimeError if this is an invalid map or the Wren VM has terminated
Note: This function accepts any type you want. Integers, strings, booleans, does not matter as long as Wren map supports that key type.
Warning: If using strings, make sure that you use std::string because raw C-strings are not allowed.
function erase #
template <typename Key >
inline bool erase(
const Key & key
) const
Erases a key from the map.
Exceptions:
- NotFound if the key does not exist in the map
- RuntimeError if this is an invalid map or the Wren VM has terminated
Return: true if the key has been erased, otherwise false
Note: This function accepts any type you want. Integers, strings, booleans, does not matter as long as Wren map supports that key type.
Warning: If using strings, make sure that you use std::string because raw C-strings are not allowed.
function count #
inline size_t count() const
Returns the size of the map.
Exceptions:
- RuntimeError if this is an invalid map or the Wren VM has terminated
Updated on 17 October 2023 at 12:26:25 UTC