Public Member Functions

template<>
bool Equals (const float &obj, const float &another)
 
template<>
bool Equals (const double &obj, const double &another)
 
template<>
SmartPtr< ObjectBox (const String &value)
 
template<>
String Unbox (const SmartPtr< Object > &obj)
 

Static Public Member Functions

template<typename T >
static std::enable_if< IsSmartPtr< T >::value, const System::TypeInfo & >::type GetType (const T &obj)
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value &&!std::is_fundamental< T >::value &&!std::is_enum< T >::value, const System::TypeInfo & >::type GetType (const T &obj)
 
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)
 
template<typename T >
static std::enable_if< std::is_fundamental< T >::value||std::is_enum< T >::value, const System::TypeInfo & >::type GetType ()
 
template<typename T >
static std::enable_if<(!std::is_fundamental< T >::value &&!std::is_enum< T >::value &&!IsBoxable< T >::value)||IsException< T >::value, const System::TypeInfo & >::type GetType ()
 
template<typename T >
static std::enable_if<!std::is_fundamental< T >::value &&!std::is_enum< T >::value &&IsBoxable< T >::value &&!IsException< T >::value, const System::TypeInfo & >::type GetType ()
 
static const System::TypeInfoGetType (const String &obj)
 
template<typename T >
static int GetHashCode (const T &obj)
 
template<typename T , typename T2 >
static std::enable_if< IsSmartPtr< T >::value, bool >::type Equals (const T &obj, const T2 &another)
 
template<typename T , typename T2 >
static std::enable_if<!IsSmartPtr< T >::value &&!std::is_scalar< T >::value &&!::System::Details::HasIsNull< T >::value, bool >::type Equals (T obj, const T2 &another)
 
template<typename T , typename T2 >
static std::enable_if<!IsSmartPtr< T >::value &&!std::is_scalar< T >::value &&::System::Details::HasIsNull< T >::value, bool >::type Equals (T obj, const T2 &another)
 
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)
 
template<size_t N>
static bool Equals (const char_t(&obj)[N], String another)
 
static String ToString (const char_t *obj)
 
template<typename T >
static String ToString (const Nullable< T > &obj)
 
template<typename T >
static std::enable_if< std::is_enum< T >::value, String >::type ToString (const T &obj)
 
template<typename T >
static std::enable_if< IsSmartPtr< T >::value, String >::type ToString (const T &obj)
 
template<typename T >
static std::enable_if< IsSmartPtr< T >::value||std::is_pointer< T >::value, String >::type ToString (T &obj)
 
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)
 
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)
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value &&!std::is_scalar< T >::value &&!IsNullable< T >::value, String >::type ToString (T &obj)
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value &&!std::is_scalar< T >::value &&!IsNullable< T >::value, String >::type ToString (const T &obj)
 
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)
 
template<typename T >
static std::enable_if< std::is_enum< T >::value, System::SmartPtr< System::Object > >::type Box (const T &value)
 
template<typename T >
static std::enable_if<!std::is_enum< T >::value, System::SmartPtr< System::Object > >::type Box (const T &value)
 
template<typename T >
static std::enable_if< std::is_enum< T >::value, T >::type Unbox (const SmartPtr< Object > &obj)
 
template<class T >
static std::enable_if<!std::is_enum< T >::value, T >::type Unbox (const SmartPtr< Object > &obj)
 
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)
 
template<class T , class E >
static std::enable_if< std::is_enum< E >::value &&std::is_enum< T >::value, T >::type Unbox (E e)
 
static String UnboxStringSafe (const SmartPtr< Object > &obj)
 
template<class T >
static Nullable< T > UnboxToNullable (const SmartPtr< Object > &obj, bool safe=1)
 
template<class T , class U >
static std::enable_if< std::is_convertible< T, Object >::value &&!System::IsBoxable< T >::value &&System::IsSmartPtr< U >::value, bool >::type Is (const U &obj)
 
template<class T >
static std::enable_if< std::is_convertible< T, Object >::value, bool >::type Is (const Object &obj)
 
template<class T >
static std::enable_if<!std::is_convertible< T, Object >::value, bool >::type Is (const Object &obj)
 
template<class T , class U >
static std::enable_if< IsSmartPtr< T >::value, bool >::type Is (const SmartPtr< U > &obj)
 
template<class T >
static std::enable_if< IsNullable< T >::value, bool >::type Is (const SmartPtr< Object > &obj)
 
template<class T >
static std::enable_if< System::IsBoxable< T >::value &&!IsNullable< T >::value &&!std::is_enum< T >::value, bool >::type Is (const SmartPtr< Object > &obj)
 
template<class T >
static std::enable_if< std::is_enum< T >::value, bool >::type Is (const SmartPtr< Object > &obj)
 
template<class T >
static std::enable_if< std::is_enum< T >::value, bool >::type Is (const WeakPtr< Object > &obj)
 
static bool IsBoxedValue (const SmartPtr< Object > &obj)
 
template<typename T >
static std::enable_if< IsSmartPtr< T >::value, System::SmartPtr< Object > >::type UnknownToObject (T obj)
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, System::SmartPtr< Object > >::type UnknownToObject (const T &obj)
 
template<typename T >
static std::enable_if< IsSmartPtr< T >::value, T >::type ObjectToUnknown (SmartPtr< Object > obj)
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, T >::type ObjectToUnknown (SmartPtr< Object > obj)
 
template<typename T >
static std::enable_if<!std::is_scalar< T >::value, bool >::type UnknownIsNull (T obj)
 
template<typename T >
static std::enable_if< std::is_scalar< T >::value, bool >::type UnknownIsNull (T obj)
 
template<typename T0 , typename T1 >
static T0 Coalesce (T0 value, T1 func)
 
template<typename T0 , typename T1 >
static T0 Coalesce (System::Nullable< T0 > value, T1 func)
 
template<typename T >
static SmartPtr< System::BoxedValueBaseBoxEnum (T enumValue)
 
template<typename To , typename ... From>
static std::enable_if<(std::is_fundamental< To >::value), std::initializer_list< To > >::type ArrayInitializerCast (From ...args)
 

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::initializer_list<To> >::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/3]

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/3]

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 non-enum types.

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

◆ Box() [3/3]

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.

◆ Coalesce() [1/2]

template<typename T0 , typename T1 >
static T0 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.

◆ Equals() [1/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() [2/7]

template<typename T , typename T2 >
static std::enable_if<!IsSmartPtr<T>::value && !std::is_scalar<T>::value && !::System::Details::HasIsNull<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 without IsNull methods.

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<!IsSmartPtr<T>::value && !std::is_scalar<T>::value && ::System::Details::HasIsNull<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 with IsNull method implemented.

Template Parameters
TFirst object type.
T2Second object type.
Parameters
objFirst object.
anotherSecond object.
Returns
True if objects are considered equal, false otherwise.
Exceptions
NullReferenceExceptionif obj is null.

◆ 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.

◆ 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.

◆ GetType() [1/7]

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

Implements typeof() translation. Overload for smart pointers.

Template Parameters
TPointer object type.
Parameters
objObject to get TypeInfo for.
Returns
Const reference to TypeInfo structure describing the final class of object passed.

◆ GetType() [2/7]

template<typename T >
static std::enable_if<!IsSmartPtr<T>::value && !std::is_fundamental<T>::value && !std::is_enum<T>::value, const System::TypeInfo&>::type System::ObjectExt::GetType ( const T &  obj)
inlinestatic

Implements typeof() translation. Overload for structures.

Template Parameters
TStructure type.
Parameters
objObject to get TypeInfo for.
Returns
Const reference to TypeInfo structure describing the final class of object passed.

◆ GetType() [3/7]

template<typename T >
static std::enable_if<std::is_fundamental<T>::value || std::is_enum<T>::value, const System::TypeInfo&>::type System::ObjectExt::GetType ( const T  obj)
inlinestatic

Implements typeof() translation. Overload for primitive types.

Template Parameters
TPrimitive type.
Parameters
objIGNORED
Returns
Const reference to TypeInfo structure describing the type of object passed.

◆ GetType() [4/7]

template<typename T >
static std::enable_if<std::is_fundamental<T>::value || std::is_enum<T>::value, const System::TypeInfo&>::type System::ObjectExt::GetType ( )
inlinestatic

Implements typeof() translation. Overload for primitive types.

Template Parameters
TPrimitive type.
Returns
Const reference to TypeInfo structure describing the type specified.

◆ GetType() [5/7]

template<typename T >
static std::enable_if<(!std::is_fundamental<T>::value && !std::is_enum<T>::value && !IsBoxable<T>::value) || IsException<T>::value, const System::TypeInfo&>::type System::ObjectExt::GetType ( )
inlinestatic

Implements typeof() translation. Overload for structures and pointers.

Template Parameters
TPrimitive type.
Returns
Const reference to TypeInfo structure describing the strcture specified.

◆ GetType() [6/7]

template<typename T >
static std::enable_if<!std::is_fundamental<T>::value && !std::is_enum<T>::value && IsBoxable<T>::value && !IsException<T>::value, const System::TypeInfo&>::type System::ObjectExt::GetType ( )
inlinestatic

Implements typeof() translation. Overload for structures and pointers.

Template Parameters
TPrimitive type.
Returns
Const reference to TypeInfo structure describing the strcture specified or pointee type if called for SmartPtr.

◆ GetType() [7/7]

static const System::TypeInfo& System::ObjectExt::GetType ( const String obj)
inlinestatic

Implements typeof() translation. Overload for string type.

Template Parameters
TPrimitive type.
Returns
Const reference to TypeInfo structure describing String type.

◆ Is() [1/8]

template<class T , class U >
static std::enable_if<std::is_convertible<T, Object>::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() [2/8]

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() [3/8]

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() [4/8]

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() [5/8]

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() [6/8]

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

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

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

◆ Is() [7/8]

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

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

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

◆ Is() [8/8]

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

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

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

◆ IsBoxedValue()

static 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, String>::type System::ObjectExt::ToString ( T &  obj)
inlinestatic

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

Template Parameters
TSmart pointer type.
Parameters
objSmart pointer 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<!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/5]

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/5]

template<class 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 non-enum types.

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

◆ Unbox() [3/5]

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() [4/5]

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() [5/5]

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 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 = 1 
)
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.