/*------------------------------------------------------------------------------
 src/lib/dj/djMap.h
 
 Copyright (c) 2004-2006 Darby Johnston.
 All rights reserved.
 Use is subject to license terms.
------------------------------------------------------------------------------*/

#ifndef DJ_MAP_H
#define DJ_MAP_H
#include <djStr.h>

namespace dj {

// Map - associative array.
//
template <class Key, class Value>
class Map {
public:

  // Set.
  //
  void set(const Key &, const Value &);
  Value & operator [] (const Key &);

  // Get.
  //
  const Value & get(const Key &) const;
  const Value & operator [] (const Key &) const;
  int size() const { return _list.size(); }
  const List<Key> keyList() const;
  const List<Value> valueList() const;

  // Delete.
  //
  const Value del(const Key &);
  void del();
  
  // Find.
  //
  bool find(const Key &) const;

private:

  List<Pair<Key, Value> > _list;
};

}

#include <djMap_.h>
#endif
