Provides static methods that emulate C# Object methods called for non-Object C++ types (strings, numbers, etc.). This is a static type with no instance services. You should never create instances of it by any means. More...

#include "object_ext.h"

Inherits System::ObjectType.

Public Member Functions

template<>
bool Equals (const float &obj, const float &another)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 
template<>
bool Equals (const double &obj, const double &another)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 
template<>
SmartPtr< ObjectBox (const String &value)
 Boxes string values. More...
 
template<>
String Unbox (const SmartPtr< Object > &obj)
 Unboxes string values. More...
 
- Public Member Functions inherited from System::ObjectType
template<>
const System::TypeInfoGetType ()
 Implements typeof() translation. Overload for uint8_t. More...
 
template<>
const System::TypeInfoGetType ()
 Implements typeof() translation. Overload for char16_t. More...
 
template<>
const System::TypeInfoGetType ()
 Implements typeof() translation. Overload for int32_t. More...
 
template<>
const System::TypeInfoGetType ()
 Implements typeof() translation. Overload for int64_t. More...
 
template<>
const System::TypeInfoGetType ()
 Implements typeof() translation. Overload for bool. More...
 
template<>
const System::TypeInfoGetType ()
 Implements typeof() translation. Overload for Void. More...
 

Static Public Member Functions

template<typename T >
static int GetHashCode (const T &obj)
 Implements GetHashCode() calls; works on both Object subclasses and unrelated types. More...
 
template<typename T , typename T2 >
static std::enable_if< IsExceptionWrapper< T >::value, bool >::type Equals (const T &obj, const T2 &another)
 
template<typename T , typename T2 >
static std::enable_if< IsSmartPtr< T >::value, bool >::type Equals (const T &obj, const T2 &another)
 Substitution for C# Object.Equals calls working for any type in C++. Overload for smart pointer types. More...
 
template<typename T , typename T2 >
static std::enable_if<!IsExceptionWrapper< T >::value &&!IsSmartPtr< T >::value &&!std::is_scalar< T >::value, bool >::type Equals (T obj, const T2 &another)
 Substitution for C# Object.Equals calls working for any type in C++. Overload for structure types. More...
 
template<typename T , typename T2 >
static std::enable_if<!IsSmartPtr< T >::value &&std::is_scalar< T >::value, bool >::type Equals (const T &obj, const T2 &another)
 Substitution for C# Object.Equals calls working for any type in C++. Overload for scalar types. More...
 
template<size_t N>
static bool Equals (const char_t(&obj)[N], String another)
 Substitution for C# Object.Equals calls working for any type in C++. Overload for string literal with string comparison. More...
 
static String ToString (const char_t *obj)
 Substitution for C# ToString method to work on any C++ type. More...
 
template<typename T >
static String ToString (const Nullable< T > &obj)
 Substitution for C# ToString method to work on any C++ type. More...
 
template<typename T >
static std::enable_if< std::is_enum< T >::value, String >::type ToString (const T &obj)
 Substitution for C# ToString method to work on any C++ type. More...
 
template<typename T >
static std::enable_if< IsSmartPtr< T >::value, String >::type ToString (const T &obj)
 Substitution for C# ToString method to work on any C++ type. More...
 
template<typename T >
static std::enable_if< IsSmartPtr< T >::value||std::is_pointer< T >::value||IsExceptionWrapper< T >::value, String >::type ToString (T &obj)
 Substitution for C# ToString method to work on any C++ type. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value &&std::is_scalar< T >::value &&!std::is_enum< T >::value, String >::type ToString (T &obj)
 Substitution for C# ToString method to work on any C++ type. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value &&std::is_scalar< T >::value &&!std::is_enum< T >::value, String >::type ToString (T &&obj)
 Substitution for C# ToString method to work on any C++ type. More...
 
template<typename T >
static std::enable_if<!IsExceptionWrapper< T >::value &&!IsSmartPtr< T >::value &&!std::is_scalar< T >::value &&!IsNullable< T >::value, String >::type ToString (T &obj)
 Substitution for C# ToString method to work on any C++ type. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value &&!std::is_scalar< T >::value &&!IsNullable< T >::value, String >::type ToString (const T &obj)
 Substitution for C# ToString method to work on any C++ type. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value &&!std::is_scalar< T >::value &&!IsNullable< T >::value &&!std::is_reference< T >::value, String >::type ToString (T &&obj)
 Substitution for C# ToString method to work on any C++ type. More...
 
template<typename T >
static std::enable_if< std::is_enum< T >::value, System::SmartPtr< System::Object > >::type Box (const T &value)
 Boxes value types for converting to Object. Implementation for enum types. More...
 
template<typename T >
static std::enable_if<!std::is_enum< T >::value &&!IsNullable< T >::value, System::SmartPtr< System::Object > >::type Box (const T &value)
 Boxes value types for converting to Object. Implementation for non-enum types. More...
 
