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