8 #include <system/make_const_ref.h>
9 #include <system/exceptions.h>
10 #include <system/constraints.h>
11 #include <system/array.h>
14 #include "aspose.tasks.cpp/Item.h"
15 #include "aspose.tasks.cpp/IContainer.h"
16 #include "EntityPropertyItem.h"
17 #include "aspose.tasks.cpp/Key.h"
18 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
28 class ASPOSE_TASKS_SHARED_CLASS PropertyContainer :
public Aspose::Tasks::IContainer<T>
30 assert_is_cs_struct(T);
32 typedef PropertyContainer<T> ThisType;
33 typedef Aspose::Tasks::IContainer<T> BaseType;
35 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
36 RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo);
44 this->map = System::MakeArray<System::SharedPtr<Aspose::Tasks::Item>>(ItemsCount());
48 PropertyContainer(
const System::SharedPtr<PropertyContainer<T>>& propertyContainer)
50 this->map = System::MakeArray<System::SharedPtr<Aspose::Tasks::Item>>(ItemsCount());
52 if (propertyContainer ==
nullptr)
54 throw System::ArgumentNullException(u
"propertyContainer");
57 if (propertyContainer->map->get_Length() != ItemsCount())
59 throw System::InvalidOperationException(u
"Enum size");
62 this->map = System::MakeArray<System::SharedPtr<Aspose::Tasks::Item>>(propertyContainer->map->get_Length());
64 for (int32_t i = 0; i < this->map->get_Length(); i++)
66 auto containerMap = propertyContainer->map[i];
67 if (containerMap !=
nullptr)
69 this->map[i] = containerMap->Clone();
74 template <
typename TValue>
75 void Set(
const Key<TValue, T>& key,
const TValue& val)
77 this->
template CheckPropAndSet<TValue>(key, val);
86 template <
typename TValue>
89 auto& item = this->map->data_ptr()[key.get_KeyTypeIndex()];
92 item = System::MakeObject<EntityProperty<TValue>>(val);
100 template <
typename TValue>
103 return this->
template CheckPropAndGet<TValue>(key);
112 template <
typename TValue>
115 auto& item = this->map->data_ptr()[key.get_KeyTypeIndex()];
118 item = System::MakeObject<EntityProperty<TValue>>();
123 template <
typename TValue>
124 void Add(
const Key<TValue, T>& key,
const System::SharedPtr<Item>& val)
126 this->map[key.get_KeyTypeIndex()] = val;
129 void SetTemplateWeakPtr(uint32_t argument)
override
141 #ifdef ASPOSE_GET_SHARED_MEMBERS
142 void GetSharedMembers(System::Object::shared_members_type& result)
const override
144 System::Object::GetSharedMembers(result);
146 result.Add(
"Aspose::Tasks::PropertyContainer::map", this->map);
154 static int32_t& ItemsCount()
156 static int32_t value = System::Enum<T>::GetValues()->get_Length();
160 System::ArrayPtr<System::SharedPtr<Item>> map;
Represents an entity item (property of container class).
Definition: EntityPropertyItem.h:24
Represents a property key of a class of the specified type. An instance of this class is used when ge...
Definition: Asn.h:19
System::MakeConstRef_t< TValue > CheckPropAndGet(const Key< TValue, T > &key)
Returns the value to which the property is mapped in this container. If this container doesn't contai...
Definition: PropertyContainer.h:113
void CheckPropAndSet(const Key< TValue, T > &key, const TValue &val)
Maps the specified property to the specified value in this container. If this container doesn't conta...
Definition: PropertyContainer.h:87
Represents property container.
Definition: Key.h:57