xtd 0.2.0
idictionary.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "icollection.hpp"
6#include "key_value_pair.hpp"
7#include "list.hpp"
8
10namespace xtd {
12 namespace collections {
14 namespace generic {
43 template<class key_t, class value_t>
44 class idictionary : public xtd::collections::generic::icollection<xtd::collections::generic::key_value_pair<key_t, value_t>> {
45 public:
47
50 using key_type = key_t;
52 using mapped_type = value_t;
54 using value_type = typename xtd::collections::generic::icollection<xtd::collections::generic::key_value_pair<key_t, value_t>>::value_type;
56 using iterator = typename xtd::collections::generic::icollection<value_type>::iterator;
58 using const_iterator = typename xtd::collections::generic::icollection<value_type>::const_iterator;
64
66
71 virtual key_collection keys() const noexcept = 0;
72
76 virtual value_collection values() const noexcept = 0;
78
80
82 using xtd::collections::generic::icollection<xtd::collections::generic::key_value_pair<key_t, value_t>>::add;
90 virtual void add(const key_t& key, const value_t value) = 0;
91
96 virtual bool contains_key(const key_t& key) const noexcept = 0;
97
98 using xtd::collections::generic::icollection<xtd::collections::generic::key_value_pair<key_t, value_t>>::remove;
103 virtual bool remove(const key_t& key) noexcept = 0;
104
111 virtual bool try_get_value(const key_t& key, value_t& value) const = 0;
113
115
125 virtual const value_t& operator [](const key_t& key) const = 0;
134 virtual value_t& operator [](const key_t& key) = 0;
136 };
137 }
138 }
139}
140
Represents a generic collection of key/value pairs.
Definition idictionary.hpp:44
xtd::collections::generic::list< mapped_type > value_collection
Represents the idictionary value collection type.
Definition idictionary.hpp:62
xtd::collections::generic::list< key_type > key_collection
Represents the idictionary key collection type.
Definition idictionary.hpp:60
virtual bool remove(const xtd::any_object &key) noexcept=0
virtual bool try_get_value(const xtd::any_object &key, xtd::any_object &value) const=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:58
virtual key_collection keys() const noexcept=0
Gets an xtd::collections::generic::icollection <type_t> containing the keys of the xtd::collections::...
key_t key_type
Represents the dictionary key type.
Definition idictionary.hpp:50
typename xtd::collections::generic::icollection< value_type >::iterator iterator
Represents the iterator of xtd::collections::generic::ienumerable value type.
Definition idictionary.hpp:56
virtual bool contains_key(const xtd::any_object &key) const noexcept=0
value_t mapped_type
Represents the dictionary mapped type.
Definition idictionary.hpp:52
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:54
virtual void add(const xtd::any_object &key, const xtd::any_object value)=0
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:79
Contains xtd::collections::generic::icollection <type_t> interface.
Contains xtd::collections::generic::key_value_pair <key_t, value_t> struct.
Contains xtd::collections::generic::list <value_t> class.
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
Defines a key/value pair that can be set or retrieved.
Definition key_value_pair.hpp:37