Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXReverseDictionaryOf.h
1 /********************************************************************************
2 * *
3 * R e v e r s e D i c t i o n a r y O f P o i n t e r s T o T y p e *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2018,2024 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef REVERSEDICTIONARYOF_H
22 #define REVERSEDICTIONARYOF_H
23 
24 namespace FX {
25 
26 
33 template<typename TYPE>
35 public:
36 
39 
42 
45 
48 
50  FXival find(TYPE* ky) const { return FXReverseDictionary::find(ky); }
51 
53  FXbool has(TYPE* ky) const { return FXReverseDictionary::has(ky); }
54 
56  FXString& at(TYPE* ky){ return FXReverseDictionary::at(ky); }
57 
59  const FXString& at(TYPE* ky) const { return FXReverseDictionary::at(ky); }
60 
62  FXString& operator[](TYPE* ky){ return FXReverseDictionary::at(ky); }
63 
65  const FXString& operator[](TYPE* ky) const { return FXReverseDictionary::at(ky); }
66 
68  FXString insert(TYPE* ky,const FXString& str=FXString::null){ return FXReverseDictionary::insert(ky,str); }
69 
71  FXString remove(TYPE* ky){ return FXReverseDictionary::remove(ky); }
72 
74  FXString erase(FXival pos){ return FXReverseDictionary::erase(pos); }
75 
77  TYPE* key(FXival pos) const { return reinterpret_cast<TYPE*&>(FXReverseDictionary::key(pos)); }
78 
80  FXString& data(FXival pos){ return FXReverseDictionary::data(pos); }
81 
83  const FXString& data(FXival pos) const { return FXReverseDictionary::data(pos); }
84  };
85 
86 }
87 
88 #endif
FXString & at(const void *ky)
Return reference to slot assocated with given key.
FXival find(const void *ky) const
Find position of given key, returning -1 if not found.
FXString remove(const void *ky)
Remove association with given key; return old value, if any.
FXbool has(const void *ky) const
Check if key is mapped.
Definition: FXReverseDictionary.h:90
FXString & data(FXival pos)
Return reference to slot at position pos.
Definition: FXReverseDictionaryOf.h:80
FXString insert(TYPE *ky, const FXString &str=FXString::null)
Insert association with given key; return old value, if any.
Definition: FXReverseDictionaryOf.h:68
FXString erase(FXival pos)
Erase data at pos in the table; return old value, if any.
Definition: FXReverseDictionaryOf.h:74
FXival find(TYPE *ky) const
Find position of given key, returning -1 if not found.
Definition: FXReverseDictionaryOf.h:50
const FXString & operator[](TYPE *ky) const
Return constant reference to slot assocated with given key.
Definition: FXReverseDictionaryOf.h:65
FXReverseDictionaryOf< TYPE > & operator=(const FXReverseDictionaryOf< TYPE > &other)
Assignment operator.
Definition: FXReverseDictionaryOf.h:44
FXReverseDictionary & operator=(const FXReverseDictionary &other)
Assignment operator.
const FXString & at(TYPE *ky) const
Return constant reference to slot assocated with given key.
Definition: FXReverseDictionaryOf.h:59
The reverse dictionary class is a fast-access hash table, mapping void-pointers to strings...
Definition: FXReverseDictionary.h:39
FXReverseDictionaryOf(const FXReverseDictionaryOf< TYPE > &other)
Copy constructor.
Definition: FXReverseDictionaryOf.h:41
FXReverseDictionaryOf()
Default constructor.
Definition: FXReverseDictionaryOf.h:38
FXReverseDictionaryOf< TYPE > & adopt(FXReverseDictionaryOf< TYPE > &other)
Adopt reverse dictionary from another.
Definition: FXReverseDictionaryOf.h:47
Definition: FX4Splitter.h:28
FXString & at(TYPE *ky)
Return reference to slot assocated with given key.
Definition: FXReverseDictionaryOf.h:56
FXString & data(FXival pos)
Return reference to slot at position pos.
Definition: FXReverseDictionary.h:120
const FXString & data(FXival pos) const
Return constant reference to slot at position pos.
Definition: FXReverseDictionaryOf.h:83
const void * key(FXival pos) const
Return key at position pos.
Definition: FXReverseDictionary.h:117
FXString & operator[](TYPE *ky)
Return reference to slot assocated with given key.
Definition: FXReverseDictionaryOf.h:62
FXString insert(const void *ky, const FXString &str=FXString::null)
Insert association with given key; return old value, if any.
Definition: FXReverseDictionary.h:105
FXReverseDictionary & adopt(FXReverseDictionary &other)
Adopt dictionary from another.
Dictionary of pointers to TYPE.
Definition: FXReverseDictionaryOf.h:34
FXbool has(TYPE *ky) const
Check if key is mapped.
Definition: FXReverseDictionaryOf.h:53
TYPE * key(FXival pos) const
Return key at position pos.
Definition: FXReverseDictionaryOf.h:77
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42
FXString erase(FXival pos)
Erase data at pos in the table; return old value, if any.

Copyright © 1997-2022 Jeroen van der Zijp