template<typename T >
static std::enable_if< IsNullable< T >::value, System::SmartPtr< System::Object > >::type Box (const T &value)
 Boxes Nullable types for converting to Object. More...
 
template<typename T >
static std::enable_if< std::is_enum< T >::value, T >::type Unbox (const SmartPtr< Object > &obj)
 Unboxes value types after converting to Object. Implementation for enum types. More...
 
template<class T >
static std::enable_if<!std::is_enum< T >::value &&detail::has_operator_equal< T >::value, T >::type Unbox (const SmartPtr< Object > &obj)
 Unboxes value types after converting to Object. Implementation for non-enum & non-nullable types. More...
 
template<class T >
static std::enable_if<!std::is_enum< T >::value &&!detail::has_operator_equal< T >::value, T >::type Unbox (const SmartPtr< Object > &obj)
 Unboxes value types after converting to Object. Implementation for non-enum & non-nullable types. More...
 
template<class T , class E >
static std::enable_if< std::is_enum< E >::value &&std::numeric_limits< T >::is_integer, T >::type Unbox (E e)
 Unboxes enum types to integer. More...
 
template<class T , class E >
static std::enable_if< std::is_enum< E >::value &&std::is_enum< T >::value, T >::type Unbox (E e)
 Converts enum types. More...
 
static ASPOSECPP_SHARED_API String UnboxStringSafe (const SmartPtr< Object > &obj)
 Unboxes string from boxed value. More...
 
template<class T >
static Nullable< T > UnboxToNullable (const SmartPtr< Object > &obj, bool safe=true)
 Unboxes object to nullable type. More...
 
template<class T , class U >
static std::enable_if< std::is_convertible< T, Object >::value &&std::is_final< T >::value &&!System::IsBoxable< T >::value &&System::IsSmartPtr< U >::value, bool >::type Is (const U &obj)
 Implements 'is' operator translation. Specialization for pointer types optimized for 'final' classes. More...
 
template<class T , class U >
static std::enable_if< std::is_convertible< T, Object >::value &&!std::is_final< T >::value &&!System::IsBoxable< T >::value &&System::IsSmartPtr< U >::value, bool >::type Is (const U &obj)
 Implements 'is' operator translation. Specialization for pointer types. More...
 
template<class T >
static std::enable_if< std::is_convertible< T, Object >::value, bool >::type Is (const Object &obj)
 Implements 'is' operator translation. Specialization for value types. More...
 
template<class T >
static std::enable_if<!std::is_convertible< T, Object >::value, bool >::type Is (const Object &obj)
 Implements 'is' operator translation. Specialization for unconvertible types. More...
 
template<class T , class U >
static std::enable_if< IsSmartPtr< T >::value, bool >::type Is (const SmartPtr< U > &obj)
 Implements 'is' operator translation. Specialization for pointer types. More...
 
template<class T , class U >
static std::enable_if< IsExceptionWrapper< T >::value, bool >::type Is (const ExceptionWrapper< U > &obj)
 Implements 'is' operator translation. Specialization for exception wrapper types. More...
 
template<class T >
static std::enable_if< IsNullable< T >::value, bool >::type Is (const SmartPtr< Object > &obj)
 Implements 'is' operator translation. Specialization for nullable types. More...
 
template<class T >
static std::enable_if< System::IsBoxable< T >::value &&!IsNullable< T >::value &&!std::is_enum< T >::value &&detail::has_operator_equal< T >::value, bool >::type Is (const SmartPtr< Object > &obj)
 Implements 'is' operator translation. Specialization for boxable types with == operator defined. More...
 
template<class T >
static std::enable_if< System::IsBoxable< T >::value &&!IsNullable< T >::value &&!std::is_enum< T >::value &&!detail::has_operator_equal< T >::value, bool >::type Is (const SmartPtr< Object > &obj)
 Implements 'is' operator translation. Specialization for boxable types without defined ==. More...
 
template<class T , class U >
static std::enable_if< std::is_enum< T >::value, bool >::type Is (const SmartPtr< U > &obj)
 Implements 'is' operator translation. Specialization for enum types. More...
 
template<class T , class U >
static std::enable_if< std::is_enum< T >::value, bool >::type Is (const WeakPtr< U > &obj)
 Implements 'is' operator translation. Specialization for enum types vs weak pointers. More...
 
template<class T , class U >
static bool Is (const Nullable< U > &value)
 Implements 'is' operator translation. Specialization for Nullable type. More...
 
template<class T >
static bool Is (const char16_t *str)
 Implements 'is' operator translation. Specialization for string literal. More...
 
template<class T >
static bool Is (int32_t value)
 Implements 'is' operator translation. Specialization for integer literal. More...
 
