Beamlib 3.3.2
This is the Beam C++ class library.
Loading...
Searching...
No Matches
BDictMap.h
Go to the documentation of this file.
1/*******************************************************************************
2 * BDictMap.h BEAM Dictionary class
3 * T.Barnaby, BEAM Ltd, 2008-05-21
4 * Copyright (c) 2022 All Right Reserved, Beam Ltd, https://www.beam.ltd.uk
5 * For license see LICENSE.txt at the root of the beamlib source tree.
6 *******************************************************************************
7 */
12#ifndef BDictMap_H
13#define BDictMap_H 1
14
15#include <BString.h>
16#include <map>
17
19template <typename Value> class BDictMap : private std::map<BString, Value> {
20public:
22
23 void clear() { std::map<BString, Value>::clear(); }
24 int hasKey(const BString& k){ return std::map<BString, Value>::count(k); }
25 BString key(iterator& i) { return i->first; }
26 unsigned int size() { return std::map<BString, Value>::size(); }
27 void start(iterator& i) { i = std::map<BString, Value>::begin(); }
28 int isEnd(iterator& i) { return(i == std::map<BString, Value>::end()); }
29 void next(iterator& i) { ++i; }
30 void del(const iterator& i) { std::map<BString, Value>::erase(i); }
31 void del(const BString& k) { std::map<BString, Value>::erase(k); }
32 Value& operator[](iterator& i) { return i->second; }
33 Value& operator[](const BString& i) { return std::map<BString,Value>::operator[](i); }
34private:
35};
36
38
39#endif
BDictMap< BString > BDictMapString
Definition: BDictMap.h:37
Mapped Dictionary class.
Definition: BDictMap.h:19
Value & operator[](const BString &i)
Definition: BDictMap.h:33
unsigned int size()
Definition: BDictMap.h:26
void clear()
Definition: BDictMap.h:23
int hasKey(const BString &k)
Definition: BDictMap.h:24
void next(iterator &i)
Definition: BDictMap.h:29
BDictMap< Value >::iterator iterator
Definition: BDictMap.h:21
void start(iterator &i)
Definition: BDictMap.h:27
BString key(iterator &i)
Definition: BDictMap.h:25
int isEnd(iterator &i)
Definition: BDictMap.h:28
Value & operator[](iterator &i)
Definition: BDictMap.h:32
void del(const BString &k)
Definition: BDictMap.h:31
void del(const iterator &i)
Definition: BDictMap.h:30
This class stores and manipulates ASCII strings.
Definition: BString.h:20