CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
System::Reflection::ParameterInfo Class Reference

Discovers the attributes of a parameter and provides access to parameter metadata. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument. More...

#include <parameter_info.h>

Inherits System::Object.

Public Member Functions

 ParameterInfo ()
 Initializes a new instance of the ParameterInfo class. More...
 
 ParameterInfo (const String &name, int position, const TypeInfo &type)
 Initializes a new instance of the ParameterInfo class. More...
 
String get_Name () const
 Gets the name of the parameter. More...
 
int get_Position () const
 Gets the zero-based position of the parameter in the formal parameter list. More...
 
TypeInfo get_ParameterType () const
 Gets the type of this parameter. More...
 
bool get_IsOptional () const
 Gets a value indicating whether this parameter is optional. More...
 
bool get_IsOut () const
 Gets a value indicating whether this is an output parameter. More...
 
bool get_IsIn () const
 Gets a value indicating whether this is an input parameter. More...
 
bool get_IsRetval () const
 Gets a value indicating whether this is a Retval parameter. More...
 
SharedPtr< Object > get_DefaultValue () const
 Gets the default value of the parameter. More...
 
String ToString () const override
 Returns a string that represents the current ParameterInfo. More...
 
void SetName (const String &name)
 Sets the name of the parameter. More...
 
void SetPosition (int position)
 Sets the position of the parameter in the parameter list. More...
 
void SetParameterType (const TypeInfo &type)
 Sets the type of the parameter. More...
 
void SetOptional (bool value)
 Sets the optional flag. More...
 
- Public Member Functions inherited from System::Object
 Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ~Object ()
 Destroys object. Frees all internal data structures. More...
 
 Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Object & operator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Object * SharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared reference counter. More...
 
void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual int32_t GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual String ToString () const
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual const TypeInfo & GetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual void SetTemplateWeakPtr (uint32_t argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
virtual bool FastCast (const Details::FastRttiBase &helper, void **out_ptr) const
 For internal purposes only. More...
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 Specialization of Object::ReferenceEquals for case of string and nullptr. More...
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 Specialization of Object::ReferenceEquals for case of strings. More...
 

Protected Member Functions

 ~ParameterInfo () override
 Destructor. More...
 

Protected Attributes

String m_name
 Parameter name. More...
 
int m_position
 Zero-based position of the parameter in the formal parameter list. More...
 
TypeInfo m_type
 Parameter type. More...
 
bool m_is_optional
 Optional flag. More...
 
bool m_is_out
 Out flag. More...
 
bool m_is_in
 In flag. More...
 
bool m_is_retval
 Retval flag. More...
 
SharedPtr< Object > m_default_value
 Default value. More...
 

Additional Inherited Members

- Public Types inherited from System::Object
typedef SmartPtr< Object > ptr
 Alias for smart pointer type. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfo & Type ()
 Implements C# typeof(System.Object) construct. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 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 (double const &objA, double const &objB)
 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...
 

Detailed Description

Discovers the attributes of a parameter and provides access to parameter metadata. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

Constructor & Destructor Documentation

◆ ParameterInfo() [1/2]

System::Reflection::ParameterInfo::ParameterInfo ( )

Initializes a new instance of the ParameterInfo class.

◆ ParameterInfo() [2/2]

System::Reflection::ParameterInfo::ParameterInfo ( const String &  name,
int  position,
const TypeInfo &  type 
)

Initializes a new instance of the ParameterInfo class.

Parameters
nameParameter name.
positionPosition of the parameter in the parameter list (0-based).
typeParameter type.

◆ ~ParameterInfo()

System::Reflection::ParameterInfo::~ParameterInfo ( )
overrideprotected

Destructor.

Member Function Documentation

◆ get_DefaultValue()

SharedPtr< Object > System::Reflection::ParameterInfo::get_DefaultValue ( ) const

Gets the default value of the parameter.

Returns
The default value or nullptr if the parameter has no default value.

◆ get_IsIn()

bool System::Reflection::ParameterInfo::get_IsIn ( ) const

Gets a value indicating whether this is an input parameter.

Returns
true if the parameter is an input parameter; otherwise, false.

◆ get_IsOptional()

bool System::Reflection::ParameterInfo::get_IsOptional ( ) const

Gets a value indicating whether this parameter is optional.

Returns
true if the parameter is optional; otherwise, false.

◆ get_IsOut()

bool System::Reflection::ParameterInfo::get_IsOut ( ) const

Gets a value indicating whether this is an output parameter.

Returns
true if the parameter is an output parameter; otherwise, false.

◆ get_IsRetval()

bool System::Reflection::ParameterInfo::get_IsRetval ( ) const

Gets a value indicating whether this is a Retval parameter.

Returns
true if the parameter is a return value parameter; otherwise, false.

◆ get_Name()

String System::Reflection::ParameterInfo::get_Name ( ) const

Gets the name of the parameter.

Returns
Parameter name.

◆ get_ParameterType()

TypeInfo System::Reflection::ParameterInfo::get_ParameterType ( ) const

Gets the type of this parameter.

Returns
Type of the parameter.

◆ get_Position()

int System::Reflection::ParameterInfo::get_Position ( ) const

Gets the zero-based position of the parameter in the formal parameter list.

Returns
Parameter position (0-based).

◆ SetName()

void System::Reflection::ParameterInfo::SetName ( const String &  name)

Sets the name of the parameter.

Parameters
nameParameter name.

◆ SetOptional()

void System::Reflection::ParameterInfo::SetOptional ( bool  value)

Sets the optional flag.

Parameters
valuetrue if the parameter is optional; otherwise, false.

◆ SetParameterType()

void System::Reflection::ParameterInfo::SetParameterType ( const TypeInfo &  type)

Sets the type of the parameter.

Parameters
typeParameter type.

◆ SetPosition()

void System::Reflection::ParameterInfo::SetPosition ( int  position)

Sets the position of the parameter in the parameter list.

Parameters
positionParameter position (0-based).

◆ ToString()

String System::Reflection::ParameterInfo::ToString ( ) const
overridevirtual

Returns a string that represents the current ParameterInfo.

Returns
Parameter name.

Reimplemented from System::Object.

Member Data Documentation

◆ m_default_value

SharedPtr<Object> System::Reflection::ParameterInfo::m_default_value
protected

Default value.

◆ m_is_in

bool System::Reflection::ParameterInfo::m_is_in
protected

In flag.

◆ m_is_optional

bool System::Reflection::ParameterInfo::m_is_optional
protected

Optional flag.

◆ m_is_out

bool System::Reflection::ParameterInfo::m_is_out
protected

Out flag.

◆ m_is_retval

bool System::Reflection::ParameterInfo::m_is_retval
protected

Retval flag.

◆ m_name

String System::Reflection::ParameterInfo::m_name
protected

Parameter name.

◆ m_position

int System::Reflection::ParameterInfo::m_position
protected

Zero-based position of the parameter in the formal parameter list.

◆ m_type

TypeInfo System::Reflection::ParameterInfo::m_type
protected

Parameter type.