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;
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
Defines methods to manipulate generic collections.
Definition icollection.hpp:45
typename xtd::collections::generic::ienumerable< type_t >::const_iterator const_iterator
Represents the const iterator of xtd::collections::generic::ienumerable value type.
Definition icollection.hpp:55
typename xtd::collections::generic::ienumerable< type_t >::iterator iterator
Represents the iterator of xtd::collections::generic::ienumerable value type.
Definition icollection.hpp:53
Represents a generic collection of key/value pairs.
Definition idictionary.hpp:44
virtual bool remove(const key_t &key) noexcept=0
Removes the element with the specified key from the xtd::collections::generic::idictionary <key_t,...
virtual bool try_get_value(const key_t &key, value_t &value) const =0
Gets the value associated with the specified key.
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
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 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 key_t &key) const noexcept=0
Determines whether the xtd::collections::generic::idictionary <key_t, value_t> contains an element wi...
virtual value_collection values() const noexcept=0
Gets an xtd::collections::generic::icollection <type_t> containing the values of the xtd::collections...
value_t mapped_type
Represents the dictionary mapped type.
Definition idictionary.hpp:52
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:80
@ add
The Add key.
Contains xtd::collections::ienumerator alias.
Contains xtd::collections::generic::key_value_pair <key_t, value_t> struct.
Contains xtd::collections::generic::list <value_t> class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Defines a key/value pair that can be set or retrieved.
Definition key_value_pair.hpp:37