4#include "system/get_hash_code.h"
5#include <system/boxed_value.h>
10namespace Collections {
18template<
typename TKey,
typename TValue>
30 KeyValuePair(
const TKey& key,
const TValue& value) : m_pair(key, value) {}
35 template <
typename OtherK,
typename OtherV>
36 KeyValuePair(
const std::pair<OtherK, OtherV>& pair) : m_pair(pair) {}
40 const TKey&
get_Key()
const {
return m_pair.first; }
43 const TValue&
get_Value()
const {
return m_pair.second; }
46 bool IsNull()
const {
return false; }
59 return u
"[" + ToStringHelper(get_Key()) + u
", " + ToStringHelper(get_Value()) + u
"]";
68#ifdef ASPOSE_GET_SHARED_MEMBERS
69 void PopulateSharedMembers(Object::shared_members_type& result)
const
71 result.Add(
"KeyValuePair::Key", this->m_pair.first);
72 result.Add(
"KeyValuePair::Value", this->m_pair.second);
82 static typename std::enable_if<std::is_arithmetic<C>::value || std::is_enum<C>::value,
String>::type
83 ToStringHelper(
const C& value)
92 static typename std::enable_if<(!std::is_arithmetic<C>::value && !std::is_enum<C>::value && !
IsSmartPtr<C>::value),
String>::type
93 ToStringHelper(
const C& obj)
102 static typename std::enable_if<IsSmartPtr<C>::value, String>::type
103 ToStringHelper(
const C& obj)
107 return obj.GetObjectOrNull()->ToString();
112 static String ToStringHelper(
const String& s)
125template<
typename TKey,
typename TValue>
137template<
typename TKey,
typename TValue>
140 return ! (left == right);
149template<
typename TKey,
typename TValue>
162template<
typename TKey,
typename TValue>
182template<
typename TKey,
typename TValue>
struct IsBoxable<Collections::Generic::KeyValuePair<TKey, TValue>> : std::true_type {};
187template<
typename TKey,
typename TValue>
188class BoxedValue<
System::Collections::Generic::KeyValuePair<TKey, TValue>> :
public DefaultBoxedValue<System::Collections::Generic::KeyValuePair<TKey, TValue>>
194 : DefaultBoxedValue<
System::Collections::Generic::KeyValuePair<TKey, TValue>>(value)
207template<
typename TKey,
typename TValue>
208struct hash<
System::Collections::Generic::KeyValuePair<TKey, TValue> >
BoxedValue(const T &value)
Constructs an object that represents the specified value boxed.
Definition: boxed_value.h:192
Pair of key and value. This type should be allocated on stack and passed to functions by value or by ...
Definition: keyvalue_pair.h:20
int GetHashCode() const
Calculates key-value pair hash by xoring key's and value's hashes.
Definition: keyvalue_pair.h:63
const TKey & get_Key() const
Gets key.
Definition: keyvalue_pair.h:40
KeyValuePair()
Null key-value pair initializer.
Definition: keyvalue_pair.h:26
bool IsNull() const
Always returns false.
Definition: keyvalue_pair.h:46
String ToString() const
Converts key-value pair to string.
Definition: keyvalue_pair.h:57
KeyValuePair(const TKey &key, const TValue &value)
Constructor.
Definition: keyvalue_pair.h:30
KeyValuePair(const std::pair< OtherK, OtherV > &pair)
Type conversion constructor.
Definition: keyvalue_pair.h:36
const TValue & get_Value() const
Gets value.
Definition: keyvalue_pair.h:43
std::pair< TKey, TValue > m_pair
Internal data structure.
Definition: keyvalue_pair.h:23
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
static String Format(const SharedPtr< IFormatProvider > &fp, const String &format, const Args &... args)
Formats string in C# style.
Definition: string.h:1405
String ToString() const
Wrapper for handling String class in contexts where ToString() is being called on value type objects.
Definition: string.h:494
std::ostream & operator<<(std::ostream &stream, const KeyValuePair< TKey, TValue > &pair)
Insert data into the stream using UTF-8 encoding.
Definition: keyvalue_pair.h:150
bool operator!=(const KeyValuePair< TKey, TValue > &left, const KeyValuePair< TKey, TValue > &right)
Compares two key-value pairs using inverse 'equals' semantics.
Definition: keyvalue_pair.h:138
bool operator==(const KeyValuePair< TKey, TValue > &left, const KeyValuePair< TKey, TValue > &right)
Compares two key-value pairs using 'equals' semantics. Uses operator == or EqualsTo method for both k...
Definition: keyvalue_pair.h:126
Definition: db_command.h:9
std::enable_if< std::is_scalar< T >::value, int >::type GetHashCode(const T &obj)
Returns a hash code for the specified scalar value.
Definition: get_hash_code.h:21
constexpr bool operator<(std::nullptr_t, DateTime)
Definition: date_time.h:712
Trait class to check if a type is a specialization of SmartPtr class.
Definition: smart_ptr.h:1499