71 for (
const auto& kv : init)
Set(kv.first, kv.second);
75 void Set(std::string key, std::string val) {
77 if (it != m_items.end()) it->second = std::move(val);
78 else m_items.emplace_back(std::move(key), std::move(val));
81 const std::string*
Get(std::string_view key)
const {
83 return it == m_items.end() ? nullptr : &it->second;
86 std::string
GetOr(std::string_view key, std::string_view fallback)
const {
88 return v ? *v : std::string(fallback);
92 return Find(key) != m_items.end();
95 bool Erase(std::string_view key) {
97 if (it == m_items.end())
return false;
102 bool Empty()
const {
return m_items.empty(); }
103 std::size_t
Size()
const {
return m_items.size(); }
104 void Reserve(std::size_t n) { m_items.reserve(n); }
115 return std::find_if(m_items.begin(), m_items.end(),
116 [&](
const value_type& kv) { return kv.first == key; });
118 iterator Find(std::string_view key) {
119 return std::find_if(m_items.begin(), m_items.end(),
120 [&](
const value_type& kv) { return kv.first == key; });
139 : m_on_destruct(std::move(on_destruct)) {}
147 void Reset() { m_on_destruct =
nullptr; }
150 UnregisterCallback m_on_destruct;
163 : m_flag(std::move(flag)) {}
165 return m_flag && m_flag->load(std::memory_order_acquire);
168 std::shared_ptr<std::atomic_bool> m_flag;
175 void Cancel() { m_flag->store(
true, std::memory_order_release); }
176 bool Cancelled()
const {
return m_flag->load(std::memory_order_acquire); }
178 std::shared_ptr<std::atomic_bool> m_flag;
221 std::vector<std::uint8_t>,
223 std::vector<std::int32_t>,
224 std::vector<std::uint32_t>,
225 std::vector<std::int64_t>,
226 std::vector<std::uint64_t>,
229 std::vector<std::string>,
253 std::optional<std::chrono::system_clock::time_point>
timestamp;
281 std::optional<ConnectionInfo>
info;
459 std::vector<SubscribeItemResult>
items;
466 std::vector<UnsubscribeItemResult>
items;