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"
29 class GroupCollection;
36 class AgilePasswordVerifier;
37 class MPP14StreamEncryptorDecryptorBase;
42 class FixedDataOffsets;
45 class Mpp12CalendarWriter;
46 class MPP12TaskReader;
47 class MPP14TaskReader;
48 class Mpp9CalendarWriter;
49 class MPP9ExtendedAttributeDefinitionWriter;
50 class MPP9OutlineCodeDefinitionWriter;
51 class MPPExtendedAttributeWriter;
53 class MPPOutlineCodeDefinitionWriter;
54 class MppPdfOleObjectWriter;
55 class MppTimephasedDataWriter;
58 namespace PrimaveraXml
60 class PrimaveraReader;
63 class OptimizedForSearchingTimephasedDataCollection;
64 class PluginLicensesHelper;
68 class TemplateProjectLoader;
90 friend class Aspose::Tasks::IO::MSProject::Metadata::VarDataOffsets;
91 friend class Aspose::Tasks::IO::MSProject::Decryptor::MPP14StreamEncryptorDecryptorBase;
92 friend class Aspose::Tasks::IO::MSProject::Metadata::FixedDataOffsets;
93 friend class Aspose::Tasks::IO::MSProject::MppPdfOleObjectWriter;
94 friend class Aspose::Tasks::IO::MSProject::MppGroupWriter;
95 friend class Aspose::Tasks::IO::PrimaveraXml::PrimaveraReader;
96 friend class Aspose::Tasks::PluginLicensesHelper;
97 friend class Aspose::Tasks::Saving::TemplateProjectLoader;
99 friend class Aspose::Tasks::IO::MSProject::Decryptor::AgilePasswordVerifier;
100 friend class Aspose::Tasks::IO::MSProject::MPP12TaskReader;
101 friend class Aspose::Tasks::IO::MSProject::MPP14TaskReader;
102 friend class Aspose::Tasks::IO::MSProject::FixedWriter;
103 friend class Aspose::Tasks::IO::MSProject::Mpp12CalendarWriter;
104 friend class Aspose::Tasks::IO::MSProject::MPPExtendedAttributeWriter;
105 friend class Aspose::Tasks::IO::MSProject::MPPOutlineCodeDefinitionWriter;
106 friend class Aspose::Tasks::IO::MSProject::Mpp9CalendarWriter;
107 friend class Aspose::Tasks::IO::MSProject::MPP9ExtendedAttributeDefinitionWriter;
108 friend class Aspose::Tasks::IO::MSProject::MPP9OutlineCodeDefinitionWriter;
109 friend class Aspose::Tasks::IO::MSProject::MppTimephasedDataWriter;
110 friend class Aspose::Tasks::IO::MSProject::VarVarWriter;
111 friend class Aspose::Tasks::OptimizedForSearchingTimephasedDataCollection;
112 friend class Aspose::Tasks::Saving::MpxSavingUtils;
113 friend class Aspose::LicenseV2::LicenseCore;
124 template <
typename T>
125 static void Apply(
const System::SharedPtr<System::Collections::Generic::IList<T>>& list,
const System::SharedPtr<
IAlgorithm<T>>& algorithm, int32_t startIndex)
127 for (int32_t i = startIndex; i < list->get_Count(); i++)
129 T el = list->idx_get(i);
130 algorithm->PreAlg(el, i);
131 algorithm->Alg(el, i);
132 algorithm->PostAlg(el, i);
143 template <
typename T>
144 static System::SharedPtr<System::Collections::Generic::IList<T>>
Filter(
const System::SharedPtr<System::Collections::Generic::IList<T>>& list,
const System::SharedPtr<
ICondition<T>>& cond)
146 System::SharedPtr<System::Collections::Generic::IList<T>> result = System::MakeObject<System::Collections::Generic::List<T>>();
147 for (int32_t i = 0; i < list->get_Count(); i++)
149 if (cond->Check(list->idx_get(i)))
151 result->Add(list->idx_get(i));
165 template <
typename T>
166 static T
Find(
const System::SharedPtr<System::Collections::Generic::IList<T>>& list,
const System::SharedPtr<
ICondition<T>>& cond)
168 for (int32_t i = 0; i < list->get_Count(); i++)
170 if (cond->Check(list->idx_get(i)))
172 return list->idx_get(i);
176 return System::Default<T>();
182 static ASPOSE_TASKS_SHARED_API
void Resize(System::ArrayPtr<uint8_t>& array, int32_t newSize);
183 static ASPOSE_TASKS_SHARED_API System::ArrayPtr<uint8_t> Concat(
const System::ArrayPtr<uint8_t>& arr1,
const System::ArrayPtr<uint8_t>& arr2);
184 static ASPOSE_TASKS_SHARED_API
bool Equal(
const System::ArrayPtr<uint8_t>& arr1,
const System::ArrayPtr<uint8_t>& arr2);
185 static ASPOSE_TASKS_SHARED_API
bool IsBlank(
const System::ArrayPtr<uint8_t>& arr);
186 static ASPOSE_TASKS_SHARED_API
bool IsBlank(ByteSpan span);
187 template <
typename T>
188 static System::SharedPtr<System::Collections::Generic::List<T>> ToList(
const System::SharedPtr<System::Collections::Generic::IEnumerable<T>>& sequence)
190 System::SharedPtr<System::Collections::Generic::List<T>> result = System::MakeObject<System::Collections::Generic::List<T>>();
191 for (
auto&& element : System::IterateOver(sequence))
193 result->Add(element);
199 template <
typename T>
200 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)
203 int32_t num2 = index + length - 1;
206 int32_t num3 = num + ((num2 - num) >> 1);
207 int32_t num4 = comparer->Compare(array->idx_get(num3), value);
226 template <
typename T>
227 static void CopyElements(
const System::SharedPtr<System::Collections::Generic::ICollection<T>>& source,
const System::SharedPtr<System::Collections::Generic::ICollection<T>>& target)
229 for (
auto&& element : System::IterateOver(source))
231 target->Add(element);
237 ListUtils() =
delete;
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:166
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:125
Utility class for list processing.
Definition: ListUtils.h:86
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:144
Contains a list of Group objects. Implements ICollection<Group> interface.
Definition: GroupCollection.h:56
Represents an algorithm that can be applied to a list of objects T .
Definition: IAlgorithm.h:22