Aspose.Tasks for C++
AndAllCondition.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="AndAllCondition.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/object.h>
9 #include <system/enumerator_adapter.h>
10 #include <system/details/pointer_collection_helpers.h>
11 #include <system/collections/list.h>
12 #include <cstdint>
13 
14 #include "aspose.tasks.cpp/Util/ICondition.h"
15 
16 namespace Aspose {
17 
18 namespace Tasks {
19 
20 namespace Util {
21 
22 /// <summary>
23 /// Applies logical AND to all conditions.
24 /// For example: cond1 AND cond2 AND cond3...
25 /// </summary>
26 /// <typeparam name="T">The type of object to apply method interface to.</typeparam>
27 template<typename T>
29 {
32 
33  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
34  RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo);
35 
36  template<typename FT0> friend class Aspose::Tasks::Util::AndAllCondition;
37 
38 public:
39 
40  /// <summary>
41  /// Initializes a new instance of the <see cref="AndAllCondition{T}"></see> class.
42  /// </summary>
43  /// <param name="conditions">
44  /// The list of conditions.
45  /// </param>
46  AndAllCondition(const System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<ICondition<T>>>>& conditions)
47  {
48  this->conditions = conditions;
49  }
50 
51  /// <summary>
52  /// Returns true if the specified object satisfy the conditions.
53  /// </summary>
54  /// <param name="el">The object to check.</param>
55  /// <returns>True if the object satisfy the conditions.</returns>
56  bool Check(const T& el) override
57  {
58  for (auto&& cond : this->conditions)
59  {
60  if (!cond->Check(el))
61  {
62  return false;
63  }
64  }
65 
66  return true;
67  }
68 
69  void SetTemplateWeakPtr(uint32_t argument) override
70  {
71  switch (argument)
72  {
73  case 0:
74  break;
75 
76  }
77  }
78 
79 protected:
80 
81  #ifdef ASPOSE_GET_SHARED_MEMBERS
82  void GetSharedMembers(System::Object::shared_members_type& result) const override
83  {
84  System::Object::GetSharedMembers(result);
85 
86  result.Add("Aspose::Tasks::Util::AndAllCondition::conditions", this->conditions);
87  }
88  #endif
89 
90 
91 
92 private:
93 
94  System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<ICondition<T>>>> conditions;
95 
96 };
97 
98 } // namespace Util
99 } // namespace Tasks
100 } // namespace Aspose
101 
102 
Applies logical AND to all conditions. For example: cond1 AND cond2 AND cond3...
Definition: AndAllCondition.h:29
AndAllCondition(const System::SharedPtr< System::Collections::Generic::List< System::SharedPtr< ICondition< T >>>> &conditions)
Initializes a new instance of the AndAllCondition<T> class.
Definition: AndAllCondition.h:46
bool Check(const T &el) override
Returns true if the specified object satisfy the conditions.
Definition: AndAllCondition.h:56
Represents a condition which can be used by filters or search methods.
Definition: ICondition.h:22
Definition: Asn.h:13