GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
ChaiScript_Language::Map Class Reference

Maps strings to Objects. More...

#include <chaiscript_prelude_docs.hpp>

Public Member Functions

Range range ()
 Returns an object that implements the Range concept for the Map_Pair's in this Map.
Const_Range range () const
 Returns an object that implements the Const_Range concept for the Map_Pair's in this Map.
int size () const
 Returns the number of elements in the Map.
Object operator[] (string)
 Returns the item at the given key, creating an undefined Object if the key does not yet exist in the map.
void clear ()
 Clears the map of all items.
int count (string) const
 Returns the number of items in the Map with the given key. Returns 0 or 1 since this is not an std::multimap.
bool empty () const
 Returns true if the map contains no items.

Detailed Description

Maps strings to Objects.

ChaiScript has a built in shortcut for generating Map objects:

Example:

eval> var m = ["a":1, "b":2];
[<a,1>, <b,2>]
eval> m.count("a");
1
eval> m.count("c");
0
eval> m.size();
2

Implemented as std::map<Boxed_Value>

See also
Map_Pair
chaiscript::bootstrap::standard_library::map_type

Member Function Documentation

◆ clear()

void ChaiScript_Language::Map::clear ( )

Clears the map of all items.

◆ count()

int ChaiScript_Language::Map::count ( string ) const

Returns the number of items in the Map with the given key. Returns 0 or 1 since this is not an std::multimap.

◆ empty()

bool ChaiScript_Language::Map::empty ( ) const

Returns true if the map contains no items.

◆ operator[]()

Object ChaiScript_Language::Map::operator[] ( string )

Returns the item at the given key, creating an undefined Object if the key does not yet exist in the map.

◆ range() [1/2]

Range ChaiScript_Language::Map::range ( )

Returns an object that implements the Range concept for the Map_Pair's in this Map.

◆ range() [2/2]

Const_Range ChaiScript_Language::Map::range ( ) const

Returns an object that implements the Const_Range concept for the Map_Pair's in this Map.

◆ size()

int ChaiScript_Language::Map::size ( ) const

Returns the number of elements in the Map.


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