8 #include <system/exceptions.h>
9 #include <system/constraints.h>
10 #include <system/array.h>
12 #include "aspose.tasks.cpp/Item.h"
13 #include "aspose.tasks.cpp/IContainer.h"
14 #include "aspose.tasks.cpp/EntityPropertyItem.h"
15 #include "aspose.tasks.cpp/Key.h"
16 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
26 class ASPOSE_TASKS_SHARED_CLASS PropertyContainer :
public Aspose::Tasks::IContainer<T>
28 assert_is_cs_struct(T);
30 typedef PropertyContainer<T> ThisType;
31 typedef Aspose::Tasks::IContainer<T> BaseType;
33 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
34 RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo);
42 this->map = System::MakeArray<System::SharedPtr<Aspose::Tasks::Item>>(ItemsCount());
46 PropertyContainer(
const System::SharedPtr<PropertyContainer<T>>& propertyContainer)
48 this->map = System::MakeArray<System::SharedPtr<Aspose::Tasks::Item>>(ItemsCount());
50 if (propertyContainer ==
nullptr)
52 throw System::ArgumentNullException(u
"propertyContainer");
55 if (propertyContainer->map->get_Length() != ItemsCount())
57 throw System::InvalidOperationException(u
"Enum size");
60 this->map = System::MakeArray<System::SharedPtr<Aspose::Tasks::Item>>(propertyContainer->map->get_Length());
62 for (int32_t i = 0; i < this->map->get_Length(); i++)
64 auto containerMap = propertyContainer->map[i];
65 if (containerMap !=
nullptr)
67 this->map[i] = containerMap->Clone();
72 template <
typename TValue>
73 void Set(
const Key<TValue, T>& key,
const TValue& val)
75 this->
template CheckPropAndSet<TValue>(key, val);
84 template <
typename TValue>
87 auto& item = this->map->data_ptr()[key.get_KeyTypeIndex()];
90 item = System::MakeObject<EntityProperty<TValue>>(val);
98 template <
typename TValue>
101 return this->
template CheckPropAndGet<TValue>(key);
110 template <
typename TValue>
113 auto& item = this->map->data_ptr()[key.get_KeyTypeIndex()];
116 item = System::MakeObject<EntityProperty<TValue>>();
121 template <
typename TValue>
122 void Add(
const Key<TValue, T>& key,
const System::SharedPtr<Item>& val)
124 this->map[key.get_KeyTypeIndex()] = val;
127 void SetTemplateWeakPtr(uint32_t argument)
override
139 #ifdef ASPOSE_GET_SHARED_MEMBERS
140 void GetSharedMembers(System::Object::shared_members_type& result)
const override
142 System::Object::GetSharedMembers(result);
144 result.Add(
"Aspose::Tasks::PropertyContainer::map", this->map);
152 static int32_t& ItemsCount()
154 static int32_t value;
155 static std::once_flag once;
156 std::call_once(once, []
158 value = System::Enum<T>::GetValues()->get_Length();
163 System::ArrayPtr<System::SharedPtr<Item>> map;
Represents property container.
Definition: Key.h:57
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:111
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:85
Represents an entity item (property of container class).
Definition: EntityPropertyItem.h:25