66 IndexT Add(
const KEYTYPE& key,
const VALUETYPE& value);
100 template<
class RETURNTYPE> RETURNTYPE
KeysAs()
const;
102 template<
class RETURNTYPE> RETURNTYPE
ValuesAs()
const;
121template<
class KEYTYPE,
class VALUETYPE>
131template<
class KEYTYPE,
class VALUETYPE>
136 #if NEBULA_BOUNDSCHECKS
144template<
class KEYTYPE,
class VALUETYPE>
149#if NEBULA_BOUNDSCHECKS
157template<
class KEYTYPE,
class VALUETYPE>
161 #if NEBULA_BOUNDSCHECKS
171template<
class KEYTYPE,
class VALUETYPE>
175#if NEBULA_BOUNDSCHECKS
185template<
class KEYTYPE,
class VALUETYPE>
189 #if NEBULA_BOUNDSCHECKS
198template<
class KEYTYPE,
class VALUETYPE>
208template<
class KEYTYPE,
class VALUETYPE>
218template<
class KEYTYPE,
class VALUETYPE>
228template<
class KEYTYPE,
class VALUETYPE>
232 #if NEBULA_BOUNDSCHECKS
241template<
class KEYTYPE,
class VALUETYPE>
245 #if NEBULA_BOUNDSCHECKS
255template<
class KEYTYPE,
class VALUETYPE>
259 if (&rhs ==
this)
return;
273template<
class KEYTYPE,
class VALUETYPE>
291template<
class KEYTYPE,
class VALUETYPE>
309template<
class KEYTYPE,
class VALUETYPE>
313#if NEBULA_BOUNDSCHECKS
331template<
class KEYTYPE,
class VALUETYPE>
341template<
class KEYTYPE,
class VALUETYPE>
359template<
class KEYTYPE,
class VALUETYPE>
363 #if NEBULA_BOUNDSCHECKS
367 #if NEBULA_BOUNDSCHECKS
376template<
class KEYTYPE,
class VALUETYPE>
380 #if NEBULA_BOUNDSCHECKS
389template<
class KEYTYPE,
class VALUETYPE>
393 #if NEBULA_BOUNDSCHECKS
396 return this->
keyValuePairs.template BinarySearchIndex<KEYTYPE>(key);
402template<
class KEYTYPE,
class VALUETYPE>
406 #if NEBULA_BOUNDSCHECKS
415template<
class KEYTYPE,
class VALUETYPE>
419#if NEBULA_BOUNDSCHECKS
422 index = this->
keyValuePairs.template BinarySearchIndex<KEYTYPE>(key);
429template<
class KEYTYPE,
class VALUETYPE>
433 #if NEBULA_BOUNDSCHECKS
442template<
class KEYTYPE,
class VALUETYPE>
446 #if NEBULA_BOUNDSCHECKS
455template<
class KEYTYPE,
class VALUETYPE>
456inline const VALUETYPE&
459 #if NEBULA_BOUNDSCHECKS
468template<
class KEYTYPE,
class VALUETYPE>
472 #if NEBULA_BOUNDSCHECKS
481template<
class KEYTYPE,
class VALUETYPE>
485 #if NEBULA_BOUNDSCHECKS
494template<
class KEYTYPE,
class VALUETYPE>
499 #if NEBULA_BOUNDSCHECKS
508template<
class KEYTYPE,
class VALUETYPE>
509inline const VALUETYPE&
513 #if NEBULA_BOUNDSCHECKS
522template<
class KEYTYPE,
class VALUETYPE>
523template<
class RETURNTYPE>
527 #if NEBULA_BOUNDSCHECKS
530 RETURNTYPE result(this->
Size(),this->
Size());
542template<
class KEYTYPE,
class VALUETYPE>
552template<
class KEYTYPE,
class VALUETYPE>
553template<
class RETURNTYPE>
557 #if NEBULA_BOUNDSCHECKS
560 RETURNTYPE result(this->
Size(),this->
Size());
572template<
class KEYTYPE,
class VALUETYPE>
582template<
class KEYTYPE,
class VALUETYPE>
591template<
class KEYTYPE,
class VALUETYPE>
600template<
class KEYTYPE,
class VALUETYPE>
609template<
class KEYTYPE,
class VALUETYPE>
613 this->
Add(std::move(key), std::move(value));
Nebula's dynamic array class.
Definition array.h:61
void BeginBulkAdd()
begin a bulk insert (array will be sorted at End)
Definition dictionary.h:230
IndexT Add(KEYTYPE &&key, VALUETYPE &&value)
add a key and associated value, consuming rvalues
Definition dictionary.h:333
void operator=(Dictionary< KEYTYPE, VALUETYPE > &&rhs) noexcept
move operator
Definition dictionary.h:173
Dictionary(const Dictionary< KEYTYPE, VALUETYPE > &rhs)
copy constructor
Definition dictionary.h:132
void Reserve(SizeT numElements)
reserve space (useful if number of elements is known beforehand)
Definition dictionary.h:220
bool Contains(const KEYTYPE &key) const
return true if key exists in the array
Definition dictionary.h:404
void Clear()
clear the dictionary
Definition dictionary.h:187
SizeT Size() const
return number of key/value pairs in the dictionary
Definition dictionary.h:200
KeyValuePair< KEYTYPE, VALUETYPE > * end() const
Definition dictionary.h:593
const KEYTYPE & KeyAtIndex(IndexT index) const
get a key at given index
Definition dictionary.h:431
IndexT FindIndex(const KEYTYPE &key) const
find index of key/value pair (InvalidIndex if doesn't exist)
Definition dictionary.h:391
Array< KEYTYPE > KeysAsArray() const
get all keys as an Util::Array
Definition dictionary.h:574
Dictionary(Dictionary< KEYTYPE, VALUETYPE > &&rhs) noexcept
move constructor
Definition dictionary.h:145
const VALUETYPE & ValueAtIndex(IndexT index) const
get a value at given index
Definition dictionary.h:457
IndexT Add(const KeyValuePair< KEYTYPE, VALUETYPE > &kvp)
add a key/value pair
Definition dictionary.h:275
void clear()
Definition dictionary.h:602
void EraseAtIndex(IndexT index)
erase a key at index
Definition dictionary.h:378
const VALUETYPE & operator[](const KEYTYPE &key) const
read-only [] operator
Definition dictionary.h:510
RETURNTYPE ValuesAs() const
get all keys as (typically) an array
Definition dictionary.h:525
bool IsEmpty() const
return true if empty
Definition dictionary.h:210
VALUETYPE & ValueAtIndex(IndexT index)
access to value at given index
Definition dictionary.h:444
RETURNTYPE KeysAs() const
get all keys as (typically) an array
Definition dictionary.h:555
Array< VALUETYPE > ValuesAsArray() const
get all keys as an Util::Array
Definition dictionary.h:544
void emplace(KEYTYPE &&key, VALUETYPE &&value)
Definition dictionary.h:611
void Erase(const KEYTYPE &key)
erase a key and its associated value
Definition dictionary.h:361
VALUETYPE & operator[](const KEYTYPE &key)
read/write [] operator
Definition dictionary.h:496
bool Contains(const KEYTYPE &key, IndexT &index) const
return true if key exists in the array, and saves index
Definition dictionary.h:417
bool inBulkInsert
Definition dictionary.h:115
void Merge(const Dictionary< KEYTYPE, VALUETYPE > &rhs)
merge two dictionaries
Definition dictionary.h:257
const KeyValuePair< KEYTYPE, VALUETYPE > & KeyValuePairAtIndex(IndexT index) const
get key/value pair at index
Definition dictionary.h:483
KeyValuePair< KEYTYPE, VALUETYPE > & KeyValuePairAtIndex(IndexT index)
get key/value pair at index
Definition dictionary.h:470
IndexT Add(const KEYTYPE &key, const VALUETYPE &value)
add a key and associated value
Definition dictionary.h:311
KeyValuePair< KEYTYPE, VALUETYPE > * begin() const
functions for stl like behaviour
Definition dictionary.h:584
void EndBulkAdd()
end a bulk insert (this will sort the internal array)
Definition dictionary.h:243
void operator=(const Dictionary< KEYTYPE, VALUETYPE > &rhs)
assignment operator
Definition dictionary.h:159
Array< KeyValuePair< Util::StringAtom, CoreGraphics::BufferId > > keyValuePairs
Definition dictionary.h:114
Dictionary()
default constructor
Definition dictionary.h:122
VALUETYPE & Emplace(const KEYTYPE &key)
creates a new entry of VALUETYPE if key does not exist, or returns the existing element
Definition dictionary.h:343
IndexT Add(KeyValuePair< KEYTYPE, VALUETYPE > &&kvp)
add a key/value pair, consuming rvalues
Definition dictionary.h:293
void SortIfDirty() const
make sure the key value pair array is sorted
Key/Value pair objects are used by most assiociative container classes, like Dictionary or HashTable.
Definition keyvaluepair.h:19
#define n_assert(exp)
Definition debug.h:50
A quad tree designed to return regions of free 2D space.
Definition String.cs:6
static const int InvalidIndex
Definition types.h:47
int SizeT
Definition types.h:42
int IndexT
Definition types.h:41