4#include <system/object_ext.h>
5#include <system/delegate.h>
6#include <system/object.h>
7#include <system/string.h>
8#include <system/reflection/member_info.h>
9#include <system/collections/list.h>
11namespace System {
namespace Reflection {
47 m_property_type = type;
55 template <
class PropertyType,
typename ClassType>
61 std::function<System::SharedPtr<PropertyType>(ClassType *)> get_function = get_prop_method;
64 throw NotImplementedException();
67 return get_function((ClassType *)obj.
get());
77 template <
class PropertyType,
typename ClassType>
83 std::function<System::SharedPtr<PropertyType>(ClassType *)> get_function = get_prop_method;
86 throw NotImplementedException();
89 return get_function((ClassType *)obj.
get());
100 template <
class PropertyType,
typename ClassType>
108 std::function<System::SharedPtr<PropertyType>(ClassType *)> get_function = get_prop_method;
111 set_function((ClassType *)obj.
get(), ExplicitCast<PropertyType>(value));
114 return get_function((ClassType *)obj.
get());
125 template <
class NullableType,
typename ClassType>
133 std::function<System::Nullable<NullableType>(ClassType *)> get_function = get_prop_method;
136 set_function((ClassType *)obj.
get(), System::ObjectExt::UnboxToNullable<NullableType>(value));
140 return System::ObjectExt::Box<System::Nullable<NullableType>>(value);
151 template <
class NullableType,
typename ClassType>
159 std::function<System::Nullable<NullableType>(ClassType *)> get_function = get_prop_method;
162 set_function((ClassType *)obj.
get(), System::ObjectExt::UnboxToNullable<NullableType>(value));
166 return System::ObjectExt::Box<System::Nullable<NullableType>>(value);
177 template <
class PropertyType,
typename ClassType>
185 std::function<System::SharedPtr<PropertyType>(ClassType *)> get_function = get_prop_method;
188 set_function(
dynamic_cast<ClassType*
>(obj.
get()), ExplicitCast<PropertyType>(value));
191 return get_function(
dynamic_cast<ClassType *
>(obj.
get()));
201 template <
typename ClassType>
208 std::function<void(ClassType *,
String)> set_function = set_prop_method;
209 std::function<
String(ClassType *)> get_function = get_prop_method;
212 set_function(
dynamic_cast<ClassType *
>(obj.
get()), System::ObjectExt::Unbox<String>(value));
215 String value = get_function(
dynamic_cast<ClassType *
>(obj.
get()));
216 return System::ObjectExt::Box<String>(value);
225 template <
typename ClassType>
232 std::function<void(ClassType *,
String)> set_function = set_prop_method;
233 std::function<
String(ClassType *)> get_function = get_prop_method;
236 set_function(
dynamic_cast<ClassType *
>(obj.
get()), System::ObjectExt::Unbox<String>(value));
239 String value = get_function(
dynamic_cast<ClassType *
>(obj.
get()));
240 return System::ObjectExt::Box<String>(value);
249 template <
typename ClassType>
256 std::function<void(ClassType *,
Decimal)> set_function = set_prop_method;
257 std::function<
Decimal(ClassType *)> get_function = get_prop_method;
260 set_function(
dynamic_cast<ClassType *
>(obj.
get()), System::ObjectExt::Unbox<Decimal>(value));
263 Decimal value = get_function(
dynamic_cast<ClassType *
>(obj.
get()));
264 return System::ObjectExt::Box<Decimal>(value);
273 template <
typename ClassType>
280 std::function<void(ClassType *,
Decimal)> set_function = set_prop_method;
281 std::function<
Decimal(ClassType *)> get_function = get_prop_method;
284 set_function(
dynamic_cast<ClassType *
>(obj.
get()), System::ObjectExt::Unbox<Decimal>(value));
287 Decimal value = get_function(
dynamic_cast<ClassType *
>(obj.
get()));
288 return System::ObjectExt::Box<Decimal>(value);
298 template <
typename ClassType>
301 void (ClassType::*set_prop_method)(
bool),
302 bool (ClassType::*get_prop_method)()) :
305 std::function<void(ClassType *,
bool)> set_function = set_prop_method;
306 std::function<bool(ClassType *)> get_function = get_prop_method;
309 set_function(
dynamic_cast<ClassType *
>(obj.
get()), System::ObjectExt::Unbox<bool>(value));
312 bool value = get_function(
dynamic_cast<ClassType *
>(obj.
get()));
313 return System::ObjectExt::Box<bool>(value);
322 template <
typename ClassType>
325 void (ClassType::*set_prop_method)(
bool),
326 bool (ClassType::*get_prop_method)()
const) :
329 std::function<void(ClassType *,
bool)> set_function = set_prop_method;
330 std::function<bool(ClassType *)> get_function = get_prop_method;
333 set_function(
dynamic_cast<ClassType *
>(obj.
get()), System::ObjectExt::Unbox<bool>(value));
336 bool value = get_function(
dynamic_cast<ClassType *
>(obj.
get()));
337 return System::ObjectExt::Box<bool>(value);
346 template <
typename ClassType>
349 void (ClassType::*set_prop_method)(int64_t),
350 int64_t (ClassType::*get_prop_method)()) :
353 std::function<void(ClassType *, int64_t)> set_function = set_prop_method;
354 std::function<int64_t(ClassType *)> get_function = get_prop_method;
357 set_function(
dynamic_cast<ClassType *
>(obj.
get()), System::ObjectExt::Unbox<int64_t>(value));
360 int64_t value = get_function(
dynamic_cast<ClassType *
>(obj.
get()));
361 return System::ObjectExt::Box<int64_t>(value);
370 template <
typename ClassType>
373 void (ClassType::*set_prop_method)(int64_t),
374 int64_t (ClassType::*get_prop_method)()
const) :
377 std::function<void(ClassType *, int64_t)> set_function = set_prop_method;
378 std::function<int64_t(ClassType *)> get_function = get_prop_method;
381 set_function(
dynamic_cast<ClassType *
>(obj.
get()), System::ObjectExt::Unbox<int64_t>(value));
384 int64_t value = get_function(
dynamic_cast<ClassType *
>(obj.
get()));
385 return System::ObjectExt::Box<int64_t>(value);
Represents a decimal number. This type should be allocated on stack and passed to functions by value ...
Definition: decimal.h:107
Forward declaration.
Definition: nullable.h:74
SmartPtr< Object > ptr
Alias for smart pointer type.
Definition: object.h:65
Provides reflection information on members. Objects of this class should only be allocated using Syst...
Definition: member_info.h:16
Represents property information.
Definition: property_info.h:15
void set_PropertyType(const TypeInfo &type)
Sets the type of this property.
Definition: property_info.h:45
PropertyInfo(String name, void(ClassType::*set_prop_method)(System::Nullable< NullableType >), System::Nullable< NullableType >(ClassType::*get_prop_method)())
Constructor. Nullable property with setter and getter.
Definition: property_info.h:126
PropertyInfo(String name, void(ClassType::*set_prop_method)(System::Nullable< NullableType >), System::Nullable< NullableType >(ClassType::*get_prop_method)() const)
Constructor. Nullable property with const getter only.
Definition: property_info.h:152
PropertyInfo(String name, void(ClassType::*set_prop_method)(System::String), System::String(ClassType::*get_prop_method)() const)
Constructs string property information from class with const getter.
Definition: property_info.h:226
PropertyInfo(String name, System::SharedPtr< PropertyType >(ClassType::*get_prop_method)())
Constructor. Property with only non-const getter.
Definition: property_info.h:78
PropertyInfo(String name, void(ClassType::*set_prop_method)(int64_t), int64_t(ClassType::*get_prop_method)() const)
Constructs int64_t property information from class with const getter.
Definition: property_info.h:371
TypeInfo m_property_type
Definition: property_info.h:392
PropertyInfo(String name, void(ClassType::*set_prop_method)(bool), bool(ClassType::*get_prop_method)())
Constructs boolean property information.
Definition: property_info.h:299
std::function< void(System::Object::ptr, System::Object::ptr)> set_method
Definition: property_info.h:390
PropertyInfo(String name, void(ClassType::*set_prop_method)(System::Decimal), System::Decimal(ClassType::*get_prop_method)())
Constructs Decimal property information.
Definition: property_info.h:250
System::SharedPtr< System::Object > GetValue(System::SharedPtr< System::Object > obj)
Gets property value from specific object.
std::function< System::Object::ptr(System::Object::ptr)> get_method
Definition: property_info.h:391
virtual MemberTypes get_MemberType() const override
Gets a MemberTypes value indicating that this member is a property.
PropertyInfo(String name, void(ClassType::*set_prop_method)(int64_t), int64_t(ClassType::*get_prop_method)())
Constructs int64_t property information.
Definition: property_info.h:347
TypeInfo get_PropertyType()
Gets property type.
PropertyInfo(String name, void(ClassType::*set_prop_method)(System::SharedPtr< PropertyType >), System::SharedPtr< PropertyType >(ClassType::*get_prop_method)() const)
Constructor.
Definition: property_info.h:101
PropertyInfo(String name, System::SharedPtr< PropertyType >(ClassType::*get_prop_method)() const)
Constructor. Property with only const getter.
Definition: property_info.h:56
PropertyInfo(String name, void(ClassType::*set_prop_method)(System::Decimal), System::Decimal(ClassType::*get_prop_method)() const)
Constructs Decimal property information from class with const getter.
Definition: property_info.h:274
void SetValue(System::SharedPtr< System::Object > obj, System::SharedPtr< System::Object > value, System::ArrayPtr< System::SharedPtr< System::Object > > indexer)
Sets property value to specific object.
void SetValue(System::SharedPtr< System::Object > obj, System::SharedPtr< System::Object > value)
Sets property value to specific object.
PropertyInfo(String name, void(ClassType::*set_prop_method)(System::SharedPtr< PropertyType >), System::SharedPtr< PropertyType >(ClassType::*get_prop_method)())
Constructor. Object property with getter only.
Definition: property_info.h:178
PropertyInfo(String name, void(ClassType::*set_prop_method)(bool), bool(ClassType::*get_prop_method)() const)
Constructs boolean property information from class with const getter.
Definition: property_info.h:323
PropertyInfo(String name, void(ClassType::*set_prop_method)(System::String), System::String(ClassType::*get_prop_method)())
Constructs string property information.
Definition: property_info.h:202
System::SharedPtr< System::Object > GetValue(System::SharedPtr< System::Object > obj, System::ArrayPtr< System::SharedPtr< System::Object > > indexer)
Gets property value from specific object.
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
Pointee_ * get() const
Gets pointed object.
Definition: smart_ptr.h:518
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
Represents a particular type and provides information about it.
Definition: type_info.h:109
MemberTypes
Marks each type of member.
Definition: member_types.h:11
Definition: db_command.h:9