28#include <initializer_list>
42template <
class K,
class T>
45template <
class K,
class T>
49template <
class K,
class T>
52template <
class K,
class T>
55template <
class K,
class T>
68template <
class K,
class T>
69class PN_CPP_CLASS_EXTERN
map {
70 template <
class M,
class U=
void>
71 struct assignable_map :
72 public std::enable_if<codec::is_encodable_map<M,K,T>::value, U> {};
85 PN_CPP_EXTERN
map(
const std::map<K, T>&);
91 PN_CPP_EXTERN
map(
const std::initializer_list<std::pair<const K, T>>&);
103 typename assignable_map<M, map&>::type
operator=(
const M& x) {
value(x);
return *
this; }
119 PN_CPP_EXTERN T
get(
const K& k)
const;
122 PN_CPP_EXTERN
void put(
const K& k,
const T& v);
125 PN_CPP_EXTERN
size_t erase(
const K& k);
128 PN_CPP_EXTERN
bool exists(
const K& k)
const;
131 PN_CPP_EXTERN
size_t size()
const;
140 explicit map(pn_data_t*);
141 void reset(pn_data_t*);
145 typedef map_type_impl<K,T> map_type;
146 mutable std::unique_ptr<map_type> map_;
149 map_type& cache()
const;
155 friend PN_CPP_EXTERN
void swap<>(
map&,
map&);
Unsettled API - A stream-like decoder from AMQP bytes to C++ values.
Definition: decoder.hpp:56
Unsettled API - A stream-like encoder from C++ values to AMQP bytes.
Definition: encoder.hpp:50
A collection of key-value pairs.
Definition: map.hpp:69
size_t size() const
Get the number of map entries.
const proton::value & value() const
Access as a proton::value containing an AMQP map.
proton::value & value()
Access as a proton::value containing an AMQP map.
assignable_map< M, map & >::type operator=(const M &x)
Type-safe assign from a compatible map, for instance std::map<K,T>.
Definition: map.hpp:103
map & operator=(map &&)
Move a map.
bool empty() const
True if the map has no entries.
map()
Construct an empty map.
map(const std::initializer_list< std::pair< const K, T > > &)
Initializer_list constructor.
size_t erase(const K &k)
Erase the map entry at k.
T get(const K &k) const
Get the map entry for key k.
map(const std::map< K, T > &)
Copy a std::map.
map & operator=(const std::map< K, T > &)
Copy a std::map.
map(const map &)
Copy a map.
map & operator=(const map &)
Copy a map.
void put(const K &k, const T &v)
Put a map entry for key k.
void clear()
Remove all map entries.
void value(const value &x)
Copy from a proton::value.
bool exists(const K &k) const
True if the map has an entry for k.
A holder for any AMQP value, simple or complex.
Definition: value.hpp:57
The main Proton namespace.
Definition: annotation_key.hpp:33
proton::codec::decoder & operator>>(proton::codec::decoder &d, map< K, T > &m)
Decode from a proton::map.
std::ostream & operator<<(std::ostream &, const binary &)
Print a binary value.
void swap(map< K, T > &, map< K, T > &)
Swap proton::map instances.
A holder for any AMQP value, simple or complex.