static ASPOSECPP_SHARED_API bool IsBoxedValue (const SmartPtr< Object > &obj)
 Checks if object is a boxed value. More...
 
template<typename T >
static std::enable_if< IsSmartPtr< T >::value, System::SmartPtr< Object > >::type UnknownToObject (T obj)
 Converts unknown type to Object, handling both smart pointer type and value type situations. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, System::SmartPtr< Object > >::type UnknownToObject (const T &obj)
 Converts unknown type to Object, handling both smart pointer type and value type situations. More...
 
template<typename T >
static std::enable_if< IsSmartPtr< T >::value, T >::type ObjectToUnknown (SmartPtr< Object > obj)
 Converts Object to unknown type, handling both smart pointer type and bpxed value situations. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, T >::type ObjectToUnknown (SmartPtr< Object > obj)
 Converts Object to unknown type, handling both smart pointer type and boxed value situations. More...
 
template<typename T >
static std::enable_if<!std::is_scalar< T >::value, bool >::type UnknownIsNull (T obj)
 Checks whether unknown type object is nullptr. Overload for non-scalar types. More...
 
template<typename T >
static std::enable_if< std::is_scalar< T >::value, bool >::type UnknownIsNull (T obj)
 Checks whether unknown type object is nullptr. Overload for scalar types. More...
 
template<typename RT1 , typename RT2 , typename F >
static std::conditional< std::is_convertible< RT2, RT1 >::value, RT1, RT2 >::type CoalesceInternal (RT1 value, F func)
 Implementation of '??' operator translation for non-nullable types. Overload for case if RT2 is convertable to RT1. More...
 
template<typename T0 , typename T1 >
static auto Coalesce (T0 value, T1 func)
 Implementation of '??' operator translation for non-nullable types. More...
 
template<typename T0 , typename T1 >
static T0 Coalesce (System::Nullable< T0 > value, T1 func)
 Implementation of '??' operator translation for nullable types. More...
 
template<typename T >
static SmartPtr< System::BoxedValueBaseBoxEnum (T enumValue)
 Boxes enum types for being propagated as Object. More...
 
template<typename To , typename ... From>
static std::enable_if<(std::is_fundamental< To >::value), std::array< To, sizeof...(From)> >::type ArrayInitializerCast (From ...args)
 Converts array fundamental values (which C# does implicitly but C++ apparently does not). More...
 
static ASPOSECPP_SHARED_API SmartPtr< System::Collections::IListCastToIList (const SmartPtr< Object > &obj)
 
template<typename T >
static std::enable_if< System::IsBoxable< T >::value, System::SharedPtr< System::Object > >::type ExplicitCastToObject (const T &value)
 
template<typename T >
static std::enable_if< System::IsSmartPtr< T >::value, System::SharedPtr< System::Object > >::type ExplicitCastToObject (const T &value)
 
- Static Public Member Functions inherited from System::ObjectType
template<typename T >
static std::enable_if< IsSmartPtr< T >::value, const System::TypeInfo & >::type GetType (const T &obj)
 Implements typeof() translation. Overload for smart pointers. More...
 
template<typename T >
static std::enable_if<!IsExceptionWrapper< T >::value &&!IsSmartPtr< T >::value &&!std::is_fundamental< T >::value &&!std::is_enum< T >::value &&!IsNullable< T >::value, const System::TypeInfo & >::type GetType (const T &obj)
 Implements typeof() translation. Overload for structures. More...
 
template<typename T >
static std::enable_if< IsExceptionWrapper< T >::value, const System::TypeInfo & >::type GetType (const T &obj)
 Implements typeof() translation. Overload for exceptions. More...
 
template<typename T >
static std::enable_if< std::is_fundamental< T >::value||std::is_enum< T >::value, const System::TypeInfo & >::type GetType (const T obj)
 Implements typeof() translation. Overload for primitive types. More...
 
template<typename T >
static std::enable_if< IsNullable< T >::value, const System::TypeInfo & >::type GetType (const T obj)
 Implements typeof() translation. Overload for Nullable types. More...
 
template<typename T >
static std::enable_if< std::is_fundamental< T >::value &&!std::is_enum< T >::value, const System::TypeInfo & >::type GetType ()
 Implements typeof() translation. Overload for primitive types. More...
 
template<typename T >
static std::enable_if< std::is_enum< T >::value, const System::TypeInfo & >::type GetType ()
 Implements typeof() translation. Overload for enum types. More...
 
template<typename T >
static std::enable_if<(!std::is_fundamental< T >::value &&!std::is_enum< T >::value &&!IsBoxable< T >::value)||IsExceptionWrapper< T >::value, const System::TypeInfo & >::type GetType ()
 Implements typeof() translation. Overload for structures and pointers. More...
 
template<typename T >
static std::enable_if< IsNullable< T >::value, const System::TypeInfo & >::type GetType ()
 Implements typeof() translation. Overload for Nullable. More...
 
template<typename T >
static std::enable_if< detail::is_a< T, MulticastDelegate >::value, const System::TypeInfo & >::type GetType ()
 Implements typeof() translation. Overload for MutlicastDelegate. More...
 
template<typename T >
static std::enable_if< !std::is_fundamental< T >::value &&!std::is_enum< T >::value &&IsBoxable< T >::value &&!detail::is_a< T, MulticastDelegate >::value &&!IsNullable< T >::value, const System::TypeInfo & >::type GetType ()
 Implements typeof() translation. Overload for structures and pointers. More...
 
static const System::TypeInfoGetType (const String &obj)
 Implements typeof() translation. Overload for string type. More...
 

Detailed Description

Provides static methods that emulate C# Object methods called for non-Object C++ types (strings, numbers, etc.). This is a static type with no instance services. You should never create instances of it by any means.

Member Function Documentation

◆ ArrayInitializerCast()

template<typename To , typename ... From>
static std::enable_if<(std::is_fundamental<To>::value), std::array<To, sizeof...(From)> >::type System::ObjectExt::ArrayInitializerCast ( From ...  args)
inlinestatic

Converts array fundamental values (which C# does implicitly but C++ apparently does not).

Template Parameters
ToTarget type.
FromSource types.
Parameters
argsValues to convert and push to target array.
Returns
Array containing converted copies of all arguments in the same order.

◆ Box() [1/4]

template<typename T >
static std::enable_if<std::is_enum<T>::value, System::SmartPtr<System::Object> >::type System::ObjectExt::Box ( const T &  value)
inlinestatic

Boxes value types for converting to Object. Implementation for enum types.

Template Parameters
TEnum type.
Parameters
valueEnum value to box.
Returns
Smart pointer to object keeping boxed value.

◆ Box() [2/4]

template<typename T >
static std::enable_if<!std::is_enum<T>::value && !IsNullable<T>::value, System::SmartPtr<System::Object> >::type System::ObjectExt::Box ( const T &  value)
inlinestatic

Boxes value types for converting to Object. Implementation for non-enum types.

Template Parameters
TValue type.
Parameters
valueValue to box.
Returns
Smart pointer to object keeping boxed value.

◆ Box() [3/4]

template<typename T >
static std::enable_if<IsNullable<T>::value, System::SmartPtr<System::Object> >::type System::ObjectExt::Box ( const T &  value)
inlinestatic

Boxes Nullable types for converting to Object.

Template Parameters
TValue type.
Parameters
valueValue to box.
Returns
Smart pointer to object keeping boxed value.

◆ Box() [4/4]

template<>
SmartPtr<Object> System::ObjectExt::Box ( const String value)
inline

Boxes string values.

Parameters
valueValue to box.
Returns
Boxed value or null, if source string is null.

◆ BoxEnum()

template<typename T >
static SmartPtr<System::BoxedValueBase> System::ObjectExt::BoxEnum ( enumValue)
inlinestatic

Boxes enum types for being propagated as Object.

Template Parameters
TEnum type to box.
Parameters
enumValueEnum value to box.
Returns
Boxed enum value.

◆ CastToIList()

static ASPOSECPP_SHARED_API SmartPtr<System::Collections::IList> System::ObjectExt::CastToIList ( const SmartPtr< Object > &  obj)
static

◆ Coalesce() [1/2]

template<typename T0 , typename T1 >
static auto System::ObjectExt::Coalesce ( T0  value,
T1  func 
)
inlinestatic

Implementation of '??' operator translation for non-nullable types.

Template Parameters
T0LHS value type.
T1Type of lambda encapsulating RHS expression.
Parameters
valueLHS value.
funcRHS expression.
Returns
If LHS value is not null, returns LHS, otherwise calculates RHS expression and returns result.

◆ Coalesce() [2/2]

template<typename T0 , typename T1 >
static T0 System::ObjectExt::Coalesce ( System::Nullable< T0 >  value,
T1  func 
)
inlinestatic

Implementation of '??' operator translation for nullable types.

Template Parameters
T0LHS value type.
T1Type of lambda encapsulating RHS expression.
Parameters
valueLHS value.
funcRHS expression.
Returns
If LHS value is not null, returns LHS, otherwise calculates RHS expression and returns result.

◆ CoalesceInternal()

template<typename RT1 , typename RT2 , typename F >
static std::conditional<std::is_convertible<RT2, RT1>::value, RT1, RT2>::type System::ObjectExt::CoalesceInternal ( RT1  value,
func 
)
inlinestatic

Implementation of '??' operator translation for non-nullable types. Overload for case if RT2 is convertable to RT1.

Template Parameters
T0LHS value type.
T1Type of lambda encapsulating RHS expression.
Parameters
valueLHS value.
funcRHS expression.
Returns
If LHS value is not null, returns LHS, otherwise calculates RHS expression and returns result.

◆ Equals() [1/7]

template<typename T , typename T2 >
static std::enable_if<IsExceptionWrapper<T>::value, bool>::type System::ObjectExt::Equals ( const T &  obj,
const T2 &  another 
)
inlinestatic

◆ Equals() [2/7]

template<typename T , typename T2 >
static std::enable_if<IsSmartPtr<T>::value, bool>::type System::ObjectExt::Equals ( const T &  obj,
const T2 &  another 
)
inlinestatic

Substitution for C# Object.Equals calls working for any type in C++. Overload for smart pointer types.

Template Parameters
TFirst object type.
T2Second object type.
Parameters
objFirst object.
anotherSecond object.
Returns
True if objects are considered equal, false otherwise.

◆ Equals() [3/7]

template<typename T , typename T2 >
static std::enable_if<!IsExceptionWrapper<T>::value && !IsSmartPtr<T>::value && !std::is_scalar<T>::value, bool>::type System::ObjectExt::Equals ( obj,
const T2 &  another 
)
inlinestatic

Substitution for C# Object.Equals calls working for any type in C++. Overload for structure types.

Template Parameters
TFirst object type.
T2Second object type.
Parameters
objFirst object.
anotherSecond object.
Returns
True if objects are considered equal, false otherwise.

◆ Equals() [4/7]

template<typename T , typename T2 >
static std::enable_if<!IsSmartPtr<T>::value && std::is_scalar<T>::value, bool>::type System::ObjectExt::Equals ( const T &  obj,
const T2 &  another 
)
inlinestatic

Substitution for C# Object.Equals calls working for any type in C++. Overload for scalar types.

Template Parameters
TFirst object type.
T2Second object type.
Parameters
objFirst object.
anotherSecond object.
Returns
True if objects are considered equal, false otherwise.

◆ Equals() [5/7]

template<size_t N>
static bool System::ObjectExt::Equals ( const char_t(&)  obj[N],
String  another 
)
inlinestatic

Substitution for C# Object.Equals calls working for any type in C++. Overload for string literal with string comparison.

Template Parameters
NString literal size.
Parameters
objString literal.
anotherString.
Returns
True if strings match, false otherwise.

◆ Equals() [6/7]

template<>
bool System::ObjectExt::Equals ( const float &  obj,
const float &  another 
)
inline

Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN.

Parameters
objLHS floating point value.
anotherRHS floating point value.
Returns
True if obj and another are both NaN or equal, false otherwise.

◆ Equals() [7/7]

template<>
bool System::ObjectExt::Equals ( const double &  obj,
const double &  another 
)
inline

Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN.

Parameters
objLHS floating point value.
anotherRHS floating point value.
Returns
True if obj and another are both NaN or equal, false otherwise.

◆ ExplicitCastToObject() [1/2]

template<typename T >
static std::enable_if<System::IsBoxable<T>::value, System::SharedPtr<System::Object> >::type System::ObjectExt::ExplicitCastToObject ( const T &  value)
inlinestatic

◆ ExplicitCastToObject() [2/2]

template<typename T >
static std::enable_if<System::IsSmartPtr<T>::value, System::SharedPtr<System::Object> >::type System::ObjectExt::ExplicitCastToObject ( const T &  value)
inlinestatic

◆ GetHashCode()

template<typename T >
static int System::ObjectExt::GetHashCode ( const T &  obj)
inlinestatic

Implements GetHashCode() calls; works on both Object subclasses and unrelated types.

Template Parameters
TType to calculate hash code for.
Parameters
objObject to calculate hash code for.
Returns
Hash code calculated for object passed.

◆ Is() [1/14]

template<class T , class U >
static std::enable_if<std::is_convertible<T, Object>::value && std::is_final<T>::value && !System::IsBoxable<T>::value && System::IsSmartPtr<U>::value, bool>::type System::ObjectExt::Is ( const U &  obj)
inlinestatic

Implements 'is' operator translation. Specialization for pointer types optimized for 'final' classes.

Template Parameters
TTarget type.
UTested type.
Parameters
objObject to test for 'is' operator.
Returns
True if 'is' returns true, false otherwise.

◆ Is() [2/14]

template<class T , class U >
static std::enable_if<std::is_convertible<T, Object>::value&& !std::is_final<T>::value && !System::IsBoxable<T>::value && System::IsSmartPtr<U>::value, bool>::type System::ObjectExt::Is ( const U &  obj)
inlinestatic

Implements 'is' operator translation. Specialization for pointer types.

Template Parameters
TTarget type.
UTested type.
Parameters
objObject to test for 'is' operator.
Returns
True if 'is' returns true, false otherwise.

◆ Is() [3/14]

template<class T >
static std::enable_if<std::is_convertible<T, Object>::value, bool>::type System::ObjectExt::Is ( const Object obj)
inlinestatic

Implements 'is' operator translation. Specialization for value types.

Template Parameters
TTarget type.
Parameters
objObject to test for 'is' operator.
Returns
True if 'is' returns true, false otherwise.

◆ Is() [4/14]

template<class T >
static std::enable_if<!std::is_convertible<T, Object>::value, bool>::type System::ObjectExt::Is ( const Object obj)
inlinestatic

Implements 'is' operator translation. Specialization for unconvertible types.

Template Parameters
TTarget type.
Parameters
objObject to test for 'is' operator.
Returns
Always returns false as types are unconvertible.

◆ Is() [5/14]

template<class T , class U >
static std::enable_if<IsSmartPtr<T>::value, bool>::type System::ObjectExt::Is ( const SmartPtr< U > &  obj)
inlinestatic

Implements 'is' operator translation. Specialization for pointer types.

Template Parameters
TTarget type.
Parameters
objObject to test for 'is' operator.
Returns
True if 'is' returns true, false otherwise.

◆ Is() [6/14]

template<class T , class U >
static std::enable_if<IsExceptionWrapper<T>::value, bool>::type System::ObjectExt::Is ( const ExceptionWrapper< U > &  obj)
inlinestatic

Implements 'is' operator translation. Specialization for exception wrapper types.

Template Parameters
TTarget type.
Parameters
objObject to test for 'is' operator.
Returns
True if 'is' returns true, false otherwise.

◆ Is() [7/14]

template<class T >
static std::enable_if<IsNullable<T>::value, bool>::type System::ObjectExt::Is ( const SmartPtr< Object > &  obj)
inlinestatic

Implements 'is' operator translation. Specialization for nullable types.

Template Parameters
TTarget type.
Parameters
objObject to test for 'is' operator.
Returns
True if 'is' returns true, false otherwise.

◆ Is() [8/14]

template<class T >
static std::enable_if< System::IsBoxable<T>::value && !IsNullable<T>::value && !std::is_enum<T>::value && detail::has_operator_equal<T>::value, bool >::type System::ObjectExt::Is ( const SmartPtr< Object > &  obj)
inlinestatic

Implements 'is' operator translation. Specialization for boxable types with == operator defined.

Template Parameters
TTarget type.
Parameters
objObject to test for 'is' operator.
Returns
True if 'is' returns true, false otherwise.

◆ Is() [9/14]

template<class T >
static std::enable_if< System::IsBoxable<T>::value && !IsNullable<T>::value && !std::is_enum<T>::value && !detail::has_operator_equal<T>::value, bool >::type System::ObjectExt::Is ( const SmartPtr< Object > &  obj)
inlinestatic

Implements 'is' operator translation. Specialization for boxable types without defined ==.

Template Parameters
TTarget type.
Parameters
objObject to test for 'is' operator.
Returns
True if 'is' returns true, false otherwise.

◆ Is() [10/14]

template<class T , class U >
static std::enable_if<std::is_enum<T>::value, bool>::type System::ObjectExt::Is ( const SmartPtr< U > &  obj)
inlinestatic

Implements 'is' operator translation. Specialization for enum types.

Template Parameters
TTarget type.
UType of the pointed object.
Parameters
objObject to test for 'is' operator.
Returns
True if 'is' returns true, false otherwise.

◆ Is() [11/14]

template<class T , class U >
static std::enable_if<std::is_enum<T>::value, bool>::type System::ObjectExt::Is ( const WeakPtr< U > &  obj)
inlinestatic

Implements 'is' operator translation. Specialization for enum types vs weak pointers.

Template Parameters
TTarget type.
UType of the pointed object.
Parameters
objObject to test for 'is' operator.
Returns
True if 'is' returns true, false otherwise.

◆ Is() [12/14]

template<class T , class U >
static bool System::ObjectExt::Is ( const Nullable< U > &  value)
inlinestatic

Implements 'is' operator translation. Specialization for Nullable type.

Template Parameters
TTarget type.
Parameters
valueNullable type.
Returns
True if 'is' returns true, false otherwise.

◆ Is() [13/14]

template<class T >
static bool System::ObjectExt::Is ( const char16_t *  str)
inlinestatic

Implements 'is' operator translation. Specialization for string literal.

Template Parameters
TTarget type.
Parameters
strString literal.
Returns
True if 'is' returns true, false otherwise.

◆ Is() [14/14]

template<class T >
static bool System::ObjectExt::Is ( int32_t  value)
inlinestatic

Implements 'is' operator translation. Specialization for integer literal.

Template Parameters
TTarget type.
Parameters
valueinteger literal.
Returns
True if 'is' returns true, false otherwise.

◆ IsBoxedValue()

static ASPOSECPP_SHARED_API bool System::ObjectExt::IsBoxedValue ( const SmartPtr< Object > &  obj)
static

Checks if object is a boxed value.

Parameters
objObject to test for being boxed value.
Returns
True if obj is a boxed value, false otherwise.

◆ ObjectToUnknown() [1/2]

template<typename T >
static std::enable_if<IsSmartPtr<T>::value, T>::type System::ObjectExt::ObjectToUnknown ( SmartPtr< Object obj)
inlinestatic

Converts Object to unknown type, handling both smart pointer type and bpxed value situations.

Template Parameters
TType to convert Object to.
Parameters
objObject to convert.
Returns
Either unboxed value or converted pointer.

◆ ObjectToUnknown() [2/2]

template<typename T >
static std::enable_if<!IsSmartPtr<T>::value, T>::type System::ObjectExt::ObjectToUnknown ( SmartPtr< Object obj)
inlinestatic

Converts Object to unknown type, handling both smart pointer type and boxed value situations.

Template Parameters
TType to convert Object to.
Parameters
objObject to convert.
Returns
Either unboxed value or converted pointer.

◆ ToString() [1/10]

static String System::ObjectExt::ToString ( const char_t *  obj)
inlinestatic

Substitution for C# ToString method to work on any C++ type.

Parameters
objString literal to convert to string.
Returns
String representation of obj.

◆ ToString() [2/10]

template<typename T >
static String System::ObjectExt::ToString ( const Nullable< T > &  obj)
inlinestatic

Substitution for C# ToString method to work on any C++ type.

Template Parameters
TNullable type.
Parameters
objNullable object to convert to string.
Returns
String representation of obj.

◆ ToString() [3/10]

template<typename T >
static std::enable_if<std::is_enum<T>::value, String>::type System::ObjectExt::ToString ( const T &  obj)
inlinestatic

Substitution for C# ToString method to work on any C++ type.

Template Parameters
TEnum type.
Parameters
objEnum value to convert to string.
Returns
String representation of obj.

◆ ToString() [4/10]

template<typename T >
static std::enable_if<IsSmartPtr<T>::value, String>::type System::ObjectExt::ToString ( const T &  obj)
inlinestatic

Substitution for C# ToString method to work on any C++ type.

Template Parameters
TSmart pointer type.
Parameters
objSmartPtr value to convert to string.
Returns
String representation of obj.

◆ ToString() [5/10]

template<typename T >
static std::enable_if<IsSmartPtr<T>::value || std::is_pointer<T>::value || IsExceptionWrapper<T>::value, String>::type System::ObjectExt::ToString ( T &  obj)
inlinestatic

Substitution for C# ToString method to work on any C++ type.

Template Parameters
TSmart pointer type or ExceptionWrapper.
Parameters
objSmart pointer or ExceptionWrapper to convert to string.
Returns
String representation of obj.

◆ ToString() [6/10]

template<typename T >
static std::enable_if<!IsSmartPtr<T>::value && std::is_scalar<T>::value && !std::is_enum<T>::value, String>::type System::ObjectExt::ToString ( T &  obj)
inlinestatic

Substitution for C# ToString method to work on any C++ type.

Template Parameters
TScalar type.
Parameters
objScalar value to convert to string.
Returns
String representation of obj.

◆ ToString() [7/10]

template<typename T >
static std::enable_if<!IsSmartPtr<T>::value && std::is_scalar<T>::value && !std::is_enum<T>::value, String>::type System::ObjectExt::ToString ( T &&  obj)
inlinestatic

Substitution for C# ToString method to work on any C++ type.

Template Parameters
TScalar type.
Parameters
objScalar value to convert to string.
Returns
String representation of obj.

◆ ToString() [8/10]

template<typename T >
static std::enable_if<!IsExceptionWrapper<T>::value && !IsSmartPtr<T>::value && !std::is_scalar<T>::value && !IsNullable<T>::value, String>::type System::ObjectExt::ToString ( T &  obj)
inlinestatic

Substitution for C# ToString method to work on any C++ type.

Template Parameters
TStructure type.
Parameters
objStructure value to convert to string.
Returns
String representation of obj.

◆ ToString() [9/10]

template<typename T >
static std::enable_if<!IsSmartPtr<T>::value && !std::is_scalar<T>::value && !IsNullable<T>::value, String>::type System::ObjectExt::ToString ( const T &  obj)
inlinestatic

Substitution for C# ToString method to work on any C++ type.

Template Parameters
TStructure type.
Parameters
objStructure value to convert to string.
Returns
String representation of obj.

◆ ToString() [10/10]

template<typename T >
static std::enable_if<!IsSmartPtr<T>::value && !std::is_scalar<T>::value && !IsNullable<T>::value && !std::is_reference<T>::value, String>::type System::ObjectExt::ToString ( T &&  obj)
inlinestatic

Substitution for C# ToString method to work on any C++ type.

Template Parameters
TScalar type.
Parameters
objScalar value to convert to string.
Returns
String representation of obj.

◆ Unbox() [1/6]

template<typename T >
static std::enable_if<std::is_enum<T>::value, T>::type System::ObjectExt::Unbox ( const SmartPtr< Object > &  obj)
inlinestatic

Unboxes value types after converting to Object. Implementation for enum types.

Template Parameters
TEnum type.
Parameters
objObject to unbox.
Returns
Enum value.

◆ Unbox() [2/6]

template<class T >
static std::enable_if<!std::is_enum<T>::value && detail::has_operator_equal<T>::value, T>::type System::ObjectExt::Unbox ( const SmartPtr< Object > &  obj)
inlinestatic

Unboxes value types after converting to Object. Implementation for non-enum & non-nullable types.

Template Parameters
TValue type.
Parameters
objObject to unbox.
Returns
Unboxed value.

◆ Unbox() [3/6]

template<class T >
static std::enable_if<!std::is_enum<T>::value && !detail::has_operator_equal<T>::value, T>::type System::ObjectExt::Unbox ( const SmartPtr< Object > &  obj)
inlinestatic

Unboxes value types after converting to Object. Implementation for non-enum & non-nullable types.

Template Parameters
TValue type.
Parameters
objObject to unbox.
Returns
Unboxed value.

◆ Unbox() [4/6]

template<class T , class E >
static std::enable_if<std::is_enum<E>::value && std::numeric_limits<T>::is_integer, T>::type System::ObjectExt::Unbox ( e)
inlinestatic

Unboxes enum types to integer.

Template Parameters
TDestination integer type.
ESource enum type.
Parameters
eValue to unbox.
Returns
Integer representation of enum.

◆ Unbox() [5/6]

template<class T , class E >
static std::enable_if<std::is_enum<E>::value && std::is_enum<T>::value, T>::type System::ObjectExt::Unbox ( e)
inlinestatic

Converts enum types.

Template Parameters
TDestination enum type.
ESource enum type.
Parameters
eValue to unbox.
Returns
Converted enum value.

◆ Unbox() [6/6]

template<>
String System::ObjectExt::Unbox ( const SmartPtr< Object > &  obj)
inline

Unboxes string values.

Parameters
objObject to unbox
Returns
String representation of boxed string, can be null if boxed string was null.

◆ UnboxStringSafe()

static ASPOSECPP_SHARED_API String System::ObjectExt::UnboxStringSafe ( const SmartPtr< Object > &  obj)
static

Unboxes string from boxed value.

Exceptions
Nothing.
Parameters
objBoxed string value.
Returns
If obj is a boxed string, returns unboxed value, otherwise returns empty string.

◆ UnboxToNullable()

template<class T >
static Nullable<T> System::ObjectExt::UnboxToNullable ( const SmartPtr< Object > &  obj,
bool  safe = true 
)
inlinestatic

Unboxes object to nullable type.

Template Parameters
TDestination type.
Parameters
objObject to unbox.
safeIf true, return nullptr on failure, otherwise throw InvalidCastException.
Returns
Unboxed nullable value (could be null).

◆ UnknownIsNull() [1/2]

template<typename T >
static std::enable_if<!std::is_scalar<T>::value, bool>::type System::ObjectExt::UnknownIsNull ( obj)
inlinestatic

Checks whether unknown type object is nullptr. Overload for non-scalar types.

Template Parameters
TObject type.
Parameters
objObject to check.
Returns
True if 'obj == nullptr' is true, false otherwise.

◆ UnknownIsNull() [2/2]

template<typename T >
static std::enable_if<std::is_scalar<T>::value, bool>::type System::ObjectExt::UnknownIsNull ( obj)
inlinestatic

Checks whether unknown type object is nullptr. Overload for scalar types.

Template Parameters
TObject type.
Parameters
objObject to check.
Returns
Always returns false.

◆ UnknownToObject() [1/2]

template<typename T >
static std::enable_if<IsSmartPtr<T>::value, System::SmartPtr<Object> >::type System::ObjectExt::UnknownToObject ( obj)
inlinestatic

Converts unknown type to Object, handling both smart pointer type and value type situations.

Template Parameters
TType to convert to Object.
Parameters
objObject to convert.
Returns
Smart pointer to Object being either converted pointer or boxed value.

◆ UnknownToObject() [2/2]

template<typename T >
static std::enable_if<!IsSmartPtr<T>::value, System::SmartPtr<Object> >::type System::ObjectExt::UnknownToObject ( const T &  obj)
inlinestatic

Converts unknown type to Object, handling both smart pointer type and value type situations.

Template Parameters
TType to convert to Object.
Parameters
objObject to convert.
Returns
Smart pointer to Object being either converted pointer or boxed value.