8 #include <system/type_info.h>
9 #include <system/object_ext.h>
10 #include <system/exceptions.h>
11 #include <system/details/pointer_collection_helpers.h>
12 #include <system/constraints.h>
13 #include <system/collections/keyvalue_pair.h>
14 #include <system/collections/ienumerator.h>
15 #include <system/collections/icollection.h>
16 #include <system/collections/dictionary.h>
17 #include <system/array.h>
20 #include "aspose.tasks.cpp/PropertyCollections/PropertyCollection.h"
21 #include "aspose.tasks.cpp/PropertyCollections/Property.h"
29 class BuiltInProjectPropertyCollection;
30 class CustomProjectPropertyCollection;
31 class CustomProjectPropertyWrapperCollection;
40 namespace Properties {
54 typedef System::Collections::Generic::ICollection<T> BaseType1;
56 typedef ::System::BaseTypesInfo<BaseType, BaseType1> ThisTypeBaseTypesInfo;
57 RTTI_INFO_TEMPLATE_CLASS(
ThisType, ThisTypeBaseTypesInfo);
62 friend class CustomProjectPropertyWrapperCollection;
69 System::SharedPtr<System::Collections::Generic::ICollection<System::String>>
get_Names()
71 return this->dictionary->get_Keys();
79 return this->dictionary->get_Count();
94 return this->Get(name);
100 this->ThrowIfReadOnly();
101 this->ClearInternal();
111 return this->dictionary->ContainsKey(name);
118 void Add(
const T& item)
override
120 this->ThrowIfReadOnly();
121 this->AddInternal(item);
124 void SetTemplateWeakPtr(uint32_t argument)
override
129 BaseType::SetTemplateWeakPtr(0);
130 System::Details::CollectionHelpers::SetWeakPointer(1, dictionary);
139 PropertyKeyedCollection()
140 : dictionary(System::MakeObject<System::Collections::Generic::Dictionary<System::String, T>>())
149 void idx_set(
const System::String& name, T value)
151 this->ThrowIfReadOnly();
152 this->Set(name, value);
155 System::SharedPtr<System::Collections::Generic::IEnumerator<T>> GetEnumeratorInternal()
override
157 return this->dictionary->get_Values()->GetEnumerator();
160 bool TryGetValue(
const System::String& key, T& value)
162 return this->dictionary->TryGetValue(key, value);
170 void AddInternal(T value)
172 if (System::ObjectExt::UnknownIsNull(value))
174 throw System::ArgumentNullException(u
"value");
177 this->dictionary->Add(value->get_Name(), value);
184 bool RemoveInternal(
const System::String& key)
186 return this->dictionary->Remove(key);
192 virtual void ClearInternal()
194 this->dictionary->Clear();
197 void ThrowIfReadOnly()
201 throw System::NotSupportedException(this->GetType().get_Name() + u
" is read-only.");
209 bool RemoveInternal(T item)
212 for (
auto&& kvp : this->dictionary)
214 if (System::ObjectExt::Equals(kvp.get_Value(), System::ExplicitCast<System::Object>(item)))
220 return key !=
nullptr && this->RemoveInternal(key);
232 virtual void Set(System::String key, T value)
234 this->dictionary->idx_set(key, value);
243 virtual T Get(System::String key)
245 return this->dictionary->idx_get(key);
248 virtual ~PropertyKeyedCollection()
252 #ifdef ASPOSE_GET_SHARED_MEMBERS
253 void GetSharedMembers(System::Object::shared_members_type& result)
const override
255 PropertyCollection<T>::GetSharedMembers(result);
257 result.Add(
"Aspose::Tasks::Properties::PropertyKeyedCollection::dictionary", this->dictionary);
264 System::SharedPtr<System::Collections::Generic::Dictionary<System::String, T>> dictionary;
267 bool Contains(
const T& item)
const override
269 for (
auto&& kvp : this->dictionary)
271 if (System::ObjectExt::Equals(kvp.get_Value(), System::ExplicitCast<System::Object>(item)))
281 bool Remove(
const T& item)
override
283 this->ThrowIfReadOnly();
284 return this->RemoveInternal(item);
288 void CopyTo(System::ArrayPtr<T> array, int32_t arrayIndex)
override
290 this->dictionary->get_Values()->CopyTo(array, arrayIndex);
Represents a collection of built-in project properties.
Definition: BuiltInProjectPropertyCollection.h:40
Represents a collection of custom project properties.
Definition: CustomProjectPropertyCollection.h:50
A base class of collection of properties.
Definition: PropertyCollection.h:36
Represents a base class of a property.
Definition: Property.h:34
A base class of collection of properties.
Definition: PropertyKeyedCollection.h:48
int32_t get_Count() const override
Gets the number of properties in the collection.
Definition: PropertyKeyedCollection.h:77
void Clear() override
Definition: PropertyKeyedCollection.h:98
bool Contains(const System::String &name) const
Determines whether the Aspose::Tasks::Properties::PropertyCollection<T> contains a property with the ...
Definition: PropertyKeyedCollection.h:109
T idx_get(const System::String &name)
Gets the Property associated with the specified key.
Definition: PropertyKeyedCollection.h:92
System::SharedPtr< System::Collections::Generic::ICollection< System::String > > get_Names()
Gets the collection of all property names.
Definition: PropertyKeyedCollection.h:69
void Add(const T &item) override
Creates a new custom property.
Definition: PropertyKeyedCollection.h:118
bool get_IsReadOnly() const override=0
Gets a value indicating whether this collection is read-only; otherwise, false.
Aspose.
Definition: Asn.h:13