xtd 0.2.0
Loading...
Searching...
No Matches
xtd::collections::generic::key_value_pair< key_t, value_t > Class Template Reference
Inheritance diagram for xtd::collections::generic::key_value_pair< key_t, value_t >:
xtd::object xtd::iequatable< key_value_pair< key_t, value_t > > xtd::interface xtd::extensions::equality_operators< type_t, equatable_t >

Definition

template<typename key_t, typename value_t>
class xtd::collections::generic::key_value_pair< key_t, value_t >

Defines a key/value pair that can be set or retrieved.

template<typename key_t, typename value_t>
class key_value_pair : public xtd::object, public xtd::iequatable<key_value_pair<key_t, value_t>>;
Defines a key/value pair that can be set or retrieved.
Definition key_value_pair.hpp:36
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:42
Header
#include <xtd/collections/key_value_pair>
Namespace
xtd::collections::generic
Library
xtd.core
Remarks
xtd::collections::generic::key_value_pair is same as std::pair.

Public Aliases

using base_type = std::pair< key_t, value_t >
 Represents the type of the base.
 
using key_type = key_t
 Represents the type of the key.
 
using value_type = value_t
 Representd the type of the value.
 
using first_type = key_type
 Represents the type of the first.
 
using second_type = value_type
 Represents the type of the second.
 

Public Properties

key_t first
 Gets or sets the key in the key/value pair.
 
value_t second
 Gets or sets the value in the key/value pair.
 
const key_t & key () const noexcept
 Gets the key in the key/value pair.
 
const value_t & value () const noexcept
 Gets the value in the key/value pair.
 

Public Constructors

 key_value_pair ()=default
 Initializes a new instance of the key_value_pair<key_t, value_t> class with the default key and value.
 
 key_value_pair (const key_t &key, const value_t &value)
 Initializes a new instance of the key_value_pair<key_t, value_t> class with the specified key and value.
 
 key_value_pair (const std::pair< key_t, value_t > &value)
 Initializes a new instance of the key_value_pair<key_t, value_t> class with the specified key and value.
 

Public Methods

xtd::string to_string () const noexcept override
 Returns a String representation of the key_value_pair<key_t, value_t>, using the String representations of the key and value.
 
bool equals (const key_value_pair &value) const noexcept override
 Determines whether the specified object is equal to the current object.
 
bool equals (const object &obj) const noexcept override
 Determines whether the specified object is equal to the current object.
 

Public Operators

 operator std::pair< key_t, value_t > () const noexcept
 Converts the current key_value_pair to a std::pair.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
- Public Member Functions inherited from xtd::iequatable< key_value_pair< key_t, value_t > >
virtual bool equals (const key_value_pair< key_t, value_t > &) const noexcept=0
 Indicates whether the current object is equal to another object of the same type.
 
- Static Public Member Functions inherited from xtd::object
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<typename object_a_t , typename object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Member Typedef Documentation

◆ base_type

template<typename key_t , typename value_t >
using xtd::collections::generic::key_value_pair< key_t, value_t >::base_type = std::pair<key_t, value_t>

Represents the type of the base.

◆ key_type

template<typename key_t , typename value_t >
using xtd::collections::generic::key_value_pair< key_t, value_t >::key_type = key_t

Represents the type of the key.

◆ value_type

template<typename key_t , typename value_t >
using xtd::collections::generic::key_value_pair< key_t, value_t >::value_type = value_t

Representd the type of the value.

◆ first_type

template<typename key_t , typename value_t >
using xtd::collections::generic::key_value_pair< key_t, value_t >::first_type = key_type

Represents the type of the first.

◆ second_type

template<typename key_t , typename value_t >
using xtd::collections::generic::key_value_pair< key_t, value_t >::second_type = value_type

Represents the type of the second.

Constructor & Destructor Documentation

◆ key_value_pair() [1/3]

template<typename key_t , typename value_t >
xtd::collections::generic::key_value_pair< key_t, value_t >::key_value_pair ( )
default

Initializes a new instance of the key_value_pair<key_t, value_t> class with the default key and value.

◆ key_value_pair() [2/3]

template<typename key_t , typename value_t >
xtd::collections::generic::key_value_pair< key_t, value_t >::key_value_pair ( const key_t &  key,
const value_t &  value 
)
inline

Initializes a new instance of the key_value_pair<key_t, value_t> class with the specified key and value.

Parameters
KeyThe object defined in each key/value pair
valueThe definition associated with key

◆ key_value_pair() [3/3]

template<typename key_t , typename value_t >
xtd::collections::generic::key_value_pair< key_t, value_t >::key_value_pair ( const std::pair< key_t, value_t > &  value)
inline

Initializes a new instance of the key_value_pair<key_t, value_t> class with the specified key and value.

Parameters
valueThe key and value of the key_value_pair<key_t, value_t>.

Member Function Documentation

◆ key()

template<typename key_t , typename value_t >
const key_t & xtd::collections::generic::key_value_pair< key_t, value_t >::key ( ) const
inlinenoexcept

Gets the key in the key/value pair.

Returns
key_t A key_t that is the key of the key_value_pair<key_t, value_t>.

◆ value()

template<typename key_t , typename value_t >
const value_t & xtd::collections::generic::key_value_pair< key_t, value_t >::value ( ) const
inlinenoexcept

Gets the value in the key/value pair.

Returns
value_t A value_t that is the value of the key_value_pair<key_t, value_t>.

◆ to_string()

template<typename key_t , typename value_t >
xtd::string xtd::collections::generic::key_value_pair< key_t, value_t >::to_string ( ) const
overridevirtualnoexcept

Returns a String representation of the key_value_pair<key_t, value_t>, using the String representations of the key and value.

Returns
const String A String representation of the key_value_pair<key_t, value_t>, which includes the String representations of the key and value.
String

Reimplemented from xtd::object.

◆ equals() [1/2]

template<typename key_t , typename value_t >
bool xtd::collections::generic::key_value_pair< key_t, value_t >::equals ( const key_value_pair< key_t, value_t > &  value) const
inlineoverridenoexcept

Determines whether the specified object is equal to the current object.

Parameters
valueThe key_value_pair to compare with the current object.
Returns
true if the specified object is equal to the current object; otherwise, false.

◆ equals() [2/2]

template<typename key_t , typename value_t >
bool xtd::collections::generic::key_value_pair< key_t, value_t >::equals ( const object obj) const
inlineoverridevirtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object; otherwise, false

Reimplemented from xtd::object.

◆ operator std::pair< key_t, value_t >()

template<typename key_t , typename value_t >
xtd::collections::generic::key_value_pair< key_t, value_t >::operator std::pair< key_t, value_t > ( ) const
inlinenoexcept

Converts the current key_value_pair to a std::pair.

Returns
A std::pair that is the current key_value_pair<key_t, value_t>.

Member Data Documentation

◆ first

template<typename key_t , typename value_t >
key_t xtd::collections::generic::key_value_pair< key_t, value_t >::first

Gets or sets the key in the key/value pair.

◆ second

template<typename key_t , typename value_t >
value_t xtd::collections::generic::key_value_pair< key_t, value_t >::second

Gets or sets the value in the key/value pair.


The documentation for this class was generated from the following file: