Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Map< K, T > Class Template Reference

#include </home/casse/Dev/elm/src/concepts.h>

+ Inheritance diagram for Map< K, T >:

Classes

class  KeyIter
 
class  PairIterator
 

Public Member Functions

Option< const T & > get (const K &key) const
 
const T & get (const K &key, const T &def) const
 
bool hasKey (const K &key) const
 
Iterable< KeyIterkeys () const
 
Iterable< PairIter > pairs () const
 
const T & operator[] (const K &k) const
 
- Public Member Functions inherited from Collection< T >
int count (void)
 
bool contains (const T &item)
 
template<template< class _ > class C>
bool containsAll (const C< T > &collection)
 
bool isEmpty (void)
 
 operator bool (void)
 
Iter begin (void) const
 
Iter end (void) const
 
bool equals (const Collection &coll)
 
bool operator== (const Collection &coll)
 
bool operator!= (const Collection &coll)
 

Additional Inherited Members

- Public Types inherited from Collection< T >
typedef T t
 
typedef Collection< T > self_t
 
- Static Public Attributes inherited from Collection< T >
static const Collection null
 
static const Collection< T > null
 

Detailed Description

template<class K, class T>
class elm::concept::Map< K, T >

This concept defines collections of items retrievable by an assigned key.

Implemented by:

Member Function Documentation

◆ get() [1/2]

Option<const T&> get ( const K &  key) const

Get a value by its key.

Parameters
keyKey to get the value for.
Returns
The matching value.

◆ get() [2/2]

const T& get ( const K &  key,
const T &  def 
) const

Get a value by its key.

Parameters
keyKey to get the value for.
defDefault value to return if the key is not found.
Returns
Found value or default value.

◆ hasKey()

bool hasKey ( const K &  key) const

Test if the key is defined in the map.

Parameters
keyKey to look for.
Returns
True if the key is defined in the map, false else.

◆ keys()

Iterable<KeyIter> keys ( ) const

Get the collection of keys.

◆ operator[]()

const T& operator[] ( const K &  k) const

Get a value by its key.

Parameters
kLooked key.
Returns
Value for the key.
Exceptions
KeyExceptionIf the key does not exist in the map.

◆ pairs()

Iterable<PairIter> pairs ( ) const

Get the collection pairs (key, value).


The documentation for this class was generated from the following file: