Asposecpplib
System::ObjectExt Class Reference

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

Static Public Member Functions

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<!std::is_fundamental< T >::value &&!std::is_enum< T >::value &&IsBoxable< T >::value &&!IsNullable< T >::value &&!IsExceptionWrapper< 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...
 
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 &&!::System::Details::HasIsNull< 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 without IsNull methods. More...
 
template<typename T , typename T2 >
static std::enable_if<!IsExceptionWrapper< T >::value &&!IsSmartPtr< T >::value &&!std::is_scalar< T >::value &&::System::Details::HasIsNull< 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 with IsNull method implemented. 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=1)
 Unboxes object to nullable type. More...
 
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)
 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 >
static std::enable_if< std::is_enum< T >::value, bool >::type Is (const SmartPtr< Object > &obj)
 Implements 'is' operator translation. Specialization for enum types. More...
 
template<class T >
static std::enable_if< std::is_enum< T >::value, bool >::type Is (const WeakPtr< Object > &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...
 
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 T0 , typename T1 >
static T0 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::initializer_list< To > >::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<>
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...
 
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...
 

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

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

Boxes string values.

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

◆ Box() [2/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() [3/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() [4/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.

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

◆ Coalesce() [2/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.

◆ Equals() [1/8]

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

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

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

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

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

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

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

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

template<typename T , typename T2 >
static std::enable_if<!IsExceptionWrapper<T>::value && !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() [8/8]

template<typename T , typename T2 >
static std::enable_if<!IsExceptionWrapper<T>::value && !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.

◆ 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/16]

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

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

Implements typeof() translation. Overload for enum types.

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

◆ GetType() [3/16]

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

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

Implements typeof() translation. Overload for Nullable.

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

◆ GetType() [5/16]

template<typename T >
static std::enable_if<!std::is_fundamental<T>::value && !std::is_enum<T>::value && IsBoxable<T>::value && !IsNullable<T>::value && !IsExceptionWrapper<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() [6/16]

template<>
const System::TypeInfo& System::ObjectExt::GetType ( )
inlinestatic

Implements typeof() translation. Overload for uint8_t.

◆ GetType() [7/16]

template<>
const System::TypeInfo& System::ObjectExt::GetType ( )
inlinestatic

Implements typeof() translation. Overload for char16_t.

◆ GetType() [8/16]

template<>
const System::TypeInfo& System::ObjectExt::GetType ( )
inlinestatic

Implements typeof() translation. Overload for int32_t.

◆ GetType() [9/16]

template<>
const System::TypeInfo& System::ObjectExt::GetType ( )
inlinestatic

Implements typeof() translation. Overload for int64_t.

◆ GetType() [10/16]

template<>
const System::TypeInfo& System::ObjectExt::GetType ( )
inlinestatic

Implements typeof() translation. Overload for bool.

◆ GetType() [11/16]

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.

◆ GetType() [12/16]

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

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

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

Implements typeof() translation. Overload for exceptions.

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

◆ GetType() [15/16]

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

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

Implements typeof() translation. Overload for Nullable types.

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

◆ Is() [1/11]

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

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

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

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

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

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

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

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

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

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

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 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_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() [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 && !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.

◆ ToString() [8/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() [9/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() [10/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.

◆ 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<>
String System::ObjectExt::Unbox ( const SmartPtr< Object > &  obj)
inlinestatic

Unboxes string values.

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

◆ Unbox() [5/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() [6/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.

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

◆ UnknownToObject() [2/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.