TPtrMap
A key/value (Byte Ptr/Object) map.
Operators
Method Operator[]:Object(key:Byte Ptr)
Finds a value given a key using index syntax.
If the map does not contain key, a Null object is returned.
Returns
The value associated with key.
Example
SuperStrict
Framework brl.standardio
Import brl.map
Local map:TPtrMap = New TPtrMap
map.Insert(Byte Ptr(1), "Hello")
map.Insert(Byte Ptr(2), "World")
For Local k:TPtrKey = EachIn map.Keys()
Print Int(k.value) + " = " + String(map[k.value]) ' retrieve value using index operator
Next
Method Operator[]=(key:Byte Ptr, value:Object)
Inserts a key/value pair into the map using index syntax.
If the map already contains key, its value is overwritten with value.
Example
SuperStrict
Framework brl.standardio
Import brl.map
Local map:TPtrMap = New TPtrMap
map[Byte Ptr(1)] = "Hello" ' insert value using index operator
map[Byte Ptr(2)] = "World"
For Local k:TPtrKey = EachIn map.Keys()
Print Int(k.value) + " = " + String(map.ValueForKey(k.value))
Next
Methods
Method Clear()
Clears the map.
Removes all keys and values.
Method IsEmpty:Int()
Checks if the map is empty.
True if map is empty, otherwise False.
Method Insert( key:Byte Ptr,value:Object )
Inserts a key/value pair into the map.
If the map already contains key, its value is overwritten with value.
Method Contains:Int( key:Byte Ptr )
Checks if the map contains key.
Returns
True if the map contains key.
Method ValueForKey:Object( key:Byte Ptr )
Finds a value given a key.
If the map does not contain key, a Null object is returned.
Returns
The value associated with key.
Method Remove:Int( key:Byte Ptr )
Remove a key/value pair from the map.
Returns
True if key was removed, or False otherwise.
Method Keys:TPtrMapEnumerator()
Gets the map keys.
The object returned by Keys can be used with EachIn to iterate through the keys in the map.
Returns
An enumeration object
Method Values:TPtrMapEnumerator()
Get the map values.
The object returned by Values can be used with EachIn to iterate through the values in the map.
Returns
An enumeration object.
Method Copy:TPtrMap()
Returns a copy the contents of this map.
Method ObjectEnumerator:TPtrNodeEnumerator()
Returns a node enumeration object.
The object returned by ObjectEnumerator can be used with EachIn to iterate through the nodes in the map.