template class Core::ConstMap

Overview

Constant map container class. More…

#include <coremap.h>

template <
    typename TKey,
    typename TValue,
    typename TEntries = ConstVector <KeyValue <TKey, TValue>>
>
class ConstMap
{
public:
    // typedefs

    typedef KeyValue <TKey, TValue> Entry;
    typedef RangeIterator <TEntries, VectorIterator <Entry>, Entry&> Iterator;

    // construction

    ConstMap (Entry* data, int length);

    // methods

    int count () const;
    bool isEmpty () const;
    TValue& operator [] (const TKey& key) const;
    TValue& getValue (const TKey& key) const;
    bool getValue (TValue& result, const TKey& key) const;
    TKey& getKey (const TValue& value) const;
    bool getKey (TKey& result, const TValue& value) const;
    bool contains (const TKey& key) const;
    bool containsValue (const TValue& value) const;
    Iterator begin () const;
    Iterator end () const;
};

Detailed Documentation

Constant map container class.

Methods

int count () const

Get number of entries.

bool isEmpty () const

Check if container is empty.

TValue& operator [] (const TKey& key) const

Get value by key (operator).

TValue& getValue (const TKey& key) const

Get value by key.

bool getValue (TValue& result, const TKey& key) const

Get value by key, returns false if key is not contained.

TKey& getKey (const TValue& value) const

Get key by value.

bool getKey (TKey& result, const TValue& value) const

Get key by value, returns false if value is not contained.

bool contains (const TKey& key) const

Check if container holds given key.

bool containsValue (const TValue& value) const

Check if container holds any key for given value.

Iterator begin () const

Iterate entries (range-for).