PMap.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PHash.h>
17 #include <PObject.h>
18 #include <PString.h>
19 
20 PAPILLON_BEGIN_NAMESPACE
21 
23 class PList;
24 template<typename K, typename V>
25 class PMapIterator;
27 
28 
46 template<typename K, typename V>
47 class PAPILLON_API_CORE PMap : public PObject
48 {
49 public:
53  PMap();
54 
58  PMap(const PMap<K, V>& other);
59 
63  PMap<K, V>& operator=(const PMap<K, V>& other);
64 
68  PMapIterator<K, V> Iterator() const;
69 
75  void Clear();
76 
82  bool IsEmpty() const;
83 
89  papillon::int32 Size() const;
90 
94  bool Has(const K& key) const;
95 
100  PResult Get(const K& key, V& value) const;
101 
107  PResult Get(const K& key, bool& value) const;
108 
114  PResult Get(const K& key, papillon::int32& value) const;
115 
121  PResult Get(const K& key, papillon::int64& value) const;
122 
128  PResult Get(const K& key, float& value) const;
129 
135  PResult Get(const K& key, double& value) const;
136 
142  PMap<K, V>& Put(const K& key, const V& value);
143 
147  PList GetKeyList() const;
148 
152  PList GetValueList() const;
153 
158  PResult Remove(const K& key);
159 
163  void Merge(const PMap<K, V>& other);
164 };
165 
166 
167 typedef papillon::PMap<papillon::PString, papillon::PObject> PStringMap;
168 
169 
170 PAPILLON_END_NAMESPACE
papillon::PMap< papillon::PString, papillon::PObject > PStringMap
Definition: PMap.h:167
The PResult class represents the result returned by most of Papillon functions; this class is used to...
Definition: PResult.h:159
The PList class represents a generic container which handle an ordered collection of PObject; NOT thr...
Definition: PList.h:46
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
Iterator on a PMap.
Definition: PMapIterator.h:32
functions to compute hash values for PString and PGuid to be able to use them as keys in std::unorder...
Class PString: an unicode character strings (use copy-on-write idiom).
Generic (templated) associative container; NOT thread-safe.
Definition: PMap.h:47
Class PObject: the root class of all Papillon classes.
PObject & operator=(const PObject &obj)
Performs a shared copy of other to this object.
Definition: PObject.h:45