28 #include <initializer_list>
42 template <
class K,
class T>
45 template <
class K,
class T>
49 template <
class K,
class T>
52 template <
class K,
class T>
55 template <
class K,
class T>
68 template <
class K,
class T>
69 class 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
map & operator=(const map &)
Copy a map.
size_t size() const
Get the number of map entries.
bool empty() const
True if the map has no entries.
map & operator=(const std::map< K, T > &)
Copy a std::map.
const proton::value & value() const
Access as a proton::value containing an AMQP map.
map()
Construct an empty map.
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=(map &&)
Move a map.
map(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.
proton::value & value()
Access as a proton::value containing an AMQP map.
void value(const value &x)
Copy from a proton::value.
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
bool exists(const K &k) const
True if the map has an entry for k.
map(const std::initializer_list< std::pair< const K, T >> &)
Initializer_list constructor.
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.
void swap(map< K, T > &, map< K, T > &)
Swap proton::map instances.
std::ostream & operator<<(std::ostream &, const binary &)
Print a binary value.
A holder for any AMQP value, simple or complex.