68 IndexT Add(
const KEYTYPE& key,
const VALUETYPE& value);
102 template<
class RETURNTYPE> RETURNTYPE
KeysAs()
const;
104 template<
class RETURNTYPE> RETURNTYPE
ValuesAs()
const;
123template<
class KEYTYPE,
class VALUETYPE>
133template<
class KEYTYPE,
class VALUETYPE>
138 #if NEBULA_BOUNDSCHECKS
146template<
class KEYTYPE,
class VALUETYPE>
151#if NEBULA_BOUNDSCHECKS
159template<
class KEYTYPE,
class VALUETYPE>
inline
165 for (
const auto& pair : pairs)
176template<
class KEYTYPE,
class VALUETYPE>
180 #if NEBULA_BOUNDSCHECKS
190template<
class KEYTYPE,
class VALUETYPE>
194#if NEBULA_BOUNDSCHECKS
204template<
class KEYTYPE,
class VALUETYPE>
208 #if NEBULA_BOUNDSCHECKS
217template<
class KEYTYPE,
class VALUETYPE>
227template<
class KEYTYPE,
class VALUETYPE>
237template<
class KEYTYPE,
class VALUETYPE>
247template<
class KEYTYPE,
class VALUETYPE>
251 #if NEBULA_BOUNDSCHECKS
260template<
class KEYTYPE,
class VALUETYPE>
264 #if NEBULA_BOUNDSCHECKS
274template<
class KEYTYPE,
class VALUETYPE>
278 if (&rhs ==
this)
return;
292template<
class KEYTYPE,
class VALUETYPE>
310template<
class KEYTYPE,
class VALUETYPE>
328template<
class KEYTYPE,
class VALUETYPE>
332#if NEBULA_BOUNDSCHECKS
350template<
class KEYTYPE,
class VALUETYPE>
360template<
class KEYTYPE,
class VALUETYPE>
365 if (i == InvalidIndex)
378template<
class KEYTYPE,
class VALUETYPE>
382 #if NEBULA_BOUNDSCHECKS
386 #if NEBULA_BOUNDSCHECKS
387 n_assert(InvalidIndex != eraseIndex);
395template<
class KEYTYPE,
class VALUETYPE>
399 #if NEBULA_BOUNDSCHECKS
408template<
class KEYTYPE,
class VALUETYPE>
412 #if NEBULA_BOUNDSCHECKS
415 return this->
keyValuePairs.template BinarySearchIndex<KEYTYPE>(key);
421template<
class KEYTYPE,
class VALUETYPE>
425 #if NEBULA_BOUNDSCHECKS
428 return (InvalidIndex != this->
keyValuePairs.template BinarySearchIndex<KEYTYPE>(key));
434template<
class KEYTYPE,
class VALUETYPE>
438#if NEBULA_BOUNDSCHECKS
441 index = this->
keyValuePairs.template BinarySearchIndex<KEYTYPE>(key);
442 return (InvalidIndex != index);
448template<
class KEYTYPE,
class VALUETYPE>
452 #if NEBULA_BOUNDSCHECKS
461template<
class KEYTYPE,
class VALUETYPE>
465 #if NEBULA_BOUNDSCHECKS
474template<
class KEYTYPE,
class VALUETYPE>
475inline const VALUETYPE&
478 #if NEBULA_BOUNDSCHECKS
487template<
class KEYTYPE,
class VALUETYPE>
491 #if NEBULA_BOUNDSCHECKS
500template<
class KEYTYPE,
class VALUETYPE>
504 #if NEBULA_BOUNDSCHECKS
513template<
class KEYTYPE,
class VALUETYPE>
518 #if NEBULA_BOUNDSCHECKS
519 n_assert(InvalidIndex != keyValuePairIndex);
527template<
class KEYTYPE,
class VALUETYPE>
528inline const VALUETYPE&
532 #if NEBULA_BOUNDSCHECKS
533 n_assert(InvalidIndex != keyValuePairIndex);
541template<
class KEYTYPE,
class VALUETYPE>
542template<
class RETURNTYPE>
546 #if NEBULA_BOUNDSCHECKS
549 RETURNTYPE result(this->
Size(),this->
Size());
561template<
class KEYTYPE,
class VALUETYPE>
571template<
class KEYTYPE,
class VALUETYPE>
572template<
class RETURNTYPE>
576 #if NEBULA_BOUNDSCHECKS
579 RETURNTYPE result(this->
Size(),this->
Size());
591template<
class KEYTYPE,
class VALUETYPE>
601template<
class KEYTYPE,
class VALUETYPE>
610template<
class KEYTYPE,
class VALUETYPE>
619template<
class KEYTYPE,
class VALUETYPE>
628template<
class KEYTYPE,
class VALUETYPE>
632 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:249
IndexT Add(KEYTYPE &&key, VALUETYPE &&value)
add a key and associated value, consuming rvalues
Definition dictionary.h:352
void operator=(Dictionary< KEYTYPE, VALUETYPE > &&rhs) noexcept
move operator
Definition dictionary.h:192
Dictionary(const Dictionary< KEYTYPE, VALUETYPE > &rhs)
copy constructor
Definition dictionary.h:134
void Reserve(SizeT numElements)
reserve space (useful if number of elements is known beforehand)
Definition dictionary.h:239
bool Contains(const KEYTYPE &key) const
return true if key exists in the array
Definition dictionary.h:423
void Clear()
clear the dictionary
Definition dictionary.h:206
SizeT Size() const
return number of key/value pairs in the dictionary
Definition dictionary.h:219
KeyValuePair< KEYTYPE, VALUETYPE > * end() const
Definition dictionary.h:612
const KEYTYPE & KeyAtIndex(IndexT index) const
get a key at given index
Definition dictionary.h:450
IndexT FindIndex(const KEYTYPE &key) const
find index of key/value pair (InvalidIndex if doesn't exist)
Definition dictionary.h:410
Array< KEYTYPE > KeysAsArray() const
get all keys as an Util::Array
Definition dictionary.h:593
Dictionary(Dictionary< KEYTYPE, VALUETYPE > &&rhs) noexcept
move constructor
Definition dictionary.h:147
const VALUETYPE & ValueAtIndex(IndexT index) const
get a value at given index
Definition dictionary.h:476
IndexT Add(const KeyValuePair< KEYTYPE, VALUETYPE > &kvp)
add a key/value pair
Definition dictionary.h:294
void clear()
Definition dictionary.h:621
void EraseAtIndex(IndexT index)
erase a key at index
Definition dictionary.h:397
const VALUETYPE & operator[](const KEYTYPE &key) const
read-only [] operator
Definition dictionary.h:529
RETURNTYPE ValuesAs() const
get all keys as (typically) an array
Definition dictionary.h:544
bool IsEmpty() const
return true if empty
Definition dictionary.h:229
VALUETYPE & ValueAtIndex(IndexT index)
access to value at given index
Definition dictionary.h:463
RETURNTYPE KeysAs() const
get all keys as (typically) an array
Definition dictionary.h:574
Array< VALUETYPE > ValuesAsArray() const
get all keys as an Util::Array
Definition dictionary.h:563
void emplace(KEYTYPE &&key, VALUETYPE &&value)
Definition dictionary.h:630
void Erase(const KEYTYPE &key)
erase a key and its associated value
Definition dictionary.h:380
VALUETYPE & operator[](const KEYTYPE &key)
read/write [] operator
Definition dictionary.h:515
bool Contains(const KEYTYPE &key, IndexT &index) const
return true if key exists in the array, and saves index
Definition dictionary.h:436
bool inBulkInsert
Definition dictionary.h:117
Dictionary(const std::initializer_list< KeyValuePair< KEYTYPE, VALUETYPE > > &&pairs)
initializer list constructor
Definition dictionary.h:160
void Merge(const Dictionary< KEYTYPE, VALUETYPE > &rhs)
merge two dictionaries
Definition dictionary.h:276
const KeyValuePair< KEYTYPE, VALUETYPE > & KeyValuePairAtIndex(IndexT index) const
get key/value pair at index
Definition dictionary.h:502
KeyValuePair< KEYTYPE, VALUETYPE > & KeyValuePairAtIndex(IndexT index)
get key/value pair at index
Definition dictionary.h:489
IndexT Add(const KEYTYPE &key, const VALUETYPE &value)
add a key and associated value
Definition dictionary.h:330
KeyValuePair< KEYTYPE, VALUETYPE > * begin() const
functions for stl like behaviour
Definition dictionary.h:603
void EndBulkAdd()
end a bulk insert (this will sort the internal array)
Definition dictionary.h:262
void operator=(const Dictionary< KEYTYPE, VALUETYPE > &rhs)
assignment operator
Definition dictionary.h:178
Array< KeyValuePair< Util::StringAtom, CoreGraphics::BufferId > > keyValuePairs
Definition dictionary.h:116
Dictionary()
default constructor
Definition dictionary.h:124
VALUETYPE & Emplace(const KEYTYPE &key)
creates a new entry of VALUETYPE if key does not exist, or returns the existing element
Definition dictionary.h:362
IndexT Add(KeyValuePair< KEYTYPE, VALUETYPE > &&kvp)
add a key/value pair, consuming rvalues
Definition dictionary.h:312
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:58
A quad tree designed to return regions of free 2D space.
Definition Random.cs:4
int SizeT
Definition types.h:42
int IndexT
Definition types.h:41