ASL
Loading...
Searching...
No Matches
Dic< T > Class Template Reference

Detailed Description

template<class T = String>
class asl::Dic< T >

Dic is a particular case of Map in which keys are strings.

This is a very common case. Dic only needs one template argument: the type of the values

#include <asl/Map.h>

Inherits Map< K, T >.

Additional Inherited Members

- Public Member Functions inherited from Map< K, T >
template<class K2 , class T2 >
 Map (const Map< K2, T2 > &b)
 Constructs a Map from a Map of different key or value types.
 
int length () const
 Returns the number of elements in this map.
 
void clear ()
 Removes all elements.
 
Map & dup ()
 Detaches this Map from other ones possibly sharing it.
 
Map clone () const
 Returns an independent copy of this map.
 
bool has (const K &key) const
 Returns true if an element with key key exists.
 
const T * find (const K &key) const
 Returns a pointer to the element with key key or a null pointer if it is not found.
 
Array< K > keys () const
 Returns an array containing all keys of this map.
 
const T & operator[] (const K &key) const
 Returns a reference to the element with key key, or a static default constructed item if not found.
 
const T & get (const K &key, const T &def) const
 Returns the element with key key or the value def if key is not found.
 
Map & operator() (const K &key, const T &value)
 Adds an element with the given key and value, useful for the short hand initializer style shown in the class overview.
 
bool remove (const K &key)
 Removes the element named key.
 
void add (const Map &d)
 Adds all elements from dictionary d to this.
 
Enumerator all () const
 Returns an enumerator for this map.
 
String join (const String &s1, const String &s2) const
 Joins the contents of a Dic<> into a string, using s1 as element separator (often a comma) and s2 as key-value separator (usually an '=').
 

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