Turok
 
Loading...
Searching...
No Matches
kScriptTMap Class Reference

A map/dictionary that stores key/values as kStr. Example code to iterate each key/value: More...

Private Member Functions

void ItBegin ()
 Resets the iterator back to the first key/value.
 
bool ItNext (kStr &out key, kStr &out value)
 key and value is set to the next key/value in the iterator. Returns false if reached the end.
 
bool Add (const kStr &in key, const kStr &in value)
 if the key doesn't exist then adds the key/value and returns false. If the key already exists then sets the value and returns true.
 
bool Find (const kStr &in key, kStr &out value)
 if the key exists then sets value and returns true. If key was not found then returns false.
 
bool HasKey (const kStr &in key)
 Returns true if the key exists.
 
bool Remove (const kStr &in key)
 Removes the key if it exists and returns true.
 
void Clear ()
 
bool IsEmpty ()
 
uint Count ()
 

Detailed Description

A map/dictionary that stores key/values as kStr. Example code to iterate each key/value:

kStr key, value;
tmap.ItBegin();
while(tmap.ItNext(key, value))
{
Sys.Print("Key: " + key + ", Value: " + value);
}
kSys Sys
String class functions.
A map/dictionary that stores key/values as kStr. Example code to iterate each key/value:
bool ItNext(kStr &out key, kStr &out value)
key and value is set to the next key/value in the iterator. Returns false if reached the end.
void ItBegin()
Resets the iterator back to the first key/value.

Definition at line 2470 of file t1_scriptAPI.cpp.

Member Function Documentation

◆ Add()

bool kScriptTMap::Add ( const kStr &in key,
const kStr &in value )
private

if the key doesn't exist then adds the key/value and returns false. If the key already exists then sets the value and returns true.

◆ Clear()

void kScriptTMap::Clear ( )
private

◆ Count()

uint kScriptTMap::Count ( )
private

◆ Find()

bool kScriptTMap::Find ( const kStr &in key,
kStr &out value )
private

if the key exists then sets value and returns true. If key was not found then returns false.

◆ HasKey()

bool kScriptTMap::HasKey ( const kStr &in key)
private

Returns true if the key exists.

◆ IsEmpty()

bool kScriptTMap::IsEmpty ( )
private

◆ ItBegin()

void kScriptTMap::ItBegin ( )
private

Resets the iterator back to the first key/value.

◆ ItNext()

bool kScriptTMap::ItNext ( kStr &out key,
kStr &out value )
private

key and value is set to the next key/value in the iterator. Returns false if reached the end.

◆ Remove()

bool kScriptTMap::Remove ( const kStr &in key)
private

Removes the key if it exists and returns true.