8 #include <system/enumerator_adapter.h>
9 #include <system/default.h>
10 #include <system/collections/list.h>
11 #include <system/collections/ilist.h>
12 #include <system/collections/ienumerable.h>
13 #include <system/collections/icomparer.h>
14 #include <system/collections/icollection.h>
15 #include <system/array.h>
17 #include "aspose.tasks.cpp/Util/ICondition.h"
18 #include "aspose.tasks.cpp/Util/IAlgorithm.h"
19 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
35 class AgilePasswordVerifier;
36 class MPP14StreamEncryptorDecryptorBase;
41 class FixedDataOffsets;
44 class Mpp12CalendarWriter;
45 class MPP12TaskReader;
46 class MPP14TaskReader;
47 class Mpp9CalendarWriter;
48 class MPP9ExtendedAttributeDefinitionWriter;
49 class MPP9OutlineCodeDefinitionWriter;
50 class MPPExtendedAttributeWriter;
51 class MPPOutlineCodeDefinitionWriter;
52 class MppPdfOleObjectWriter;
53 class MppTimephasedDataWriter;
56 namespace PrimaveraXml
58 class PrimaveraReader;
61 class OptimizedForSearchingTimephasedDataCollection;
62 class PluginLicensesHelper;
66 class TemplateProjectLoader;
88 friend class Aspose::Tasks::IO::MSProject::Metadata::VarDataOffsets;
89 friend class Aspose::Tasks::IO::MSProject::Decryptor::MPP14StreamEncryptorDecryptorBase;
90 friend class Aspose::Tasks::IO::MSProject::Metadata::FixedDataOffsets;
91 friend class Aspose::Tasks::IO::MSProject::MppPdfOleObjectWriter;
92 friend class Aspose::Tasks::IO::PrimaveraXml::PrimaveraReader;
93 friend class Aspose::Tasks::PluginLicensesHelper;
94 friend class Aspose::Tasks::Saving::TemplateProjectLoader;
95 friend class Aspose::Tasks::IO::MSProject::Decryptor::AgilePasswordVerifier;
96 friend class Aspose::Tasks::IO::MSProject::MPP12TaskReader;
97 friend class Aspose::Tasks::IO::MSProject::MPP14TaskReader;
98 friend class Aspose::Tasks::IO::MSProject::FixedWriter;
99 friend class Aspose::Tasks::IO::MSProject::Mpp12CalendarWriter;
100 friend class Aspose::Tasks::IO::MSProject::MPPExtendedAttributeWriter;
101 friend class Aspose::Tasks::IO::MSProject::MPPOutlineCodeDefinitionWriter;
102 friend class Aspose::Tasks::IO::MSProject::Mpp9CalendarWriter;
103 friend class Aspose::Tasks::IO::MSProject::MPP9ExtendedAttributeDefinitionWriter;
104 friend class Aspose::Tasks::IO::MSProject::MPP9OutlineCodeDefinitionWriter;
105 friend class Aspose::Tasks::IO::MSProject::MppTimephasedDataWriter;
106 friend class Aspose::Tasks::IO::MSProject::VarVarWriter;
107 friend class Aspose::Tasks::OptimizedForSearchingTimephasedDataCollection;
108 friend class Aspose::Tasks::Saving::MpxSavingUtils;
109 friend class Aspose::LicenseV2::LicenseCore;
120 template <
typename T>
121 static void Apply(
const System::SharedPtr<System::Collections::Generic::IList<T>>& list,
const System::SharedPtr<
IAlgorithm<T>>& algorithm, int32_t startIndex)
123 for (int32_t i = startIndex; i < list->get_Count(); i++)
125 T el = list->idx_get(i);
126 algorithm->PreAlg(el, i);
127 algorithm->Alg(el, i);
128 algorithm->PostAlg(el, i);
139 template <
typename T>
140 static System::SharedPtr<System::Collections::Generic::IList<T>>
Filter(
const System::SharedPtr<System::Collections::Generic::IList<T>>& list,
const System::SharedPtr<
ICondition<T>>& cond)
142 System::SharedPtr<System::Collections::Generic::IList<T>> result = System::MakeObject<System::Collections::Generic::List<T>>();
143 for (int32_t i = 0; i < list->get_Count(); i++)
145 if (cond->Check(list->idx_get(i)))
147 result->Add(list->idx_get(i));
161 template <
typename T>
162 static T
Find(
const System::SharedPtr<System::Collections::Generic::IList<T>>& list,
const System::SharedPtr<
ICondition<T>>& cond)
164 for (int32_t i = 0; i < list->get_Count(); i++)
166 if (cond->Check(list->idx_get(i)))
168 return list->idx_get(i);
172 return System::Default<T>();
178 static ASPOSE_TASKS_SHARED_API
void Resize(System::ArrayPtr<uint8_t>& array, int32_t newSize);
179 static ASPOSE_TASKS_SHARED_API System::ArrayPtr<uint8_t> Concat(
const System::ArrayPtr<uint8_t>& arr1,
const System::ArrayPtr<uint8_t>& arr2);
180 static ASPOSE_TASKS_SHARED_API
bool Equal(
const System::ArrayPtr<uint8_t>& arr1,
const System::ArrayPtr<uint8_t>& arr2);
181 static ASPOSE_TASKS_SHARED_API
bool IsBlank(
const System::ArrayPtr<uint8_t>& arr);
182 static ASPOSE_TASKS_SHARED_API
bool IsBlank(ByteSpan span);
183 template <
typename T>
184 static System::SharedPtr<System::Collections::Generic::List<T>> ToList(
const System::SharedPtr<System::Collections::Generic::IEnumerable<T>>& sequence)
186 System::SharedPtr<System::Collections::Generic::List<T>> result = System::MakeObject<System::Collections::Generic::List<T>>();
187 for (
auto&& element : System::IterateOver(sequence))
189 result->Add(element);
195 template <
typename T>
196 static int32_t BinarySearch(
const System::SharedPtr<System::Collections::Generic::IList<T>>& array, int32_t index, int32_t length, T value,
const System::SharedPtr<System::Collections::Generic::IComparer<T>>& comparer)
199 int32_t num2 = index + length - 1;
202 int32_t num3 = num + ((num2 - num) >> 1);
203 int32_t num4 = comparer->Compare(array->idx_get(num3), value);
222 template <
typename T>
223 static void CopyElements(
const System::SharedPtr<System::Collections::Generic::ICollection<T>>& source,
const System::SharedPtr<System::Collections::Generic::ICollection<T>>& target)
225 for (
auto&& element : System::IterateOver(source))
227 target->Add(element);
233 ListUtils() =
delete;
Represents an algorithm that can be applied to a list of objects T .
Definition: IAlgorithm.h:23
Represents a condition which can be used by filters or search methods.
Definition: ICondition.h:22
Utility class for list processing.
Definition: ListUtils.h:85
static void Apply(const System::SharedPtr< System::Collections::Generic::IList< T >> &list, const System::SharedPtr< IAlgorithm< T >> &algorithm, int32_t startIndex)
Apply algorithm for each list element starting from specified position.
Definition: ListUtils.h:121
static T Find(const System::SharedPtr< System::Collections::Generic::IList< T >> &list, const System::SharedPtr< ICondition< T >> &cond)
Find first occurrence of an list element which satisfy specified condition.
Definition: ListUtils.h:162
static System::SharedPtr< System::Collections::Generic::IList< T > > Filter(const System::SharedPtr< System::Collections::Generic::IList< T >> &list, const System::SharedPtr< ICondition< T >> &cond)
Filter list elements by specified condition.
Definition: ListUtils.h:140