xtd 1.0.0
Loading...
Searching...
No Matches
idictionary.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "icollection.hpp"
6#include "key_value_pair.hpp"
7#define __XTD_CORE_INTERNAL__
9#undef __XTD_CORE_INTERNAL__
10//#include "list.hpp"
11
13namespace xtd {
15 namespace collections {
17 namespace generic {
46 template<typename key_t, typename value_t>
47 class idictionary : public xtd::collections::generic::icollection<xtd::collections::generic::key_value_pair<key_t, value_t>> {
48 public:
50
53 using key_type = key_t;
55 using mapped_type = value_t;
57 using value_type = typename xtd::collections::generic::icollection<xtd::collections::generic::key_value_pair<key_t, value_t>>::value_type;
59 using iterator = typename xtd::collections::generic::icollection<value_type>::iterator;
61 using const_iterator = typename xtd::collections::generic::icollection<value_type>::const_iterator;
67
69
73 [[nodiscard]] virtual auto count() const noexcept -> xtd::usize = 0;
74
75
79 [[nodiscard]] virtual auto is_read_only() const noexcept -> bool = 0;
80
95 [[nodiscard]] virtual auto is_synchronized() const noexcept -> bool = 0;
96
100 [[nodiscard]] virtual auto keys() const noexcept -> key_collection = 0;
101
123 [[nodiscard]] virtual auto sync_root() const noexcept -> const xtd::object& = 0;
124
128 [[nodiscard]] virtual auto values() const noexcept -> value_collection = 0;
130
132
137 virtual auto add(const xtd::collections::generic::key_value_pair<key_t, value_t>& item) -> void = 0;
138
146 virtual auto add(const key_t& key, const value_t& value) -> void = 0;
147
151 virtual auto clear() -> void = 0;
152
157 [[nodiscard]] virtual auto contains(const xtd::collections::generic::key_value_pair<key_t, value_t>& item) const noexcept -> bool = 0;
158
163 [[nodiscard]] virtual auto contains_key(const key_t& key) const noexcept -> bool = 0;
164
169 virtual auto copy_to(xtd::array<xtd::collections::generic::key_value_pair<key_t, value_t>>& array, xtd::usize array_index) const -> void = 0;
170
173 [[nodiscard]] virtual auto get_enumerator() const -> xtd::collections::generic::enumerator<xtd::collections::generic::key_value_pair<key_t, value_t>> = 0;
174
181 virtual auto remove(const xtd::collections::generic::key_value_pair<key_t, value_t>& item) -> bool = 0;
182
187 virtual auto remove(const key_t& key) noexcept -> bool = 0;
188
195 [[nodiscard]] virtual auto try_get_value(const key_t& key, value_t& value) const -> bool = 0;
197
199
209 [[nodiscard]] virtual auto operator [](const key_t& key) const -> const value_t& = 0;
218 [[nodiscard]] virtual auto operator [](const key_t& key) -> value_t& = 0;
220 };
221 }
222 }
223}
224
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
Represents a generic collection of key/value pairs.
Definition idictionary.hpp:47
xtd::collections::generic::list< mapped_type > value_collection
Represents the idictionary value collection type.
Definition idictionary.hpp:65
virtual auto contains(const xtd::collections::generic::key_value_pair< xtd::any_object, xtd::any_object > &item) const noexcept -> bool=0
virtual auto try_get_value(const xtd::any_object &key, xtd::any_object &value) const -> bool=0
virtual auto add(const xtd::collections::generic::key_value_pair< xtd::any_object, xtd::any_object > &item) -> void=0
xtd::collections::generic::list< key_type > key_collection
Represents the idictionary key collection type.
Definition idictionary.hpp:63
virtual auto keys() const noexcept -> key_collection=0
typename xtd::collections::generic::icollection< value_type >::const_iterator const_iterator
Represents the const iterator of xtd::collections::generic::ienumerable value type.
Definition idictionary.hpp:61
virtual auto sync_root() const noexcept -> const xtd::object &=0
virtual auto count() const noexcept -> xtd::usize=0
Gets the number of elements contained in the xtd::collections::generic::icollection <type_t>.
virtual auto remove(const xtd::collections::generic::key_value_pair< xtd::any_object, xtd::any_object > &item) -> bool=0
key_t key_type
Represents the dictionary key type.
Definition idictionary.hpp:53
virtual auto get_enumerator() const -> xtd::collections::generic::enumerator< xtd::collections::generic::key_value_pair< xtd::any_object, xtd::any_object > >=0
typename xtd::collections::generic::icollection< value_type >::iterator iterator
Represents the iterator of xtd::collections::generic::ienumerable value type.
Definition idictionary.hpp:59
value_t mapped_type
Represents the dictionary mapped type.
Definition idictionary.hpp:55
virtual auto copy_to(xtd::array< xtd::collections::generic::key_value_pair< xtd::any_object, xtd::any_object > > &array, xtd::usize array_index) const -> void=0
typename xtd::collections::generic::icollection< xtd::collections::generic::key_value_pair< key_t, value_t > >::value_type value_type
Represents the xtd::collections::generic::idictionary value type.
Definition idictionary.hpp:57
virtual auto contains_key(const xtd::any_object &key) const noexcept -> bool=0
virtual auto values() const noexcept -> value_collection=0
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:80
Contains xtd::collections::generic::icollection <type_t> interface.
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
Contains xtd::collections::generic::key_value_pair <key_t, value_t> struct.
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Supports a simple iteration over a generic collection.
Definition enumerator.hpp:39
Defines a key/value pair that can be set or retrieved.
Definition key_value_pair.hpp:37