8 #include <system/object_ext.h>
9 #include <system/multicast_delegate.h>
10 #include <system/exceptions.h>
11 #include <system/details/pointer_collection_helpers.h>
12 #include <system/default.h>
13 #include <system/constraints.h>
22 class ProjectPropertyCollection;
23 class ResourceAssignmentPropertyCollection;
24 class ResourcePropertyCollection;
25 class TaskPropertyCollection;
29 template <
typename TResult>
using Func2 = System::MulticastDelegate<TResult()>;
38 namespace Properties {
44 template<
typename TKey>
45 class GenericProperty :
public System::Object,
public System::Details::BoxableObjectBase
47 assert_is_cs_struct(TKey);
50 typedef System::Object BaseType;
52 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
53 RTTI_INFO_TEMPLATE_CLASS(
ThisType, ThisTypeBaseTypesInfo);
55 friend class Aspose::Tasks::Properties::ProjectPropertyCollection;
56 friend class Aspose::Tasks::Properties::ResourcePropertyCollection;
57 friend class Aspose::Tasks::Properties::ResourceAssignmentPropertyCollection;
58 friend class Aspose::Tasks::Properties::TaskPropertyCollection;
68 return (*this).name !=
nullptr ? (*this).name : System::ObjectExt::ToString((*this).key);
76 return (*this).getValue();
84 (*this).getValue =
nullptr;
85 (*this).key = System::Default<TKey>();
92 void SetTemplateWeakPtr(uint32_t argument)
override
97 System::Details::CollectionHelpers::SetWeakPointer(key);
108 GenericProperty(Aspose::Tasks::Util::Func2<System::SharedPtr<System::Object>> getValue, TKey key) : key(TKey())
110 if (getValue ==
nullptr)
112 throw System::ArgumentNullException(u
"getValue");
115 (*this).getValue = getValue;
117 (*this).name.reset();
120 MEMBER_FUNCTION_MAKE_OBJECT(GenericProperty, CODEPORTING_ARGS(Aspose::Tasks::Util::Func2<System::SharedPtr<System::Object>> getValue, TKey key), CODEPORTING_ARGS(getValue,key));
121 #ifdef ASPOSE_GET_SHARED_MEMBERS
122 void GetSharedMembers(System::Object::shared_members_type& result)
const override
124 System::Object::GetSharedMembers(result);
126 result.Add(
"Aspose::Tasks::Properties::GenericProperty::getValue", this->getValue);
127 result.Add(
"Aspose::Tasks::Properties::GenericProperty::key", this->key);
136 Aspose::Tasks::Util::Func2<System::SharedPtr<System::Object>> getValue;
Represents a container property.
Definition: GenericProperty.h:45
System::SharedPtr< System::Object > get_Value()
Gets a value of the property.
Definition: GenericProperty.h:74
GenericProperty(const System::String &name)
Initializes a new instance of the GenericProperty{TKey} struct.
Definition: GenericProperty.h:81
System::String get_Name()
Gets a name of the property.
Definition: GenericProperty.h:66