Last active
May 2, 2019 06:59
-
-
Save codeporting-com-gists/21b1d9f813c2545e2d860fbc26365563 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codeportingcpp-Cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "AbstractClasses.h" | |
namespace TypesPorting { | |
RTTI_INFO_IMPL_HASH(1064729720u, ::TypesPorting::AbstractClassWithoutMethods, ThisTypeBaseTypesInfo); | |
RTTI_INFO_IMPL_HASH(2860880958u, ::TypesPorting::AbstractClassWithMethods, ThisTypeBaseTypesInfo); | |
void AbstractClassWithMethods::SomeVirtualMethod() { } | |
void AbstractClassWithMethods::SomeMethod() { } | |
} // namespace TypesPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _AbstractClasses_AbstractClasses_h_ | |
#define _AbstractClasses_AbstractClasses_h_ | |
#include <system/object.h> | |
namespace TypesPorting { | |
class ABSTRACT AbstractClassWithoutMethods : public System::Object | |
{ | |
typedef AbstractClassWithoutMethods ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
}; | |
class ABSTRACT AbstractClassWithMethods : public System::Object | |
{ | |
typedef AbstractClassWithMethods ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual void SomeAbstractMethod() = 0; | |
virtual void SomeVirtualMethod(); | |
void SomeMethod(); | |
}; | |
} // namespace TypesPorting | |
#endif // _AbstractClasses_AbstractClasses_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassAutoProperties.h" | |
namespace MembersPorting { | |
RTTI_INFO_IMPL_HASH(162763058u, ::MembersPorting::ClassAutoProperties, ThisTypeBaseTypesInfo); | |
int32_t ClassAutoProperties::get_PublicProperty() | |
{ | |
return pr_PublicProperty; | |
} | |
void ClassAutoProperties::set_PublicProperty(int32_t value) | |
{ | |
pr_PublicProperty = value; | |
} | |
System::String ClassAutoProperties::get_InternalProperty() | |
{ | |
return pr_InternalProperty; | |
} | |
void ClassAutoProperties::set_InternalProperty(System::String value) | |
{ | |
pr_InternalProperty = value; | |
} | |
bool ClassAutoProperties::get_ProtectedProperty() | |
{ | |
return pr_ProtectedProperty; | |
} | |
void ClassAutoProperties::set_ProtectedProperty(bool value) | |
{ | |
pr_ProtectedProperty = value; | |
} | |
double ClassAutoProperties::get_PrivateProperty() | |
{ | |
return pr_PrivateProperty; | |
} | |
void ClassAutoProperties::set_PrivateProperty(double value) | |
{ | |
pr_PrivateProperty = value; | |
} | |
} // namespace MembersPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ClassAutoProperties_ClassAutoProperties_h_ | |
#define _ClassAutoProperties_ClassAutoProperties_h_ | |
#include <system/string.h> | |
#include <system/object.h> | |
#include <cstdint> | |
namespace MembersPorting { | |
class ClassAutoProperties : public System::Object | |
{ | |
typedef ClassAutoProperties ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
int32_t get_PublicProperty(); | |
void set_PublicProperty(int32_t value); | |
protected: | |
System::String get_InternalProperty(); | |
void set_InternalProperty(System::String value); | |
bool get_ProtectedProperty(); | |
void set_ProtectedProperty(bool value); | |
private: | |
int32_t pr_PublicProperty; | |
System::String pr_InternalProperty; | |
bool pr_ProtectedProperty; | |
double pr_PrivateProperty; | |
double get_PrivateProperty(); | |
void set_PrivateProperty(double value); | |
}; | |
} // namespace MembersPorting | |
#endif // _ClassAutoProperties_ClassAutoProperties_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "BreakStatements.h" | |
#include <system/console.h> | |
#include <system/array.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(409202246u, ::StatementsPorting::BreakStatements, ThisTypeBaseTypesInfo); | |
void BreakStatements::BreakForeach(System::ArrayPtr<int32_t> values, int32_t max) | |
{ | |
for (int i_ = 0; i_ < values->Count(); ++i_) | |
{ | |
int32_t value = values[i_]; | |
{ | |
System::Console::WriteLine(value); | |
if (value > max) | |
{ | |
break; | |
} | |
} | |
} | |
} | |
void BreakStatements::BreakEnclosedForeach(System::ArrayPtr<System::ArrayPtr<int32_t>> values, int32_t max) | |
{ | |
for (int i_ = 0; i_ < values->Count(); ++i_) | |
{ | |
System::ArrayPtr<int32_t> row = values[i_]; | |
{ | |
if (row->get_Length() == 0) | |
{ | |
break; | |
} | |
{ | |
for (int i_ = 0; i_ < row->Count(); ++i_) | |
{ | |
int32_t value = row[i_]; | |
{ | |
System::Console::WriteLine(value); | |
if (value > max) | |
{ | |
break; | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
void BreakStatements::BreakFor(int32_t max) | |
{ | |
for (int32_t index = 0; index < max; ++index) | |
{ | |
System::Console::WriteLine(index); | |
if (index % 5 == 4) | |
{ | |
break; | |
} | |
} | |
} | |
void BreakStatements::BreakEnclosedFor(int32_t max1, int32_t max2) | |
{ | |
for (int32_t index1 = 0; index1 < max1; ++index1) | |
{ | |
if (index1 % 14 == 11) | |
{ | |
break; | |
} | |
for (int32_t index2 = 0; index2 < max2; ++index2) | |
{ | |
System::Console::WriteLine(index1 + index2); | |
if (index2 % 13 == 7) | |
{ | |
break; | |
} | |
} | |
} | |
} | |
void BreakStatements::BreakWhile(int32_t max) | |
{ | |
int32_t number = 0; | |
while (number < max) | |
{ | |
System::Console::WriteLine(number); | |
if (number % 5 == 4) | |
{ | |
break; | |
} | |
++number; | |
} | |
} | |
void BreakStatements::BreakEnclosedWhile(int32_t max1, int32_t max2) | |
{ | |
int32_t number1 = 0; | |
while (number1 < max1) | |
{ | |
if (number1 % 14 == 11) | |
{ | |
break; | |
} | |
int32_t number2 = 0; | |
while (number2 < max2) | |
{ | |
System::Console::WriteLine(number1 + number2); | |
if (number2 % 5 == 4) | |
{ | |
break; | |
} | |
++number2; | |
} | |
++number1; | |
} | |
} | |
void BreakStatements::BreakDoWhile(int32_t max) | |
{ | |
int32_t number = 0; | |
do | |
{ | |
System::Console::WriteLine(number); | |
if (number % 5 == 4) | |
{ | |
break; | |
} | |
++number; | |
} while (number < max); | |
} | |
void BreakStatements::BreakEnclosedDoWhile(int32_t max1, int32_t max2) | |
{ | |
int32_t number1 = 0; | |
do | |
{ | |
if (number1 % 14 == 11) | |
{ | |
break; | |
} | |
int32_t number2 = 0; | |
do | |
{ | |
System::Console::WriteLine(number1 + number2); | |
if (number2 % 5 == 4) | |
{ | |
break; | |
} | |
++number2; | |
} while (number2 < max2); | |
++number1; | |
} while (number1 < max1); | |
} | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _BreakStatements_BreakStatements_h_ | |
#define _BreakStatements_BreakStatements_h_ | |
#include <system/object.h> | |
#include <system/array.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
class BreakStatements : public System::Object | |
{ | |
typedef BreakStatements ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void BreakForeach(System::ArrayPtr<int32_t> values, int32_t max); | |
void BreakEnclosedForeach(System::ArrayPtr<System::ArrayPtr<int32_t>> values, int32_t max); | |
void BreakFor(int32_t max); | |
void BreakEnclosedFor(int32_t max1, int32_t max2); | |
void BreakWhile(int32_t max); | |
void BreakEnclosedWhile(int32_t max1, int32_t max2); | |
void BreakDoWhile(int32_t max); | |
void BreakEnclosedDoWhile(int32_t max1, int32_t max2); | |
}; | |
} // namespace StatementsPorting | |
#endif // _BreakStatements_BreakStatements_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassConstructors.h" | |
#include <system/string.h> | |
#include <cstdint> | |
namespace MembersPorting { | |
RTTI_INFO_IMPL_HASH(2935908457u, ::MembersPorting::ClassConstructors, ThisTypeBaseTypesInfo); | |
ClassConstructors::ClassConstructors() { } | |
ClassConstructors::ClassConstructors(System::String value) { } | |
ClassConstructors::ClassConstructors(int32_t value) { } | |
ClassConstructors::ClassConstructors(bool value) { } | |
ClassConstructors::ClassConstructors(double value) { } | |
} // namespace MembersPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ClassConstructors_ClassConstructors_h_ | |
#define _ClassConstructors_ClassConstructors_h_ | |
#include <system/string.h> | |
#include <system/shared_ptr.h> | |
#include <system/object.h> | |
#include <cstdint> | |
namespace MembersPorting { | |
class ClassConstructors : public System::Object | |
{ | |
typedef ClassConstructors ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
FRIEND_FUNCTION_System_MakeObject; | |
public: | |
ClassConstructors(); | |
ClassConstructors(System::String value); | |
protected: | |
ClassConstructors(int32_t value); | |
ClassConstructors(bool value); | |
private: | |
ClassConstructors(double value); | |
}; | |
} // namespace MembersPorting | |
#endif // _ClassConstructors_ClassConstructors_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ContinueStatements.h" | |
#include <system/console.h> | |
#include <system/array.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(2122136424u, ::StatementsPorting::ContinueStatements, ThisTypeBaseTypesInfo); | |
void ContinueStatements::ContinueForeach(System::ArrayPtr<int32_t> values, int32_t max) | |
{ | |
for (int i_ = 0; i_ < values->Count(); ++i_) | |
{ | |
int32_t value = values[i_]; | |
{ | |
if (value > max) | |
{ | |
continue; | |
} | |
System::Console::WriteLine(value); | |
} | |
} | |
} | |
void ContinueStatements::ContinueEnclosedForeach(System::ArrayPtr<System::ArrayPtr<int32_t>> values, int32_t max) | |
{ | |
for (int i_ = 0; i_ < values->Count(); ++i_) | |
{ | |
System::ArrayPtr<int32_t> row = values[i_]; | |
{ | |
if (row->get_Length() == 0) | |
{ | |
continue; | |
} | |
{ | |
for (int i_ = 0; i_ < row->Count(); ++i_) | |
{ | |
int32_t value = row[i_]; | |
{ | |
if (value > max) | |
{ | |
continue; | |
} | |
System::Console::WriteLine(value); | |
} | |
} | |
} | |
} | |
} | |
} | |
void ContinueStatements::ContinueFor(int32_t max) | |
{ | |
for (int32_t index = 0; index < max; ++index) | |
{ | |
if (index % 5 == 4) | |
{ | |
continue; | |
} | |
System::Console::WriteLine(index); | |
} | |
} | |
void ContinueStatements::ContinueEnclosedFor(int32_t max1, int32_t max2) | |
{ | |
for (int32_t index1 = 0; index1 < max1; ++index1) | |
{ | |
if (index1 % 14 == 11) | |
{ | |
continue; | |
} | |
for (int32_t index2 = 0; index2 < max2; ++index2) | |
{ | |
if (index2 % 13 == 7) | |
{ | |
continue; | |
} | |
System::Console::WriteLine(index1 + index2); | |
} | |
} | |
} | |
void ContinueStatements::ContinueWhile(int32_t max) | |
{ | |
int32_t number = 0; | |
while (number < max) | |
{ | |
if (number % 5 == 4) | |
{ | |
continue; | |
} | |
System::Console::WriteLine(number); | |
++number; | |
} | |
} | |
void ContinueStatements::ContinueEnclosedWhile(int32_t max1, int32_t max2) | |
{ | |
int32_t number1 = 0; | |
while (number1 < max1) | |
{ | |
if (number1 % 14 == 11) | |
{ | |
continue; | |
} | |
int32_t number2 = 0; | |
while (number2 < max2) | |
{ | |
if (number2 % 5 == 4) | |
{ | |
continue; | |
} | |
System::Console::WriteLine(number1 + number2); | |
++number2; | |
} | |
++number1; | |
} | |
} | |
void ContinueStatements::ContinueDoWhile(int32_t max) | |
{ | |
int32_t number = 0; | |
do | |
{ | |
if (number % 5 == 4) | |
{ | |
continue; | |
} | |
System::Console::WriteLine(number); | |
++number; | |
} while (number < max); | |
} | |
void ContinueStatements::ContinueEnclosedDoWhile(int32_t max1, int32_t max2) | |
{ | |
int32_t number1 = 0; | |
do | |
{ | |
if (number1 % 14 == 11) | |
{ | |
continue; | |
} | |
int32_t number2 = 0; | |
do | |
{ | |
if (number2 % 5 == 4) | |
{ | |
continue; | |
} | |
System::Console::WriteLine(number1 + number2); | |
++number2; | |
} while (number2 < max2); | |
++number1; | |
} while (number1 < max1); | |
} | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ContinueStatements_ContinueStatements_h_ | |
#define _ContinueStatements_ContinueStatements_h_ | |
#include <system/object.h> | |
#include <system/array.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
class ContinueStatements : public System::Object | |
{ | |
typedef ContinueStatements ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void ContinueForeach(System::ArrayPtr<int32_t> values, int32_t max); | |
void ContinueEnclosedForeach(System::ArrayPtr<System::ArrayPtr<int32_t>> values, int32_t max); | |
void ContinueFor(int32_t max); | |
void ContinueEnclosedFor(int32_t max1, int32_t max2); | |
void ContinueWhile(int32_t max); | |
void ContinueEnclosedWhile(int32_t max1, int32_t max2); | |
void ContinueDoWhile(int32_t max); | |
void ContinueEnclosedDoWhile(int32_t max1, int32_t max2); | |
}; | |
} // namespace StatementsPorting | |
#endif // _ContinueStatements_ContinueStatements_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _Delegates_Delegates_h_ | |
#define _Delegates_Delegates_h_ | |
#include <system/string.h> | |
#include <system/multicast_delegate.h> | |
#include <cstdint> | |
namespace TypesPorting { | |
using Delegate1 = System::MulticastDelegate<void()>; | |
using Delegate2 = System::MulticastDelegate<int32_t()>; | |
using Delegate3 = System::MulticastDelegate<void(System::String, int32_t)>; | |
using Delegate4 = System::MulticastDelegate<int32_t(System::String, int32_t)>; | |
} // namespace TypesPorting | |
#endif // _Delegates_Delegates_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "DoWhileStatements.h" | |
#include <system/console.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(1608234029u, ::StatementsPorting::DoWhileStatements, ThisTypeBaseTypesInfo); | |
void DoWhileStatements::DoWhile(int32_t max) | |
{ | |
int32_t number = 0; | |
do | |
{ | |
System::Console::WriteLine(number); | |
++number; | |
} while (number < max); | |
} | |
void DoWhileStatements::EnclosedDoWhile(int32_t max1, int32_t max2) | |
{ | |
int32_t number1 = 0; | |
do | |
{ | |
int32_t number2 = 0; | |
do | |
{ | |
System::Console::WriteLine(number1 + number2); | |
++number2; | |
} while (number2 < max2); | |
++number1; | |
} while (number1 < max1); | |
} | |
void DoWhileStatements::InfiniteDoWhile() | |
{ | |
do | |
{ | |
System::Console::WriteLine(u"iteration"); | |
} while (true); | |
} | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _DoWhileStatements_DoWhileStatements_h_ | |
#define _DoWhileStatements_DoWhileStatements_h_ | |
#include <system/object.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
class DoWhileStatements : public System::Object | |
{ | |
typedef DoWhileStatements ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void DoWhile(int32_t max); | |
void EnclosedDoWhile(int32_t max1, int32_t max2); | |
void InfiniteDoWhile(); | |
}; | |
} // namespace StatementsPorting | |
#endif // _DoWhileStatements_DoWhileStatements_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _Enums_Enums_h_ | |
#define _Enums_Enums_h_ | |
#include <system/enum_helpers.h> | |
#include <cstdint> | |
namespace TypesPorting { | |
enum class SimpleEnum | |
{ | |
Value1 = 1, | |
Value2, | |
Value3 = 100, | |
Value4 = -1, | |
Value5 = static_cast<int32_t>(-Value3), | |
Value6 = -5, | |
Value7 = 7 | |
}; | |
enum class EnumWithType : uint32_t | |
{ | |
Value1 = 1, | |
Value2, | |
Value3 = 100, | |
Value4 = static_cast<uint32_t>(TypesPorting::SimpleEnum::Value7) | |
}; | |
enum class SimpleFlags | |
{ | |
Value1 = 1, | |
Value2 = 2, | |
Value3 = 4, | |
Value4 = 8 | |
}; | |
DECLARE_ENUM_OPERATORS(TypesPorting::SimpleFlags); | |
DECLARE_USING_GLOBAL_OPERATORS | |
enum class FlagsWithType : uint32_t | |
{ | |
Value1 = 1, | |
Value2 = 2, | |
Value3 = 4, | |
Value4 = 8 | |
}; | |
DECLARE_ENUM_OPERATORS(TypesPorting::FlagsWithType); | |
DECLARE_USING_GLOBAL_OPERATORS | |
} // namespace TypesPorting | |
DECLARE_USING_ENUM_OPERATORS(TypesPorting); | |
#endif // _Enums_Enums_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "EnumTypeCast.h" | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(1083267223u, ::StatementsPorting::EnumTypeCast, ThisTypeBaseTypesInfo); | |
void EnumTypeCast::EnumToNumberCasts() | |
{ | |
SomeEnum source = StatementsPorting::SomeEnum::Value13; | |
int8_t dest1 = (int8_t)source; | |
uint8_t dest2 = (uint8_t)source; | |
int16_t dest3 = (int16_t)source; | |
uint16_t dest4 = (uint16_t)source; | |
int32_t dest5 = (int32_t)source; | |
uint32_t dest6 = (uint32_t)source; | |
int64_t dest7 = (int64_t)source; | |
uint64_t dest8 = (uint64_t)source; | |
float dest9 = (float)source; | |
double dest10 = (double)source; | |
char16_t dest11 = (char16_t)source; | |
} | |
void EnumTypeCast::NumberEnumToCasts() | |
{ | |
int8_t source1 = -11; | |
uint8_t source2 = 13; | |
int16_t source3 = -333; | |
uint16_t source4 = 666; | |
int32_t source5 = -333333; | |
uint32_t source6 = 666666; | |
int64_t source7 = -333333333; | |
uint64_t source8 = 666666666; | |
float source9 = 3.1415926f; | |
double source10 = 3.1415926; | |
char16_t source11 = u'X'; | |
SomeEnum dest1 = (SomeEnum)source1; | |
SomeEnum dest2 = (SomeEnum)source2; | |
SomeEnum dest3 = (SomeEnum)source3; | |
SomeEnum dest4 = (SomeEnum)source4; | |
SomeEnum dest5 = (SomeEnum)source5; | |
SomeEnum dest6 = (SomeEnum)source6; | |
SomeEnum dest7 = (SomeEnum)source7; | |
SomeEnum dest8 = (SomeEnum)source8; | |
SomeEnum dest9 = (SomeEnum)source9; | |
SomeEnum dest10 = (SomeEnum)source10; | |
SomeEnum dest11 = (SomeEnum)source11; | |
} | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _EnumTypeCast_EnumTypeCast_h_ | |
#define _EnumTypeCast_EnumTypeCast_h_ | |
#include <system/object.h> | |
namespace StatementsPorting { | |
enum class SomeEnum | |
{ | |
Value1 = 1, | |
Value3 = 3, | |
Value13 = 13 | |
}; | |
class EnumTypeCast : public System::Object | |
{ | |
typedef EnumTypeCast ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void EnumToNumberCasts(); | |
void NumberEnumToCasts(); | |
}; | |
} // namespace StatementsPorting | |
#endif // _EnumTypeCast_EnumTypeCast_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassEvents.h" | |
namespace MembersPorting { | |
RTTI_INFO_IMPL_HASH(65540873u, ::MembersPorting::ClassEvents, ThisTypeBaseTypesInfo); | |
} // namespace MembersPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ClassEvents_ClassEvents_h_ | |
#define _ClassEvents_ClassEvents_h_ | |
#include <system/object.h> | |
#include <system/multicast_delegate.h> | |
#include <system/event.h> | |
namespace MembersPorting { | |
using SomeDelegate = System::MulticastDelegate<void()>; | |
class ClassEvents : public System::Object | |
{ | |
typedef ClassEvents ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
System::Event<void()> PublicEvent; | |
protected: | |
System::Event<void()> InternalEvent; | |
System::Event<void()> ProtectedEvent; | |
private: | |
System::Event<void()> PrivateEvent; | |
}; | |
} // namespace MembersPorting | |
#endif // _ClassEvents_ClassEvents_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Exceptions.h" | |
#include <system/string.h> | |
#include <system/exceptions.h> | |
namespace TypesPorting { | |
RTTI_INFO_IMPL_HASH(3462569092u, ::TypesPorting::SimpleCustomException, ThisTypeBaseTypesInfo); | |
SimpleCustomException::~SimpleCustomException() {} | |
SimpleCustomException::SimpleCustomException() : System::Exception() { } | |
SimpleCustomException::SimpleCustomException(std::nullptr_t) : System::Exception(nullptr) {} | |
RTTI_INFO_IMPL_HASH(2829839425u, ::TypesPorting::CustomMessageException, ThisTypeBaseTypesInfo); | |
CustomMessageException::~CustomMessageException() {} | |
CustomMessageException::CustomMessageException() { } | |
CustomMessageException::CustomMessageException(std::nullptr_t) : System::Exception(nullptr) {} | |
CustomMessageException::CustomMessageException(System::String message) : System::Exception(message) { } | |
RTTI_INFO_IMPL_HASH(2464976903u, ::TypesPorting::CustomMessageInnerException, ThisTypeBaseTypesInfo); | |
CustomMessageInnerException::~CustomMessageInnerException() {} | |
CustomMessageInnerException::CustomMessageInnerException() { } | |
CustomMessageInnerException::CustomMessageInnerException(std::nullptr_t) : System::Exception(nullptr) {} | |
CustomMessageInnerException::CustomMessageInnerException(System::String message) : System::Exception(message) { } | |
CustomMessageInnerException::CustomMessageInnerException(System::String message, System::Exception innerException) | |
: System::Exception(message, innerException) { } | |
} // namespace TypesPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _Exceptions_Exceptions_h_ | |
#define _Exceptions_Exceptions_h_ | |
#include <system/string.h> | |
#include <system/exceptions.h> | |
namespace TypesPorting { | |
class SimpleCustomException : public System::Exception | |
{ | |
typedef SimpleCustomException ThisType; | |
typedef System::Exception BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual ~SimpleCustomException(); | |
SimpleCustomException(); | |
SimpleCustomException(std::nullptr_t); | |
}; | |
class CustomMessageException : public System::Exception | |
{ | |
typedef CustomMessageException ThisType; | |
typedef System::Exception BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual ~CustomMessageException(); | |
CustomMessageException(); | |
CustomMessageException(std::nullptr_t); | |
CustomMessageException(System::String message); | |
}; | |
class CustomMessageInnerException : public System::Exception | |
{ | |
typedef CustomMessageInnerException ThisType; | |
typedef System::Exception BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual ~CustomMessageInnerException(); | |
CustomMessageInnerException(); | |
CustomMessageInnerException(std::nullptr_t); | |
CustomMessageInnerException(System::String message); | |
CustomMessageInnerException(System::String message, System::Exception innerException); | |
}; | |
} // namespace TypesPorting | |
#endif // _Exceptions_Exceptions_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ExpectedException.h" | |
#include <system/exceptions.h> | |
namespace NUnitTestsPorting { | |
void ExpectedException::TestMethod1() { } | |
TEST_F(ExpectedException, TestMethod1) | |
{ | |
ASSERT_ANY_THROW({ | |
TestMethod1(); | |
}); | |
} | |
void ExpectedException::TestMethod2() { } | |
TEST_F(ExpectedException, TestMethod2) | |
{ | |
ASSERT_THROW({ | |
TestMethod2(); | |
}, System::InvalidOperationException); | |
} | |
void ExpectedException::TestMethod3() { } | |
TEST_F(ExpectedException, TestMethod3) | |
{ | |
ASSERT_THROW({ | |
TestMethod3(); | |
}, System::InvalidOperationException); | |
} | |
void ExpectedException::TestMethod4() { } | |
TEST_F(ExpectedException, TestMethod4) | |
{ | |
ASSERT_THROW({ | |
TestMethod4(); | |
}, System::InvalidOperationException); | |
} | |
void ExpectedException::TestMethod5() { } | |
TEST_F(ExpectedException, TestMethod5) | |
{ | |
ASSERT_THROW({ | |
TestMethod5(); | |
}, System::InvalidOperationException); | |
} | |
void ExpectedException::TestMethod6() { } | |
TEST_F(ExpectedException, TestMethod6) | |
{ | |
ASSERT_THROW({ | |
TestMethod6(); | |
}, System::InvalidOperationException); | |
} | |
void ExpectedException::TestMethod7() { } | |
TEST_F(ExpectedException, TestMethod7) | |
{ | |
ASSERT_THROW({ | |
TestMethod7(); | |
}, System::InvalidOperationException); | |
} | |
void ExpectedException::HandleException(System::Exception e) { } | |
} // namespace NUnitTestsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ExpectedException_ExpectedException_h_ | |
#define _ExpectedException_ExpectedException_h_ | |
#include <system/object.h> | |
#include <system/exceptions.h> | |
#include <gtest/gtest.h> | |
namespace NUnitTestsPorting { | |
class ExpectedException : public System::Object, public ::testing::Test | |
{ | |
public: | |
void TestMethod1(); | |
void TestMethod2(); | |
void TestMethod3(); | |
void TestMethod4(); | |
void TestMethod5(); | |
void TestMethod6(); | |
void TestMethod7(); | |
void HandleException(System::Exception e); | |
}; | |
} // namespace NUnitTestsPorting | |
#endif // _ExpectedException_ExpectedException_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassFinalizers.h" | |
namespace MembersPorting { | |
RTTI_INFO_IMPL_HASH(3834420943u, ::MembersPorting::ClassFinalizers, ThisTypeBaseTypesInfo); | |
ClassFinalizers::~ClassFinalizers() { } | |
} // namespace MembersPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ClassFinalizers_ClassFinalizers_h_ | |
#define _ClassFinalizers_ClassFinalizers_h_ | |
#include <system/object.h> | |
namespace MembersPorting { | |
class ClassFinalizers : public System::Object | |
{ | |
typedef ClassFinalizers ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual ~ClassFinalizers(); | |
}; | |
} // namespace MembersPorting | |
#endif // _ClassFinalizers_ClassFinalizers_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ForeachStatements.h" | |
#include <system/string.h> | |
#include <system/console.h> | |
#include <system/array.h> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(2238368721u, ::StatementsPorting::ForeachStatements, ThisTypeBaseTypesInfo); | |
void ForeachStatements::Foreach(System::ArrayPtr<System::String> values) | |
{ | |
for (int i_ = 0; i_ < values->Count(); ++i_) | |
{ | |
System::String value = values[i_]; | |
{ | |
System::Console::WriteLine(value); | |
} | |
} | |
} | |
void ForeachStatements::EnclosedForeach(System::ArrayPtr<System::ArrayPtr<System::String>> values) | |
{ | |
for (int i_ = 0; i_ < values->Count(); ++i_) | |
{ | |
System::ArrayPtr<System::String> row = values[i_]; | |
{ | |
for (int i_ = 0; i_ < row->Count(); ++i_) | |
{ | |
System::String value = row[i_]; | |
{ | |
System::Console::WriteLine(value); | |
} | |
} | |
} | |
} | |
} | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ForeachStatements_ForeachStatements_h_ | |
#define _ForeachStatements_ForeachStatements_h_ | |
#include <system/string.h> | |
#include <system/object.h> | |
#include <system/array.h> | |
namespace StatementsPorting { | |
class ForeachStatements : public System::Object | |
{ | |
typedef ForeachStatements ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void Foreach(System::ArrayPtr<System::String> values); | |
void EnclosedForeach(System::ArrayPtr<System::ArrayPtr<System::String>> values); | |
}; | |
} // namespace StatementsPorting | |
#endif // _ForeachStatements_ForeachStatements_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ForStatements.h" | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(772585040u, ::StatementsPorting::ForStatements, ThisTypeBaseTypesInfo); | |
void ForStatements::For(int32_t count) | |
{ | |
for (int32_t index = 0; index < count; ++index) | |
{ | |
Console->WriteLine(index); | |
} | |
} | |
void ForStatements::ForWithSeveralCounter(int32_t count1, int32_t count2) | |
{ | |
for (int32_t index1 = 0, index2 = 0; index1 < count1 && index2 < count2; ++index1, ++index2) | |
{ | |
Console->WriteLine(index1 + index2); | |
} | |
} | |
void ForStatements::EnclosedFor(int32_t count1, int32_t count2) | |
{ | |
for (int32_t index1 = 0; index1 < count1; ++index1) | |
{ | |
for (int32_t index2 = 0; index2 < count2; ++index2) | |
{ | |
Console->WriteLine(index1 + index2); | |
} | |
} | |
} | |
void ForStatements::CustomizedFor(int32_t max) | |
{ | |
int32_t prev = 1; | |
int32_t current = 1; | |
for (; current <= max; ) | |
{ | |
Console->WriteLine(current); | |
int32_t next = current + prev; | |
prev = current; | |
current = next; | |
} | |
} | |
void ForStatements::InfiniteFor() | |
{ | |
for (; ; ) | |
{ | |
Console->WriteLine(u"iteration"); | |
} | |
} | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ForStatements_ForStatements_h_ | |
#define _ForStatements_ForStatements_h_ | |
#include <system/object.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
class ForStatements : public System::Object | |
{ | |
typedef ForStatements ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void For(int32_t count); | |
void ForWithSeveralCounter(int32_t count1, int32_t count2); | |
void EnclosedFor(int32_t count1, int32_t count2); | |
void CustomizedFor(int32_t max); | |
void InfiniteFor(); | |
}; | |
} // namespace StatementsPorting | |
#endif // _ForStatements_ForStatements_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _GenericClasses_GenericClasses_h_ | |
#define _GenericClasses_GenericClasses_h_ | |
#include <system/object.h> | |
#include <system/icloneable.h> | |
#include <system/details/pointer_collection_helpers.h> | |
#include <system/constraints.h> | |
namespace TypesPorting { | |
template<typename TInner> | |
class GenericClass : public System::Object | |
{ | |
typedef GenericClass<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericClassWithTypeConstraint : public System::Object | |
{ | |
typedef System::ICloneable BaseT_ICloneable; | |
assert_is_base_of(BaseT_ICloneable, TInner); | |
typedef GenericClassWithTypeConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericClassWithClassConstraint : public System::Object | |
{ | |
assert_is_cs_class(TInner); | |
typedef GenericClassWithClassConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericClassWithStructConstraint : public System::Object | |
{ | |
assert_is_cs_struct(TInner); | |
typedef GenericClassWithStructConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericClassWithNewConstraint : public System::Object | |
{ | |
assert_is_constructable(TInner); | |
typedef GenericClassWithNewConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericClassWithSeveralConstraints : public System::Object | |
{ | |
assert_is_cs_class(TInner); | |
typedef System::ICloneable BaseT_ICloneable; | |
assert_is_base_of(BaseT_ICloneable, TInner); | |
assert_is_constructable(TInner); | |
typedef GenericClassWithSeveralConstraints<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
} // namespace TypesPorting | |
#endif // _GenericClasses_GenericClasses_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _GenericDelegates_GenericDelegates_h_ | |
#define _GenericDelegates_GenericDelegates_h_ | |
#include <system/multicast_delegate.h> | |
namespace TypesPorting { | |
template <typename TIn, typename TOut> using GenericDelegate = System::MulticastDelegate<TOut(TIn)>; | |
template <typename TIn, typename TOut> using GenericDelegateWithTypeConstraint = System::MulticastDelegate<TOut(TIn)>; | |
template <typename TIn, typename TOut> using GenericDelegateWithClassConstraint = System::MulticastDelegate<TOut(TIn)>; | |
template <typename TIn, typename TOut> using GenericDelegateWithStructConstraint = System::MulticastDelegate<TOut(TIn)>; | |
template <typename TIn, typename TOut> using GenericDelegateWithNewConstraint = System::MulticastDelegate<TOut(TIn)>; | |
template <typename TIn, typename TOut> using GenericDelegateWithSeveralConstraints = System::MulticastDelegate<TOut(TIn)>; | |
} // namespace TypesPorting | |
#endif // _GenericDelegates_GenericDelegates_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _GenericInterfaces_GenericInterfaces_h_ | |
#define _GenericInterfaces_GenericInterfaces_h_ | |
#include <system/object.h> | |
#include <system/icloneable.h> | |
#include <system/constraints.h> | |
namespace TypesPorting { | |
template<typename TInner> | |
class IGenericInterface : public System::Object | |
{ | |
typedef IGenericInterface<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
}; | |
template<typename TInner> | |
class IGenericInterfaceWithTypeConstraint : public System::Object | |
{ | |
typedef System::ICloneable BaseT_ICloneable; | |
assert_is_base_of(BaseT_ICloneable, TInner); | |
typedef IGenericInterfaceWithTypeConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
}; | |
template<typename TInner> | |
class IGenericInterfaceWithClassConstraint : public System::Object | |
{ | |
assert_is_cs_class(TInner); | |
typedef IGenericInterfaceWithClassConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
}; | |
template<typename TInner> | |
class IGenericInterfaceWithStructConstraint : public System::Object | |
{ | |
assert_is_cs_struct(TInner); | |
typedef IGenericInterfaceWithStructConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
}; | |
template<typename TInner> | |
class IGenericInterfaceWithNewConstraint : public System::Object | |
{ | |
assert_is_constructable(TInner); | |
typedef IGenericInterfaceWithNewConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
}; | |
template<typename TInner> | |
class IGenericInterfaceWithSeveralConstraints : public System::Object | |
{ | |
assert_is_cs_class(TInner); | |
typedef System::ICloneable BaseT_ICloneable; | |
assert_is_base_of(BaseT_ICloneable, TInner); | |
assert_is_constructable(TInner); | |
typedef IGenericInterfaceWithSeveralConstraints<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
}; | |
} // namespace TypesPorting | |
#endif // _GenericInterfaces_GenericInterfaces_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassGenericMethods.h" | |
#include <system/icloneable.h> | |
namespace MembersPorting { | |
RTTI_INFO_IMPL_HASH(821730475u, ::MembersPorting::ClassGenericMethods, ThisTypeBaseTypesInfo); | |
void ClassGenericMethods::NongenericMethod() { } | |
} // namespace MembersPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ClassGenericMethods_ClassGenericMethods_h_ | |
#define _ClassGenericMethods_ClassGenericMethods_h_ | |
#include <system/object.h> | |
#include <system/icloneable.h> | |
#include <system/constraints.h> | |
namespace MembersPorting { | |
class ClassGenericMethods : public System::Object | |
{ | |
typedef ClassGenericMethods ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void NongenericMethod(); | |
template <typename T> | |
void GenericMethod(T value) { } | |
template <typename T> | |
void GenericMethodWithTypeConstraint(T value) { | |
typedef System::ICloneable BaseT_ICloneable; | |
assert_is_base_of(BaseT_ICloneable, T); | |
} | |
template <typename T> | |
void GenericMethodWithClassConstraint(T value) { | |
assert_is_cs_class(T); | |
} | |
template <typename T> | |
void GenericMethodWithStructConstraint(T value) { | |
assert_is_cs_struct(T); | |
} | |
template <typename T> | |
void GenericMethodWithNewConstraint(T value) { | |
assert_is_constructable(T); | |
} | |
template <typename T> | |
void GenericMethodWithSeveralConstraint(T value) { | |
assert_is_cs_class(T); | |
typedef System::ICloneable BaseT_ICloneable; | |
assert_is_base_of(BaseT_ICloneable, T); | |
assert_is_constructable(T); | |
} | |
}; | |
} // namespace MembersPorting | |
#endif // _ClassGenericMethods_ClassGenericMethods_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _GenericStructs_GenericStructs_h_ | |
#define _GenericStructs_GenericStructs_h_ | |
#include <system/object.h> | |
#include <system/icloneable.h> | |
#include <system/details/pointer_collection_helpers.h> | |
#include <system/constraints.h> | |
namespace TypesPorting { | |
template<typename TInner> | |
class GenericStruct : public System::Object | |
{ | |
typedef GenericStruct<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
GenericStruct() { } | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericStructWithTypeConstraint : public System::Object | |
{ | |
typedef System::ICloneable BaseT_ICloneable; | |
assert_is_base_of(BaseT_ICloneable, TInner); | |
typedef GenericStructWithTypeConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
GenericStructWithTypeConstraint() { } | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericStructWithClassConstraint : public System::Object | |
{ | |
assert_is_cs_class(TInner); | |
typedef GenericStructWithClassConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
GenericStructWithClassConstraint() { } | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericStructWithStructConstraint : public System::Object | |
{ | |
assert_is_cs_struct(TInner); | |
typedef GenericStructWithStructConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
GenericStructWithStructConstraint() { } | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericStructWithNewConstraint : public System::Object | |
{ | |
assert_is_constructable(TInner); | |
typedef GenericStructWithNewConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
GenericStructWithNewConstraint() { } | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericStructWithSeveralConstraints : public System::Object | |
{ | |
assert_is_cs_class(TInner); | |
typedef System::ICloneable BaseT_ICloneable; | |
assert_is_base_of(BaseT_ICloneable, TInner); | |
assert_is_constructable(TInner); | |
typedef GenericStructWithSeveralConstraints<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
GenericStructWithSeveralConstraints() { } | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
} // namespace TypesPorting | |
#endif // _GenericStructs_GenericStructs_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _GenericStructs_GenericStructs_h_ | |
#define _GenericStructs_GenericStructs_h_ | |
#include <system/object.h> | |
#include <system/icloneable.h> | |
#include <system/details/pointer_collection_helpers.h> | |
#include <system/constraints.h> | |
namespace TypesPorting { | |
template<typename TInner> | |
class GenericStruct : public System::Object | |
{ | |
typedef GenericStruct<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
GenericStruct() { } | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericStructWithTypeConstraint : public System::Object | |
{ | |
typedef System::ICloneable BaseT_ICloneable; | |
assert_is_base_of(BaseT_ICloneable, TInner); | |
typedef GenericStructWithTypeConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
GenericStructWithTypeConstraint() { } | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericStructWithClassConstraint : public System::Object | |
{ | |
assert_is_cs_class(TInner); | |
typedef GenericStructWithClassConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
GenericStructWithClassConstraint() { } | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericStructWithStructConstraint : public System::Object | |
{ | |
assert_is_cs_struct(TInner); | |
typedef GenericStructWithStructConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
GenericStructWithStructConstraint() { } | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericStructWithNewConstraint : public System::Object | |
{ | |
assert_is_constructable(TInner); | |
typedef GenericStructWithNewConstraint<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
GenericStructWithNewConstraint() { } | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
template<typename TInner> | |
class GenericStructWithSeveralConstraints : public System::Object | |
{ | |
assert_is_cs_class(TInner); | |
typedef System::ICloneable BaseT_ICloneable; | |
assert_is_base_of(BaseT_ICloneable, TInner); | |
assert_is_constructable(TInner); | |
typedef GenericStructWithSeveralConstraints<TInner> ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo); | |
public: | |
GenericStructWithSeveralConstraints() { } | |
void SetTemplateWeakPtr(unsigned int argument) override | |
{ | |
switch (argument) | |
{ | |
case 0: | |
break; | |
} | |
} | |
}; | |
} // namespace TypesPorting | |
#endif // _GenericStructs_GenericStructs_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "IfStatements.h" | |
#include <system/console.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(4047587550u, ::StatementsPorting::IfStatements, ThisTypeBaseTypesInfo); | |
void IfStatements::If(int32_t value) | |
{ | |
if (value >= 666) | |
{ | |
System::Console::WriteLine(u"iddqd"); | |
} | |
} | |
void IfStatements::IfElse(int32_t value) | |
{ | |
if (value <= 666) | |
{ | |
System::Console::WriteLine(u"iddqd"); | |
} | |
else | |
{ | |
System::Console::WriteLine(u"idkfa"); | |
} | |
} | |
void IfStatements::SeveralIfElse(int32_t value) | |
{ | |
if (value < 3) | |
{ | |
System::Console::WriteLine(u"iddqd"); | |
} | |
else if (value < 13) | |
{ | |
System::Console::WriteLine(u"idkfa"); | |
} | |
else if (value < 33) | |
{ | |
System::Console::WriteLine(u"idclip"); | |
} | |
else if (value < 666) | |
{ | |
System::Console::WriteLine(u"impulse 666"); | |
} | |
else | |
{ | |
System::Console::WriteLine(u"duke nukem must die"); | |
} | |
} | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _IfStatements_IfStatements_h_ | |
#define _IfStatements_IfStatements_h_ | |
#include <system/object.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
class IfStatements : public System::Object | |
{ | |
typedef IfStatements ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void If(int32_t value); | |
void IfElse(int32_t value); | |
void SeveralIfElse(int32_t value); | |
}; | |
} // namespace StatementsPorting | |
#endif // _IfStatements_IfStatements_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassIndexers.h" | |
#include <system/string.h> | |
#include <system/shared_ptr.h> | |
#include <system/object.h> | |
#include <cstdint> | |
namespace MembersPorting { | |
RTTI_INFO_IMPL_HASH(77152164u, ::MembersPorting::ClassIndexers, ThisTypeBaseTypesInfo); | |
int32_t ClassIndexers::idx_get(int32_t index) | |
{ | |
return 0; | |
} | |
void ClassIndexers::idx_set(int32_t index, int32_t value) { } | |
System::String ClassIndexers::idx_get(System::String index) | |
{ | |
return u"iddqd"; | |
} | |
void ClassIndexers::idx_set(System::String index, System::String value) { } | |
bool ClassIndexers::idx_get(bool index) | |
{ | |
return true; | |
} | |
void ClassIndexers::idx_set(bool index, bool value) { } | |
System::SharedPtr<System::Object> ClassIndexers::idx_get(System::SharedPtr<System::Object> index) | |
{ | |
return System::MakeObject<System::Object>(); | |
} | |
void ClassIndexers::idx_set(System::SharedPtr<System::Object> index, System::SharedPtr<System::Object> value) { } | |
} // namespace MembersPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ClassIndexers_ClassIndexers_h_ | |
#define _ClassIndexers_ClassIndexers_h_ | |
#include <system/string.h> | |
#include <system/shared_ptr.h> | |
#include <system/object.h> | |
#include <cstdint> | |
namespace MembersPorting { | |
class ClassIndexers : public System::Object | |
{ | |
typedef ClassIndexers ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
int32_t idx_get(int32_t index); | |
void idx_set(int32_t index, int32_t value); | |
protected: | |
System::String idx_get(System::String index); | |
void idx_set(System::String index, System::String value); | |
bool idx_get(bool index); | |
void idx_set(bool index, bool value); | |
private: | |
System::SharedPtr<System::Object> idx_get(System::SharedPtr<System::Object> index); | |
void idx_set(System::SharedPtr<System::Object> index, System::SharedPtr<System::Object> value); | |
}; | |
} // namespace MembersPorting | |
#endif // _ClassIndexers_ClassIndexers_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "LambdaExpressions.h" | |
#include <system/console.h> | |
#include <system/action.h> | |
#include <functional> | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(539392951u, ::StatementsPorting::LambdaExpressions, ThisTypeBaseTypesInfo); | |
void LambdaExpressions::LambdaWithReturnValueExpressions() | |
{ | |
int32_t delta = 767; | |
SomeCalculation(static_cast<System::Func<int32_t, int32_t>>(std::bind(&LambdaExpressions::SomeSelector, this, std::placeholders::_1))); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<int32_t(int32_t value)> _local_func_0 = [](int32_t value) | |
{ | |
return value + 2; | |
}; | |
SomeCalculation(static_cast<System::Func<int32_t, int32_t>>(_local_func_0)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<int32_t(int32_t value)> _local_func_1 = [&delta](int32_t value) | |
{ | |
return value + delta; | |
}; | |
SomeCalculation(static_cast<System::Func<int32_t, int32_t>>(_local_func_1)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<int32_t(int32_t value)> _local_func_2 = [this](int32_t value) | |
{ | |
return value + mSomeDelta; | |
}; | |
SomeCalculation(static_cast<System::Func<int32_t, int32_t>>(_local_func_2)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<int32_t(int32_t _)> _local_func_3 = [](int32_t _) | |
{ | |
return 777; | |
}; | |
SomeCalculation(static_cast<System::Func<int32_t, int32_t>>(_local_func_3)); | |
System::Func<int32_t, int32_t> selector1 = std::bind(&LambdaExpressions::SomeSelector, this, std::placeholders::_1); | |
SomeCalculation(static_cast<System::Func<int32_t, int32_t>>(selector1)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<int32_t(int32_t value)> _local_func_4 = [](int32_t value) | |
{ | |
return value + 2; | |
}; | |
System::Func<int32_t, int32_t> selector2 = _local_func_4; | |
SomeCalculation(static_cast<System::Func<int32_t, int32_t>>(selector2)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<int32_t(int32_t value)> _local_func_5 = [&delta](int32_t value) | |
{ | |
return value + delta; | |
}; | |
System::Func<int32_t, int32_t> selector3 = _local_func_5; | |
SomeCalculation(static_cast<System::Func<int32_t, int32_t>>(selector3)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<int32_t(int32_t value)> _local_func_6 = [this](int32_t value) | |
{ | |
return value + mSomeDelta; | |
}; | |
System::Func<int32_t, int32_t> selector4 = _local_func_6; | |
SomeCalculation(static_cast<System::Func<int32_t, int32_t>>(selector4)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<int32_t(int32_t _)> _local_func_7 = [](int32_t _) | |
{ | |
return 777; | |
}; | |
System::Func<int32_t, int32_t> selector5 = _local_func_7; | |
SomeCalculation(static_cast<System::Func<int32_t, int32_t>>(selector5)); | |
} | |
void LambdaExpressions::LambdaWithoutReturnValueExpressions() | |
{ | |
int32_t delta = 767; | |
SomeProcessor(static_cast<System::Action<int32_t>>(std::bind(&LambdaExpressions::SomeAction, this, std::placeholders::_1))); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<void(int32_t value)> _local_func_8 = [](int32_t value) | |
{ | |
System::Console::WriteLine(value + 2); | |
}; | |
SomeProcessor(static_cast<System::Action<int32_t>>(_local_func_8)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<void(int32_t value)> _local_func_9 = [&delta](int32_t value) | |
{ | |
System::Console::WriteLine(value + delta); | |
}; | |
SomeProcessor(static_cast<System::Action<int32_t>>(_local_func_9)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<void(int32_t value)> _local_func_10 = [this](int32_t value) | |
{ | |
System::Console::WriteLine(value + mSomeDelta); | |
}; | |
SomeProcessor(static_cast<System::Action<int32_t>>(_local_func_10)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<void(int32_t _)> _local_func_11 = [](int32_t _) | |
{ | |
System::Console::WriteLine(777); | |
}; | |
SomeProcessor(static_cast<System::Action<int32_t>>(_local_func_11)); | |
System::Action<int32_t> action1(std::bind(&LambdaExpressions::SomeAction, this, std::placeholders::_1)); | |
SomeProcessor(static_cast<System::Action<int32_t>>(action1)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<void(int32_t value)> _local_func_12 = [](int32_t value) | |
{ | |
System::Console::WriteLine(value + 2); | |
}; | |
System::Action<int32_t> action2(_local_func_12); | |
SomeProcessor(static_cast<System::Action<int32_t>>(action2)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<void(int32_t value)> _local_func_13 = [&delta](int32_t value) | |
{ | |
System::Console::WriteLine(value + delta); | |
}; | |
System::Action<int32_t> action3(_local_func_13); | |
SomeProcessor(static_cast<System::Action<int32_t>>(action3)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<void(int32_t value)> _local_func_14 = [this](int32_t value) | |
{ | |
System::Console::WriteLine(value + mSomeDelta); | |
}; | |
System::Action<int32_t> action4(_local_func_14); | |
SomeProcessor(static_cast<System::Action<int32_t>>(action4)); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<void(int32_t _)> _local_func_15 = [](int32_t _) | |
{ | |
System::Console::WriteLine(777); | |
}; | |
System::Action<int32_t> action5(_local_func_15); | |
SomeProcessor(static_cast<System::Action<int32_t>>(action5)); | |
} | |
void LambdaExpressions::LambdaCurrying() | |
{ | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<int32_t(int32_t value1, int32_t value2)> _local_func_16 = [](int32_t value1, int32_t value2) | |
{ | |
return value1 + value2; | |
}; | |
System::Func<int32_t, int32_t, int32_t> someFun = _local_func_16; | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<int32_t(int32_t value)> _local_func_17 = [&someFun](int32_t value) | |
{ | |
return someFun(value, 666); | |
}; | |
System::Func<int32_t, int32_t> simpleFun1 = _local_func_17; | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<int32_t(int32_t value)> _local_func_18 = [&someFun](int32_t value) | |
{ | |
return someFun(777, value); | |
}; | |
System::Func<int32_t, int32_t> simpleFun2 = _local_func_18; | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<void(int32_t value1, int32_t value2)> _local_func_19 = [](int32_t value1, int32_t value2) | |
{ | |
System::Console::WriteLine(value1 + value2); | |
}; | |
System::Action<int32_t, int32_t> someAction(_local_func_19); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<void(int32_t value)> _local_func_20 = [&someAction](int32_t value) | |
{ | |
someAction(value, 666); | |
}; | |
System::Action<int32_t> simpleAction1(_local_func_20); | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<void(int32_t value)> _local_func_21 = [&someAction](int32_t value) | |
{ | |
someAction(777, value); | |
}; | |
System::Action<int32_t> simpleAction2(_local_func_21); | |
} | |
void LambdaExpressions::LambdaReturnedFromFunctionExpressions() | |
{ | |
System::Func<int32_t, int32_t> lambda1 = CreateFun(666); | |
System::Func<int32_t, int32_t> lambda2 = CreateFun(-13); | |
} | |
void LambdaExpressions::SomeCalculation(System::Func<int32_t, int32_t> selector) { } | |
int32_t LambdaExpressions::SomeSelector(int32_t value) | |
{ | |
return 777; | |
} | |
void LambdaExpressions::SomeProcessor(System::Action<int32_t> action) { } | |
void LambdaExpressions::SomeAction(int32_t value) { } | |
System::Func<int32_t, int32_t> LambdaExpressions::CreateFun(int32_t delta) | |
{ | |
// CSPORTCPP: [WARNING] Using local variables. Make sure that local function ptr does not leave the current scope. | |
std::function<int32_t(int32_t value)> _local_func_22 = [&delta](int32_t value) | |
{ | |
return value + delta; | |
}; | |
return _local_func_22; | |
} | |
LambdaExpressions::LambdaExpressions() : mSomeDelta(3343) { } | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _LambdaExpressions_LambdaExpressions_h_ | |
#define _LambdaExpressions_LambdaExpressions_h_ | |
#include <system/object.h> | |
#include <system/action.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
class LambdaExpressions : public System::Object | |
{ | |
typedef LambdaExpressions ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void LambdaWithReturnValueExpressions(); | |
void LambdaWithoutReturnValueExpressions(); | |
void LambdaCurrying(); | |
void LambdaReturnedFromFunctionExpressions(); | |
LambdaExpressions(); | |
private: | |
int32_t mSomeDelta; | |
void SomeCalculation(System::Func<int32_t, int32_t> selector); | |
int32_t SomeSelector(int32_t value); | |
void SomeProcessor(System::Action<int32_t> action); | |
void SomeAction(int32_t value); | |
System::Func<int32_t, int32_t> CreateFun(int32_t delta); | |
}; | |
} // namespace StatementsPorting | |
#endif // _LambdaExpressions_LambdaExpressions_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassMethods.h" | |
namespace MembersPorting { | |
RTTI_INFO_IMPL_HASH(582355426u, ::MembersPorting::ClassMethods, ThisTypeBaseTypesInfo); | |
void ClassMethods::PublicMethod() { } | |
void ClassMethods::InternalMethod() { } | |
void ClassMethods::ProtectedMethod() { } | |
void ClassMethods::PrivateMethod() { } | |
} // namespace MembersPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ClassMethods_ClassMethods_h_ | |
#define _ClassMethods_ClassMethods_h_ | |
#include <system/object.h> | |
namespace MembersPorting { | |
class ClassMethods : public System::Object | |
{ | |
typedef ClassMethods ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void PublicMethod(); | |
protected: | |
void InternalMethod(); | |
void ProtectedMethod(); | |
private: | |
void PrivateMethod(); | |
}; | |
} // namespace MembersPorting | |
#endif // _ClassMethods_ClassMethods_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "NestedClasses.h" | |
namespace TypesPorting { | |
RTTI_INFO_IMPL_HASH(490849539u, ::TypesPorting::OuterClass::PrivateNestedClass, ThisTypeBaseTypesInfo); | |
RTTI_INFO_IMPL_HASH(3027911832u, ::TypesPorting::OuterClass::ProtectedNestedClass, ThisTypeBaseTypesInfo); | |
RTTI_INFO_IMPL_HASH(1087067711u, ::TypesPorting::OuterClass::InternalNestedClass, ThisTypeBaseTypesInfo); | |
RTTI_INFO_IMPL_HASH(918013299u, ::TypesPorting::OuterClass::PublicNestedClass, ThisTypeBaseTypesInfo); | |
RTTI_INFO_IMPL_HASH(615668933u, ::TypesPorting::OuterClass, ThisTypeBaseTypesInfo); | |
} // namespace TypesPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _NestedClasses_NestedClasses_h_ | |
#define _NestedClasses_NestedClasses_h_ | |
#include <system/object.h> | |
namespace TypesPorting { | |
class OuterClass : public System::Object | |
{ | |
typedef OuterClass ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
class PublicNestedClass : public System::Object | |
{ | |
typedef PublicNestedClass ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
}; | |
protected: | |
class InternalNestedClass : public System::Object | |
{ | |
typedef InternalNestedClass ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
}; | |
class ProtectedNestedClass : public System::Object | |
{ | |
typedef ProtectedNestedClass ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
}; | |
private: | |
class PrivateNestedClass : public System::Object | |
{ | |
typedef PrivateNestedClass ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
}; | |
}; | |
} // namespace TypesPorting | |
#endif // _NestedClasses_NestedClasses_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassProperties.h" | |
#include <system/string.h> | |
#include <cstdint> | |
namespace MembersPorting { | |
RTTI_INFO_IMPL_HASH(541627203u, ::MembersPorting::ClassProperties, ThisTypeBaseTypesInfo); | |
int32_t ClassProperties::get_PublicProperty() | |
{ | |
return mPublicPropertyField; | |
} | |
void ClassProperties::set_PublicProperty(int32_t value) | |
{ | |
mPublicPropertyField = value; | |
} | |
int32_t ClassProperties::get_PublicPropertyWithoutSetter() | |
{ | |
return mPublicPropertyField; | |
} | |
void ClassProperties::set_PublicPropertyWithoutGetter(int32_t value) | |
{ | |
mPublicPropertyWithoutGetterField = value; | |
} | |
System::String ClassProperties::get_InternalProperty() | |
{ | |
return mInternalPropertyField; | |
} | |
void ClassProperties::set_InternalProperty(System::String value) | |
{ | |
mInternalPropertyField = value; | |
} | |
bool ClassProperties::get_ProtectedProperty() | |
{ | |
return mProtectedPropertyField; | |
} | |
void ClassProperties::set_ProtectedProperty(bool value) | |
{ | |
mProtectedPropertyField = value; | |
} | |
double ClassProperties::get_PrivateProperty() | |
{ | |
return mPrivatePropertyField; | |
} | |
void ClassProperties::set_PrivateProperty(double value) | |
{ | |
mPrivatePropertyField = value; | |
} | |
ClassProperties::ClassProperties() : mPublicPropertyField(0), mPublicPropertyWithoutSetterField(0) | |
, mPublicPropertyWithoutGetterField(0), mProtectedPropertyField(false), mPrivatePropertyField(0) { } | |
} // namespace MembersPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ClassProperties_ClassProperties_h_ | |
#define _ClassProperties_ClassProperties_h_ | |
#include <system/string.h> | |
#include <system/object.h> | |
#include <cstdint> | |
namespace MembersPorting { | |
class ClassProperties : public System::Object | |
{ | |
typedef ClassProperties ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
int32_t get_PublicProperty(); | |
void set_PublicProperty(int32_t value); | |
int32_t get_PublicPropertyWithoutSetter(); | |
void set_PublicPropertyWithoutGetter(int32_t value); | |
ClassProperties(); | |
protected: | |
System::String get_InternalProperty(); | |
void set_InternalProperty(System::String value); | |
bool get_ProtectedProperty(); | |
void set_ProtectedProperty(bool value); | |
private: | |
double get_PrivateProperty(); | |
void set_PrivateProperty(double value); | |
int32_t mPublicPropertyField; | |
int32_t mPublicPropertyWithoutSetterField; | |
int32_t mPublicPropertyWithoutGetterField; | |
System::String mInternalPropertyField; | |
bool mProtectedPropertyField; | |
double mPrivatePropertyField; | |
}; | |
} // namespace MembersPorting | |
#endif // _ClassProperties_ClassProperties_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ReturnStatements.h" | |
#include <system/console.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(2520855697u, ::StatementsPorting::ReturnStatements, ThisTypeBaseTypesInfo); | |
void ReturnStatements::ReturnVoid(int32_t value) | |
{ | |
if (value < 10) | |
{ | |
return; | |
} | |
System::Console::WriteLine(value); | |
} | |
int32_t ReturnStatements::ReturnValue(int32_t value) | |
{ | |
if (value < 10) | |
{ | |
return 666; | |
} | |
System::Console::WriteLine(value); | |
return 13; | |
} | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ReturnStatements_ReturnStatements_h_ | |
#define _ReturnStatements_ReturnStatements_h_ | |
#include <system/object.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
class ReturnStatements : public System::Object | |
{ | |
typedef ReturnStatements ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void ReturnVoid(int32_t value); | |
int32_t ReturnValue(int32_t value); | |
}; | |
} // namespace StatementsPorting | |
#endif // _ReturnStatements_ReturnStatements_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "SimpleClass.h" | |
namespace TypesPorting { | |
RTTI_INFO_IMPL_HASH(3993001598u, ::TypesPorting::SimpleClass, ThisTypeBaseTypesInfo); | |
} // namespace TypesPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _SimpleClass_SimpleClass_h_ | |
#define _SimpleClass_SimpleClass_h_ | |
#include <system/object.h> | |
namespace TypesPorting { | |
class SimpleClass : public System::Object | |
{ | |
typedef SimpleClass ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
}; | |
} // namespace TypesPorting | |
#endif // _SimpleClass_SimpleClass_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ISimpleInterface.h" | |
namespace TypesPorting { | |
RTTI_INFO_IMPL_HASH(2998900006u, ::TypesPorting::ISimpleInterface, ThisTypeBaseTypesInfo); | |
} // namespace TypesPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ISimpleInterface_ISimpleInterface_h_ | |
#define _ISimpleInterface_ISimpleInterface_h_ | |
#include <system/object.h> | |
namespace TypesPorting { | |
class ISimpleInterface : public System::Object | |
{ | |
typedef ISimpleInterface ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
}; | |
} // namespace TypesPorting | |
#endif // _ISimpleInterface_ISimpleInterface_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "SimpleStruct.h" | |
namespace TypesPorting { | |
RTTI_INFO_IMPL_HASH(2325628207u, ::TypesPorting::SimpleStruct, ThisTypeBaseTypesInfo); | |
SimpleStruct::SimpleStruct() { } | |
} // namespace TypesPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _SimpleStruct_SimpleStruct_h_ | |
#define _SimpleStruct_SimpleStruct_h_ | |
#include <system/object.h> | |
namespace TypesPorting { | |
class SimpleStruct : public System::Object | |
{ | |
typedef SimpleStruct ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
SimpleStruct(); | |
}; | |
} // namespace TypesPorting | |
#endif // _SimpleStruct_SimpleStruct_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "SimpleTest.h" | |
namespace NUnitTestsPorting { | |
void SimpleTest::T1() { } | |
TEST_F(SimpleTest, T1) | |
{ | |
T1(); | |
} | |
} // namespace NUnitTestsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _SimpleTest_SimpleTest_h_ | |
#define _SimpleTest_SimpleTest_h_ | |
#include <system/object.h> | |
#include <gtest/gtest.h> | |
namespace NUnitTestsPorting { | |
class SimpleTest : public System::Object, public ::testing::Test | |
{ | |
public: | |
void T1(); | |
}; | |
} // namespace NUnitTestsPorting | |
#endif // _SimpleTest_SimpleTest_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "StandardTypeCast.h" | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(2854543123u, ::StatementsPorting::StandardTypeCast, ThisTypeBaseTypesInfo); | |
void StandardTypeCast::SByteTypeCasts() | |
{ | |
int8_t source = -11; | |
// implicit casts | |
int16_t dest1 = source; | |
int32_t dest2 = source; | |
int64_t dest3 = source; | |
float dest4 = source; | |
double dest5 = source; | |
// explicit casts | |
uint8_t dest6 = (uint8_t)source; | |
uint16_t dest7 = (uint16_t)source; | |
uint32_t dest8 = (uint32_t)source; | |
uint64_t dest9 = (uint64_t)source; | |
char16_t dest10 = (char16_t)source; | |
} | |
void StandardTypeCast::ByteTypeCasts() | |
{ | |
uint8_t source = 13; | |
// implicit casts | |
int16_t dest1 = source; | |
uint16_t dest2 = source; | |
int32_t dest3 = source; | |
uint32_t dest4 = source; | |
int64_t dest5 = source; | |
uint64_t dest6 = source; | |
float dest7 = source; | |
double dest8 = source; | |
// explicit casts | |
int8_t dest9 = (int8_t)source; | |
char16_t dest10 = (char16_t)source; | |
} | |
void StandardTypeCast::ShortTypeCasts() | |
{ | |
int16_t source = -333; | |
// implicit casts | |
int32_t dest1 = source; | |
int64_t dest2 = source; | |
float dest3 = source; | |
double dest4 = source; | |
// explicit casts | |
int8_t dest5 = (int8_t)source; | |
uint8_t dest6 = (uint8_t)source; | |
uint16_t dest7 = (uint16_t)source; | |
uint32_t dest8 = (uint32_t)source; | |
uint64_t dest9 = (uint64_t)source; | |
char16_t dest10 = (char16_t)source; | |
} | |
void StandardTypeCast::UShortTypeCasts() | |
{ | |
uint16_t source = 666; | |
// implicit casts | |
int32_t dest1 = source; | |
uint32_t dest2 = source; | |
int64_t dest3 = source; | |
uint64_t dest4 = source; | |
float dest5 = source; | |
double dest6 = source; | |
// explicit casts | |
int8_t dest7 = (int8_t)source; | |
uint8_t dest8 = (uint8_t)source; | |
int16_t dest9 = (int16_t)source; | |
char16_t dest10 = (char16_t)source; | |
} | |
void StandardTypeCast::IntTypeCasts() | |
{ | |
int32_t source = -333333; | |
// implicit casts | |
int64_t dest1 = source; | |
float dest2 = source; | |
double dest3 = source; | |
// explicit casts | |
int8_t dest4 = (int8_t)source; | |
uint8_t dest5 = (uint8_t)source; | |
int16_t dest6 = (int16_t)source; | |
uint16_t dest7 = (uint16_t)source; | |
uint32_t dest8 = (uint32_t)source; | |
uint64_t dest9 = (uint64_t)source; | |
char16_t dest10 = (char16_t)source; | |
} | |
void StandardTypeCast::UIntTypeCasts() | |
{ | |
uint32_t source = 666666; | |
// implicit casts; | |
int64_t dest1 = source; | |
uint64_t dest2 = source; | |
float dest3 = source; | |
double dest4 = source; | |
// explicit casts | |
int8_t dest5 = (int8_t)source; | |
uint8_t dest6 = (uint8_t)source; | |
int16_t dest7 = (int16_t)source; | |
uint16_t dest8 = (uint16_t)source; | |
int32_t dest9 = (int32_t)source; | |
char16_t dest10 = (char16_t)source; | |
} | |
void StandardTypeCast::LongTypeCasts() | |
{ | |
int64_t source = -333333333; | |
// implicit casts | |
float dest1 = source; | |
double dest2 = source; | |
// explicit casts | |
int8_t dest3 = (int8_t)source; | |
uint8_t dest4 = (uint8_t)source; | |
int16_t dest5 = (int16_t)source; | |
uint16_t dest6 = (uint16_t)source; | |
int32_t dest7 = (int32_t)source; | |
uint32_t dest8 = (uint32_t)source; | |
uint64_t dest9 = (uint64_t)source; | |
char16_t dest10 = (char16_t)source; | |
} | |
void StandardTypeCast::ULongTypeCasts() | |
{ | |
uint64_t source = 666666666; | |
// implicit casts; | |
float dest1 = source; | |
double dest2 = source; | |
// explicit casts | |
int8_t dest3 = (int8_t)source; | |
uint8_t dest4 = (uint8_t)source; | |
int16_t dest5 = (int16_t)source; | |
uint16_t dest6 = (uint16_t)source; | |
int32_t dest7 = (int32_t)source; | |
uint32_t dest8 = (uint32_t)source; | |
int64_t dest9 = (int64_t)source; | |
char16_t dest10 = (char16_t)source; | |
} | |
void StandardTypeCast::FloatTypeCasts() | |
{ | |
float source = 3.1415926f; | |
// implicit casts | |
double dest1 = source; | |
// explicit casts | |
int8_t dest2 = (int8_t)source; | |
uint8_t dest3 = (uint8_t)source; | |
int16_t dest4 = (int16_t)source; | |
uint16_t dest5 = (uint16_t)source; | |
int32_t dest6 = (int32_t)source; | |
uint32_t dest7 = (uint32_t)source; | |
int64_t dest8 = (int64_t)source; | |
uint64_t dest9 = (uint64_t)source; | |
char16_t dest10 = (char16_t)source; | |
} | |
void StandardTypeCast::DoubleTypeCasts() | |
{ | |
double source = 3.1415926; | |
// explicit casts | |
int8_t dest1 = (int8_t)source; | |
uint8_t dest2 = (uint8_t)source; | |
int16_t dest3 = (int16_t)source; | |
uint16_t dest4 = (uint16_t)source; | |
int32_t dest5 = (int32_t)source; | |
uint32_t dest6 = (uint32_t)source; | |
int64_t dest7 = (int64_t)source; | |
uint64_t dest8 = (uint64_t)source; | |
float dest9 = (float)source; | |
char16_t dest10 = (char16_t)source; | |
} | |
void StandardTypeCast::CharTypeCasts() | |
{ | |
char16_t source = u'A'; | |
// implicit casts | |
uint16_t dest1 = source; | |
int32_t dest2 = source; | |
uint32_t dest3 = source; | |
int64_t dest4 = source; | |
uint64_t dest5 = source; | |
float dest6 = source; | |
double dest7 = source; | |
// explicit casts | |
int8_t dest8 = (int8_t)source; | |
uint8_t dest9 = (uint8_t)source; | |
int16_t dest10 = (int16_t)source; | |
} | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _StandardTypeCast_StandardTypeCast_h_ | |
#define _StandardTypeCast_StandardTypeCast_h_ | |
#include <system/object.h> | |
namespace StatementsPorting { | |
class StandardTypeCast : public System::Object | |
{ | |
typedef StandardTypeCast ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void SByteTypeCasts(); | |
void ByteTypeCasts(); | |
void ShortTypeCasts(); | |
void UShortTypeCasts(); | |
void IntTypeCasts(); | |
void UIntTypeCasts(); | |
void LongTypeCasts(); | |
void ULongTypeCasts(); | |
void FloatTypeCasts(); | |
void DoubleTypeCasts(); | |
void CharTypeCasts(); | |
}; | |
} // namespace StatementsPorting | |
#endif // _StandardTypeCast_StandardTypeCast_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "StaticClass.h" | |
namespace TypesPorting { | |
void StaticClass::StaticMethod() { } | |
} // namespace TypesPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _StaticClass_StaticClass_h_ | |
#define _StaticClass_StaticClass_h_ | |
namespace TypesPorting { | |
class StaticClass | |
{ | |
typedef StaticClass ThisType; | |
public: | |
static void StaticMethod(); | |
}; | |
} // namespace TypesPorting | |
#endif // _StaticClass_StaticClass_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassStaticConstructor.h" | |
namespace MembersPorting { | |
RTTI_INFO_IMPL_HASH(2828145692u, ::MembersPorting::ClassStaticConstructor, ThisTypeBaseTypesInfo); | |
ClassStaticConstructor::__StaticConstructor__ ClassStaticConstructor::s_constructor__; | |
ClassStaticConstructor::__StaticConstructor__::__StaticConstructor__() | |
{ | |
} | |
} // namespace MembersPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ClassStaticConstructor_ClassStaticConstructor_h_ | |
#define _ClassStaticConstructor_ClassStaticConstructor_h_ | |
#include <system/shared_ptr.h> | |
#include <system/object.h> | |
namespace MembersPorting { | |
class ClassStaticConstructor : public System::Object | |
{ | |
typedef ClassStaticConstructor ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
FRIEND_FUNCTION_System_MakeObject; | |
private: | |
static struct __StaticConstructor__ { __StaticConstructor__(); } s_constructor__; | |
}; | |
} // namespace MembersPorting | |
#endif // _ClassStaticConstructor_ClassStaticConstructor_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassStaticMethods.h" | |
namespace MembersPorting { | |
RTTI_INFO_IMPL_HASH(3437933940u, ::MembersPorting::ClassStaticMethods, ThisTypeBaseTypesInfo); | |
void ClassStaticMethods::PublicMethod() { } | |
void ClassStaticMethods::InternalMethod() { } | |
void ClassStaticMethods::ProtectedMethod() { } | |
void ClassStaticMethods::PrivateMethod() { } | |
} // namespace MembersPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ClassStaticMethods_ClassStaticMethods_h_ | |
#define _ClassStaticMethods_ClassStaticMethods_h_ | |
#include <system/object.h> | |
namespace MembersPorting { | |
class ClassStaticMethods : public System::Object | |
{ | |
typedef ClassStaticMethods ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
static void PublicMethod(); | |
protected: | |
static void InternalMethod(); | |
static void ProtectedMethod(); | |
private: | |
static void PrivateMethod(); | |
}; | |
} // namespace MembersPorting | |
#endif // _ClassStaticMethods_ClassStaticMethods_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassStaticProperties.h" | |
namespace MembersPorting { | |
RTTI_INFO_IMPL_HASH(4083627313u, ::MembersPorting::ClassStaticProperties, ThisTypeBaseTypesInfo); | |
int32_t ClassStaticProperties::pr_PublicProperty = 0; | |
System::String ClassStaticProperties::pr_InternalProperty; | |
int32_t ClassStaticProperties::pr_ProtectedProperty = 0; | |
int32_t ClassStaticProperties::pr_PrivateProperty = 0; | |
int32_t ClassStaticProperties::get_PublicProperty() | |
{ | |
return pr_PublicProperty; | |
} | |
void ClassStaticProperties::set_PublicProperty(int32_t value) | |
{ | |
pr_PublicProperty = value; | |
} | |
System::String ClassStaticProperties::get_InternalProperty() | |
{ | |
return pr_InternalProperty; | |
} | |
void ClassStaticProperties::set_InternalProperty(System::String value) | |
{ | |
pr_InternalProperty = value; | |
} | |
int32_t ClassStaticProperties::get_ProtectedProperty() | |
{ | |
return pr_ProtectedProperty; | |
} | |
void ClassStaticProperties::set_ProtectedProperty(int32_t value) | |
{ | |
pr_ProtectedProperty = value; | |
} | |
int32_t ClassStaticProperties::get_PrivateProperty() | |
{ | |
return pr_PrivateProperty; | |
} | |
void ClassStaticProperties::set_PrivateProperty(int32_t value) | |
{ | |
pr_PrivateProperty = value; | |
} | |
} // namespace MembersPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ClassStaticProperties_ClassStaticProperties_h_ | |
#define _ClassStaticProperties_ClassStaticProperties_h_ | |
#include <system/string.h> | |
#include <system/object.h> | |
#include <cstdint> | |
namespace MembersPorting { | |
class ClassStaticProperties : public System::Object | |
{ | |
typedef ClassStaticProperties ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
static int32_t get_PublicProperty(); | |
static void set_PublicProperty(int32_t value); | |
protected: | |
static System::String get_InternalProperty(); | |
static void set_InternalProperty(System::String value); | |
static int32_t get_ProtectedProperty(); | |
static void set_ProtectedProperty(int32_t value); | |
private: | |
static int32_t pr_PublicProperty; | |
static System::String pr_InternalProperty; | |
static int32_t pr_ProtectedProperty; | |
static int32_t pr_PrivateProperty; | |
static int32_t get_PrivateProperty(); | |
static void set_PrivateProperty(int32_t value); | |
}; | |
} // namespace MembersPorting | |
#endif // _ClassStaticProperties_ClassStaticProperties_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "SwitchStatements.h" | |
#include <system/string.h> | |
#include <system/console.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(3987979893u, ::StatementsPorting::SwitchStatements, ThisTypeBaseTypesInfo); | |
void SwitchStatements::IntSwitch(int32_t value) | |
{ | |
switch (value) | |
{ | |
case 3: | |
System::Console::WriteLine(u"3 branch"); | |
break; | |
case 4: | |
case 5: | |
System::Console::WriteLine(u"4-5 branch"); | |
break; | |
case 6: | |
System::Console::WriteLine(u"6 branch with return"); | |
return; | |
case 7: | |
System::Console::WriteLine(u"7 branch"); | |
break; | |
default: | |
System::Console::WriteLine(u"default branch"); | |
break; | |
} | |
} | |
void SwitchStatements::EnumSwitch(SomeEnum value) | |
{ | |
switch (value) | |
{ | |
case StatementsPorting::SomeEnum::InitValue: | |
System::Console::WriteLine(u"SomeEnum.InitValue branch"); | |
break; | |
case StatementsPorting::SomeEnum::Value: | |
case StatementsPorting::SomeEnum::SomeValue: | |
System::Console::WriteLine(u"SomeEnum.Value-SomeEnum.SomeValue branch"); | |
break; | |
case StatementsPorting::SomeEnum::OtherValue: | |
System::Console::WriteLine(u"SomeEnum.OtherValue branch with return"); | |
return; | |
case StatementsPorting::SomeEnum::YetOneValue: | |
System::Console::WriteLine(u"SomeEnum.YetOneValue branch"); | |
break; | |
default: | |
System::Console::WriteLine(u"default branch"); | |
break; | |
} | |
} | |
void SwitchStatements::StringSwitch(System::String value) | |
{ | |
const System::String& switch_value_0 = value; | |
if (switch_value_0 == u"iddqd") | |
{ | |
System::Console::WriteLine(u"iddqd branch"); | |
} | |
else if (switch_value_0 == u"idkfa" || switch_value_0 == u"idkfa2") | |
{ | |
System::Console::WriteLine(u"idkfa-idkfa2 branch"); | |
} | |
else if (switch_value_0 == u"idclip") | |
{ | |
System::Console::WriteLine(u"idclip branch with return"); | |
return; | |
} | |
else if (switch_value_0 == u"quicken") | |
{ | |
System::Console::WriteLine(u"quicken branch"); | |
} | |
else if (true) | |
{ | |
System::Console::WriteLine(u"default branch"); | |
} | |
} | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _SwitchStatements_SwitchStatements_h_ | |
#define _SwitchStatements_SwitchStatements_h_ | |
#include <system/string.h> | |
#include <system/object.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
enum class SomeEnum | |
{ | |
InitValue = 0, | |
Value = 1, | |
SomeValue = 2, | |
OtherValue = 3, | |
YetOneValue = 4, | |
AnotherValue = 5 | |
}; | |
class SwitchStatements : public System::Object | |
{ | |
typedef SwitchStatements ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void IntSwitch(int32_t value); | |
void EnumSwitch(SomeEnum value); | |
void StringSwitch(System::String value); | |
}; | |
} // namespace StatementsPorting | |
#endif // _SwitchStatements_SwitchStatements_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "TestWithSetupMethods.h" | |
#include <cstdint> | |
namespace NUnitTestsPorting { | |
int32_t TestWithSetupMethods::mValue = 0; | |
void TestWithSetupMethods::SetUp() | |
{ | |
mValue += 1; | |
} | |
void TestWithSetupMethods::TearDown() | |
{ | |
mValue -= 1; | |
} | |
void TestWithSetupMethods::SetUpTestCase() | |
{ | |
mValue += 10; | |
} | |
void TestWithSetupMethods::TearDownTestCase() | |
{ | |
mValue -= 10; | |
} | |
void TestWithSetupMethods::TestMethod() { } | |
TEST_F(TestWithSetupMethods, TestMethod) | |
{ | |
TestMethod(); | |
} | |
TestWithSetupMethods::TestWithSetupMethods() { } | |
} // namespace NUnitTestsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _TestWithSetupMethods_TestWithSetupMethods_h_ | |
#define _TestWithSetupMethods_TestWithSetupMethods_h_ | |
#include <system/object.h> | |
#include <gtest/gtest.h> | |
#include <cstdint> | |
namespace NUnitTestsPorting { | |
class TestWithSetupMethods : public System::Object, public ::testing::Test | |
{ | |
public: | |
void SetUp(); | |
void TearDown(); | |
static void SetUpTestCase(); | |
static void TearDownTestCase(); | |
void TestMethod(); | |
TestWithSetupMethods(); | |
protected: | |
static int32_t mValue; | |
}; | |
} // namespace NUnitTestsPorting | |
#endif // _TestWithSetupMethods_TestWithSetupMethods_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ThrowStatements.h" | |
#include <system/exceptions.h> | |
#include <system/console.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(927407390u, ::StatementsPorting::SomeException, ThisTypeBaseTypesInfo); | |
SomeException::~SomeException() {} | |
SomeException::SomeException() : System::Exception() { } | |
SomeException::SomeException(std::nullptr_t) : System::Exception(nullptr) {} | |
RTTI_INFO_IMPL_HASH(1983333724u, ::StatementsPorting::OtherException, ThisTypeBaseTypesInfo); | |
OtherException::~OtherException() {} | |
OtherException::OtherException() : System::Exception() { } | |
OtherException::OtherException(std::nullptr_t) : System::Exception(nullptr) {} | |
RTTI_INFO_IMPL_HASH(922865773u, ::StatementsPorting::ThrowStatements, ThisTypeBaseTypesInfo); | |
void ThrowStatements::Throw(int32_t value) | |
{ | |
if (value < 10) | |
{ | |
System::Console::WriteLine(u"Too small value"); | |
throw SomeException(); | |
} | |
if (value > 20) | |
{ | |
System::Console::WriteLine(u"Too big value"); | |
throw OtherException(); | |
} | |
} | |
void ThrowStatements::RethrowSame() | |
{ | |
try | |
{ | |
InnerMethod(); | |
} | |
catch (SomeException& ) | |
{ | |
System::Console::WriteLine(u"Catch SomeException"); | |
throw; | |
} | |
} | |
void ThrowStatements::RethrowOther() | |
{ | |
try | |
{ | |
InnerMethod(); | |
} | |
catch (SomeException& ) | |
{ | |
System::Console::WriteLine(u"Catch SomeException"); | |
throw OtherException(); | |
} | |
} | |
void ThrowStatements::InnerMethod() { } | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ThrowStatements_ThrowStatements_h_ | |
#define _ThrowStatements_ThrowStatements_h_ | |
#include <system/object.h> | |
#include <system/exceptions.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
class SomeException : public System::Exception | |
{ | |
typedef SomeException ThisType; | |
typedef System::Exception BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual ~SomeException(); | |
SomeException(); | |
SomeException(std::nullptr_t); | |
}; | |
class OtherException : public System::Exception | |
{ | |
typedef OtherException ThisType; | |
typedef System::Exception BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual ~OtherException(); | |
OtherException(); | |
OtherException(std::nullptr_t); | |
}; | |
class ThrowStatements : public System::Object | |
{ | |
typedef ThrowStatements ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void Throw(int32_t value); | |
void RethrowSame(); | |
void RethrowOther(); | |
private: | |
void InnerMethod(); | |
}; | |
} // namespace StatementsPorting | |
#endif // _ThrowStatements_ThrowStatements_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "TryCatchFinallyStatements.h" | |
#include <system/shared_ptr.h> | |
#include <system/object.h> | |
#include <system/exceptions.h> | |
#include <system/do_try_finally.h> | |
#include <system/console.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(3457991606u, ::StatementsPorting::GrandParentException, ThisTypeBaseTypesInfo); | |
GrandParentException::~GrandParentException() {} | |
GrandParentException::GrandParentException() : System::Exception() { } | |
GrandParentException::GrandParentException(std::nullptr_t) : System::Exception(nullptr) {} | |
RTTI_INFO_IMPL_HASH(3209790888u, ::StatementsPorting::ParentException, ThisTypeBaseTypesInfo); | |
ParentException::~ParentException() {} | |
ParentException::ParentException() : GrandParentException() { } | |
ParentException::ParentException(std::nullptr_t) : GrandParentException(nullptr) {} | |
RTTI_INFO_IMPL_HASH(2858341424u, ::StatementsPorting::ChildException, ThisTypeBaseTypesInfo); | |
ChildException::~ChildException() {} | |
ChildException::ChildException() : ParentException() { } | |
ChildException::ChildException(std::nullptr_t) : ParentException(nullptr) {} | |
RTTI_INFO_IMPL_HASH(684751338u, ::StatementsPorting::TryCatchFinallyStatements, ThisTypeBaseTypesInfo); | |
void TryCatchFinallyStatements::TryCatchFinally() | |
{ | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
try | |
{ | |
InnerMethod(); | |
} | |
catch (ChildException& ) | |
{ | |
System::Console::WriteLine(u"Catch ChildException"); | |
} | |
catch (ParentException& ) | |
{ | |
System::Console::WriteLine(u"Catch ParentException"); | |
} | |
catch (GrandParentException& ) | |
{ | |
System::Console::WriteLine(u"Catch GrandParentException"); | |
} | |
catch (System::Exception& ) | |
{ | |
System::Console::WriteLine(u"Catch Exception"); | |
} | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Finally"); | |
}); | |
} | |
void TryCatchFinallyStatements::EnclosedTryCatchFinally() | |
{ | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
try | |
{ | |
InnerMethod(); | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
try | |
{ | |
InnerMethod(); | |
} | |
catch (System::InvalidOperationException& ) | |
{ | |
System::Console::WriteLine(u"Catch InvalidOperationException"); | |
} | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Finally"); | |
}); | |
} | |
catch (ChildException& ) | |
{ | |
System::Console::WriteLine(u"Catch ChildException"); | |
} | |
catch (ParentException& ) | |
{ | |
System::Console::WriteLine(u"Catch ParentException"); | |
} | |
catch (GrandParentException& ) | |
{ | |
System::Console::WriteLine(u"Catch GrandParentException"); | |
} | |
catch (System::Exception& ) | |
{ | |
System::Console::WriteLine(u"Catch Exception"); | |
} | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Finally"); | |
}); | |
} | |
void TryCatchFinallyStatements::EnclosedTryCatchFinallyWithException() | |
{ | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
try | |
{ | |
InnerMethod(); | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
try | |
{ | |
InnerMethod(); | |
} | |
catch (System::InvalidOperationException& ) | |
{ | |
System::Console::WriteLine(u"Catch InvalidOperationException"); | |
} | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Finally"); | |
throw System::Exception(); | |
}); | |
} | |
catch (ChildException& ) | |
{ | |
System::Console::WriteLine(u"Catch ChildException"); | |
} | |
catch (ParentException& ) | |
{ | |
System::Console::WriteLine(u"Catch ParentException"); | |
} | |
catch (GrandParentException& ) | |
{ | |
System::Console::WriteLine(u"Catch GrandParentException"); | |
} | |
catch (System::Exception& ) | |
{ | |
System::Console::WriteLine(u"Catch Exception"); | |
} | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Finally"); | |
}); | |
// do something | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
try { } | |
catch (System::Exception& e) { } | |
} | |
, [&] /* finally block */ { }); | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
try { } | |
catch (System::Exception& e) { } | |
} | |
, [&] /* finally block */ { }); | |
} | |
void TryCatchFinallyStatements::VoidReturnTryCatchFinally() | |
{ | |
bool optionalReturnValue__154 = System::DoTryFinally( | |
[&](bool& isReturned__154) -> void /* try-catch block */ | |
{ | |
try | |
{ | |
InnerMethod(); | |
return; | |
} | |
catch (System::Exception& ) | |
{ | |
System::Console::WriteLine(u"Catch Exception"); | |
} | |
isReturned__154 = false; | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Finally"); | |
}); | |
if (optionalReturnValue__154) return; | |
} | |
int32_t TryCatchFinallyStatements::ValueReturnTryCatchFinally() | |
{ | |
auto optionalReturnValue__171 = System::DoTryFinally( | |
[&](bool& isReturned__171) -> int32_t /* try-catch block */ | |
{ | |
try | |
{ | |
InnerMethod(); | |
return 1; | |
} | |
catch (System::Exception& ) | |
{ | |
System::Console::WriteLine(u"Catch Exception"); | |
} | |
isReturned__171 = false; | |
return System::Details::initialized_value; | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Finally"); | |
}); | |
if (optionalReturnValue__171) return *optionalReturnValue__171; | |
} | |
System::SharedPtr<System::Object> TryCatchFinallyStatements::ObjReturnTryCatchFinally() | |
{ | |
auto optionalReturnValue__188 = System::DoTryFinally( | |
[&](bool& isReturned__188) -> System::SharedPtr<System::Object> /* try-catch block */ | |
{ | |
try | |
{ | |
InnerMethod(); | |
return nullptr; | |
} | |
catch (System::Exception& ) | |
{ | |
System::Console::WriteLine(u"Catch Exception"); | |
} | |
isReturned__188 = false; | |
return System::Details::initialized_value; | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Finally"); | |
}); | |
if (optionalReturnValue__188) return *optionalReturnValue__188; | |
} | |
void TryCatchFinallyStatements::InnerMethod() { } | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _TryCatchFinallyStatements_TryCatchFinallyStatements_h_ | |
#define _TryCatchFinallyStatements_TryCatchFinallyStatements_h_ | |
#include <system/shared_ptr.h> | |
#include <system/object.h> | |
#include <system/exceptions.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
class GrandParentException : public System::Exception | |
{ | |
typedef GrandParentException ThisType; | |
typedef System::Exception BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual ~GrandParentException(); | |
GrandParentException(); | |
GrandParentException(std::nullptr_t); | |
}; | |
class ParentException : public GrandParentException | |
{ | |
typedef ParentException ThisType; | |
typedef GrandParentException BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual ~ParentException(); | |
ParentException(); | |
ParentException(std::nullptr_t); | |
}; | |
class ChildException : public ParentException | |
{ | |
typedef ChildException ThisType; | |
typedef ParentException BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual ~ChildException(); | |
ChildException(); | |
ChildException(std::nullptr_t); | |
}; | |
class TryCatchFinallyStatements : public System::Object | |
{ | |
typedef TryCatchFinallyStatements ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void TryCatchFinally(); | |
void EnclosedTryCatchFinally(); | |
void EnclosedTryCatchFinallyWithException(); | |
void VoidReturnTryCatchFinally(); | |
int32_t ValueReturnTryCatchFinally(); | |
System::SharedPtr<System::Object> ObjReturnTryCatchFinally(); | |
private: | |
void InnerMethod(); | |
}; | |
} // namespace StatementsPorting | |
#endif // _TryCatchFinallyStatements_TryCatchFinallyStatements_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "TryCatchStatements.h" | |
#include <system/exceptions.h> | |
#include <system/console.h> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(3457991606u, ::StatementsPorting::GrandParentException, ThisTypeBaseTypesInfo); | |
GrandParentException::~GrandParentException() {} | |
GrandParentException::GrandParentException() : System::Exception() { } | |
GrandParentException::GrandParentException(std::nullptr_t) : System::Exception(nullptr) {} | |
RTTI_INFO_IMPL_HASH(3209790888u, ::StatementsPorting::ParentException, ThisTypeBaseTypesInfo); | |
ParentException::~ParentException() {} | |
ParentException::ParentException() : GrandParentException() { } | |
ParentException::ParentException(std::nullptr_t) : GrandParentException(nullptr) {} | |
RTTI_INFO_IMPL_HASH(2858341424u, ::StatementsPorting::ChildException, ThisTypeBaseTypesInfo); | |
ChildException::~ChildException() {} | |
ChildException::ChildException() : ParentException() { } | |
ChildException::ChildException(std::nullptr_t) : ParentException(nullptr) {} | |
RTTI_INFO_IMPL_HASH(808916801u, ::StatementsPorting::TryCatchStatements, ThisTypeBaseTypesInfo); | |
void TryCatchStatements::TryCatch() | |
{ | |
try | |
{ | |
InnerMethod(); | |
} | |
catch (ChildException& ) | |
{ | |
System::Console::WriteLine(u"Catch ChildException"); | |
} | |
catch (ParentException& ) | |
{ | |
System::Console::WriteLine(u"Catch ParentException"); | |
} | |
catch (GrandParentException& ) | |
{ | |
System::Console::WriteLine(u"Catch GrandParentException"); | |
} | |
catch (System::Exception& ) | |
{ | |
System::Console::WriteLine(u"Catch Exception"); | |
} | |
} | |
void TryCatchStatements::InnerMethod() { } | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _TryCatchStatements_TryCatchStatements_h_ | |
#define _TryCatchStatements_TryCatchStatements_h_ | |
#include <system/object.h> | |
#include <system/exceptions.h> | |
namespace StatementsPorting { | |
class GrandParentException : public System::Exception | |
{ | |
typedef GrandParentException ThisType; | |
typedef System::Exception BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual ~GrandParentException(); | |
GrandParentException(); | |
GrandParentException(std::nullptr_t); | |
}; | |
class ParentException : public GrandParentException | |
{ | |
typedef ParentException ThisType; | |
typedef GrandParentException BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual ~ParentException(); | |
ParentException(); | |
ParentException(std::nullptr_t); | |
}; | |
class ChildException : public ParentException | |
{ | |
typedef ChildException ThisType; | |
typedef ParentException BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual ~ChildException(); | |
ChildException(); | |
ChildException(std::nullptr_t); | |
}; | |
class TryCatchStatements : public System::Object | |
{ | |
typedef TryCatchStatements ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void TryCatch(); | |
private: | |
void InnerMethod(); | |
}; | |
} // namespace StatementsPorting | |
#endif // _TryCatchStatements_TryCatchStatements_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "TryFinallyStatements.h" | |
#include <system/exceptions.h> | |
#include <system/do_try_finally.h> | |
#include <system/console.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(2690213833u, ::StatementsPorting::TryFinallyStatements, ThisTypeBaseTypesInfo); | |
void TryFinallyStatements::TryFinally() | |
{ | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
InnerMethod(); | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Finally"); | |
}); | |
} | |
void TryFinallyStatements::TryFinallyWithException() | |
{ | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
InnerMethod(); | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Finally"); | |
throw System::Exception(); | |
}); | |
} | |
void TryFinallyStatements::EnclosedTryFinally() | |
{ | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
InnerMethod(); | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Inner finally"); | |
}); | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Outer finally"); | |
}); | |
} | |
void TryFinallyStatements::EnclosedTryFinallyWithException() | |
{ | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
System::DoTryFinally([&] /* try-catch block */ | |
{ | |
InnerMethod(); | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Inner finally"); | |
throw System::Exception(); | |
}); | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"Outer finally"); | |
}); | |
} | |
int32_t TryFinallyStatements::ValueReturnTry() | |
{ | |
auto optionalReturnValue__73 = System::DoTryFinally( | |
[&](bool& isReturned__73) -> int32_t /* try-catch block */ | |
{ | |
return 1; | |
isReturned__73 = false; | |
return System::Details::initialized_value; | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"finally"); | |
}); | |
if (optionalReturnValue__73) return *optionalReturnValue__73; | |
} | |
void TryFinallyStatements::VoidReturnTry() | |
{ | |
bool optionalReturnValue__85 = System::DoTryFinally( | |
[&](bool& isReturned__85) -> void /* try-catch block */ | |
{ | |
return; | |
isReturned__85 = false; | |
} | |
, [&] /* finally block */ | |
{ | |
System::Console::WriteLine(u"finally"); | |
}); | |
if (optionalReturnValue__85) return; | |
} | |
void TryFinallyStatements::InnerMethod() { } | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _TryFinallyStatements_TryFinallyStatements_h_ | |
#define _TryFinallyStatements_TryFinallyStatements_h_ | |
#include <system/object.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
class TryFinallyStatements : public System::Object | |
{ | |
typedef TryFinallyStatements ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void TryFinally(); | |
void TryFinallyWithException(); | |
void EnclosedTryFinally(); | |
void EnclosedTryFinallyWithException(); | |
int32_t ValueReturnTry(); | |
void VoidReturnTry(); | |
private: | |
void InnerMethod(); | |
}; | |
} // namespace StatementsPorting | |
#endif // _TryFinallyStatements_TryFinallyStatements_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "VarExpressions.h" | |
#include <system/string.h> | |
#include <system/shared_ptr.h> | |
#include <system/object.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(1646106215u, ::StatementsPorting::SomeClass, ThisTypeBaseTypesInfo); | |
RTTI_INFO_IMPL_HASH(2520391057u, ::StatementsPorting::VarExpressions, ThisTypeBaseTypesInfo); | |
void VarExpressions::Expressions() | |
{ | |
int32_t value1 = 666; | |
uint32_t value2 = 666U; | |
int64_t value3 = 666LL; | |
uint64_t value4 = 666LU; | |
float value5 = 1.2345f; | |
double value6 = 1.2345; | |
char16_t value7 = u'X'; | |
System::String value8 = u"iddqd"; | |
auto value9 = System::MakeObject<SomeClass>(); | |
} | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _VarExpressions_VarExpressions_h_ | |
#define _VarExpressions_VarExpressions_h_ | |
#include <system/object.h> | |
namespace StatementsPorting { | |
class SomeClass : public System::Object | |
{ | |
typedef SomeClass ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
}; | |
class VarExpressions : public System::Object | |
{ | |
typedef VarExpressions ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
void Expressions(); | |
}; | |
} // namespace StatementsPorting | |
#endif // _VarExpressions_VarExpressions_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ClassVirtualMethods.h" | |
#include <cstdint> | |
namespace MembersPorting { | |
RTTI_INFO_IMPL_HASH(2262109527u, ::MembersPorting::ClassVirtualMethods, ThisTypeBaseTypesInfo); | |
void ClassVirtualMethods::VirtualMethod() { } | |
void ClassVirtualMethods::OtherVirtualMethod(int32_t value) { } | |
} // namespace MembersPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _ClassVirtualMethods_ClassVirtualMethods_h_ | |
#define _ClassVirtualMethods_ClassVirtualMethods_h_ | |
#include <system/object.h> | |
#include <cstdint> | |
namespace MembersPorting { | |
class ClassVirtualMethods : public System::Object | |
{ | |
typedef ClassVirtualMethods ThisType; | |
typedef System::Object BaseType; | |
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo; | |
RTTI_INFO_DECL(); | |
public: | |
virtual void VirtualMethod(); | |
virtual void OtherVirtualMethod(int32_t value); | |
}; | |
} // namespace MembersPorting | |
#endif // _ClassVirtualMethods_ClassVirtualMethods_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "WhileStatements.h" | |
#include <system/console.h> | |
#include <cstdint> | |
namespace StatementsPorting { | |
RTTI_INFO_IMPL_HASH(2591991192u, ::StatementsPorting::WhileStatements, ThisTypeBaseTypesInfo); | |
void WhileStatements::While(int32_t max) | |
{ | |
int32_t number = 0; | |
while (number < max) | |
{ | |
System::Console::WriteLine(number); | |
++number; | |
} | |
} | |
void WhileStatements::EnclosedWhile(int32_t max1, int32_t max2) | |
{ | |
int32_t number1 = 0; | |
while (number1 < max1) | |
{ | |
int32_t number2 = 0; | |
while (number2 < max2) | |
{ | |
System::Console::WriteLine(number1 + number2); | |
++number2; | |
} | |
++number1; | |
} | |
} | |
void WhileStatements::InfiniteWhile() | |
{ | |
while (true) | |
{ | |
System::Console::WriteLine(u"iteration"); | |
} | |
} | |
} // namespace StatementsPorting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace StatementsPorting | |
{ | |
public class WhileStatements | |
{ | |
public void While(int max) | |
{ | |
int number = 0; | |
while (number < max) | |
{ | |
Console.WriteLine(number); | |
++number; | |
} | |
} | |
public void EnclosedWhile(int max1, int max2) | |
{ | |
int number1 = 0; | |
while (number1 < max1) | |
{ | |
int number2 = 0; | |
while (number2 < max2) | |
{ | |
Console.WriteLine(number1 + number2); | |
++ number2; | |
} | |
++number1; | |
} | |
} | |
public void InfiniteWhile() | |
{ | |
while (true) | |
{ | |
Console.WriteLine("iteration"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment