Aspose.Tasks for C++
ViewCollection.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="ViewCollection.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/collections/icollection.h>
9 #include <system/array.h>
10 #include <cstdint>
11 
12 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
13 
14 namespace Aspose
15 {
16 namespace Tasks
17 {
18 namespace IO
19 {
20 namespace MSProject
21 {
22 class MPPReader;
23 class MppViewWriter;
24 } // namespace MSProject
25 } // namespace IO
26 class Project;
27 class View;
28 enum class ViewScreen;
29 } // namespace Tasks
30 } // namespace Aspose
31 namespace System
32 {
33 namespace Collections
34 {
35 namespace Generic
36 {
37 template <typename> class IEnumerator;
38 template <typename> class List;
39 template <typename, typename> class SortedList;
40 } // namespace Generic
41 } // namespace Collections
42 } // namespace System
43 
44 namespace Aspose {
45 
46 namespace Tasks {
47 
48 /// <summary>
49 /// Contains a list of <see cref="View"></see> objects.
50 /// Implements ICollection&lt;View&gt; interface.
51 /// </summary>
52 class ASPOSE_TASKS_SHARED_CLASS ViewCollection : public System::Collections::Generic::ICollection<System::SharedPtr<Aspose::Tasks::View>>
53 {
54  typedef ViewCollection ThisType;
55  typedef System::Collections::Generic::ICollection<System::SharedPtr<Aspose::Tasks::View>> BaseType;
56 
57  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
58  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
59 
60  friend class Aspose::Tasks::Project;
61  friend class Aspose::Tasks::IO::MSProject::MPPReader;
62  friend class Aspose::Tasks::IO::MSProject::MppViewWriter;
63 
64 public:
65 
66  /// <summary>
67  /// Gets the number of elements contained in this collection.
68  /// </summary>
69  ASPOSE_TASKS_SHARED_API int32_t get_Count() const override;
70  /// <summary>
71  /// Gets a value indicating whether this collection is read-only; otherwise, false.
72  /// </summary>
73  ASPOSE_TASKS_SHARED_API bool get_IsReadOnly() const override;
74  /// <summary>
75  /// Gets the parent of the View object.
76  /// Read-only <see cref="Project"></see>.
77  /// </summary>
78  ASPOSE_TASKS_SHARED_API const System::SharedPtr<Project>& get_ParentProject() const;
79 
80  /// <summary>
81  /// Returns an enumerator for this collection.
82  /// </summary>
83  /// <returns>an enumerator for this collection.</returns>
84  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<View>>> GetEnumerator() override;
85  /// <summary>
86  /// Adds the specified item to this collection.
87  /// </summary>
88  /// <param name="item">the specified item to add to this collection.</param>
89  ASPOSE_TASKS_SHARED_API void Add(const System::SharedPtr<View>& item) override;
90  /// <summary>
91  /// Removes all items from this collection.
92  /// </summary>
93  ASPOSE_TASKS_SHARED_API void Clear() override;
94  /// <summary>
95  /// Returns true if the specified item is found in this collection; otherwise, false.
96  /// </summary>
97  /// <param name="item">the specified item to find.</param>
98  /// <returns>true if the specified item is found in this collection; otherwise, false.</returns>
99  ASPOSE_TASKS_SHARED_API bool Contains(const System::SharedPtr<View>& item) const override;
100  /// <summary>
101  /// Copies the elements of this collection to the specified array, starting at the specified array index.
102  /// </summary>
103  /// <param name="array">the specified one-dimensional array to copy elements to</param>
104  /// <param name="arrayIndex">the zero-based index of the specified array at which copying begins.</param>
105  ASPOSE_TASKS_SHARED_API void CopyTo(System::ArrayPtr<System::SharedPtr<View>> array, int32_t arrayIndex) override;
106  /// <summary>
107  /// Removes the first occurrence of a specific object from this collection.
108  /// </summary>
109  /// <param name="item">the specified object to remove.</param>
110  /// <returns>true if the specified object was successfully removed from this collection; otherwise, false.</returns>
111  ASPOSE_TASKS_SHARED_API bool Remove(const System::SharedPtr<View>& item) override;
112  /// <summary>
113  /// Converts a view collection to a list of <see cref="View"></see> objects.
114  /// </summary>
115  /// <returns>Generic list of <see cref="View"></see> objects.</returns>
116  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<View>>> ToList();
117  /// <summary>
118  /// Searches for a View with the specified Screen property, and returns the first occurrence within the collection.
119  /// </summary>
120  /// <param name="screen"><see cref="ViewScreen"></see> enumeration value.</param>
121  /// <returns>The first View in collection which Screen property matches the specified screen argument, if found; otherwise, null.</returns>
122  ASPOSE_TASKS_SHARED_API System::SharedPtr<View> GetByViewScreen(ViewScreen screen);
123  /// <summary>
124  /// Searches for a View with the name, and returns the first occurrence within the collection.
125  /// </summary>
126  /// <param name="viewName">Name of the View to search.</param>
127  /// <returns>The first View in collection with the specified name, if found; otherwise, null.</returns>
128  ASPOSE_TASKS_SHARED_API System::SharedPtr<View> GetByName(const System::String& viewName);
129 
130 protected:
131 
132  /// <summary>
133  /// Gets the parent of the View object.
134  /// Read-only <see cref="Project"></see>.
135  /// </summary>
136  ASPOSE_TASKS_SHARED_API void set_ParentProject(const System::SharedPtr<Project>& value);
137 
138  /// <summary>
139  /// Initializes a new instance of the <see cref="ViewCollection"></see> class.
140  /// </summary>
141  ASPOSE_TASKS_SHARED_API ViewCollection(const System::SharedPtr<Project>& parentProject);
142 
143  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(ViewCollection, CODEPORTING_ARGS(const System::SharedPtr<Project>& parentProject));
144  ASPOSE_TASKS_SHARED_API System::SharedPtr<View> GetByIndex(int32_t index);
145  ASPOSE_TASKS_SHARED_API void SetViewUid(int32_t oldUid, int32_t newUid);
146 
147  virtual ASPOSE_TASKS_SHARED_API ~ViewCollection();
148 
149  #ifdef ASPOSE_GET_SHARED_MEMBERS
150  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
151  #endif
152 
153 
154 private:
155 
156  System::SharedPtr<System::Collections::Generic::SortedList<int32_t, System::SharedPtr<View>>> views;
157  System::WeakPtr<Project> pr_ParentProject;
158 
159 };
160 
161 } // namespace Tasks
162 } // namespace Aspose
163 
164 
Represents a project.
Definition: Project.h:551
Contains a list of View objects. Implements ICollection<View> interface.
Definition: ViewCollection.h:53
void Clear() override
Removes all items from this collection.
void CopyTo(System::ArrayPtr< System::SharedPtr< View >> array, int32_t arrayIndex) override
Copies the elements of this collection to the specified array, starting at the specified array index.
System::SharedPtr< View > GetByViewScreen(ViewScreen screen)
Searches for a View with the specified Screen property, and returns the first occurrence within the c...
System::SharedPtr< System::Collections::Generic::IEnumerator< System::SharedPtr< View > > > GetEnumerator() override
Returns an enumerator for this collection.
System::SharedPtr< System::Collections::Generic::List< System::SharedPtr< View > > > ToList()
Converts a view collection to a list of View objects.
bool Remove(const System::SharedPtr< View > &item) override
Removes the first occurrence of a specific object from this collection.
int32_t get_Count() const override
Gets the number of elements contained in this collection.
void Add(const System::SharedPtr< View > &item) override
Adds the specified item to this collection.
bool Contains(const System::SharedPtr< View > &item) const override
Returns true if the specified item is found in this collection; otherwise, false.
const System::SharedPtr< Project > & get_ParentProject() const
Gets the parent of the View object. Read-only Project.
System::SharedPtr< View > GetByName(const System::String &viewName)
Searches for a View with the name, and returns the first occurrence within the collection.
bool get_IsReadOnly() const override
Gets a value indicating whether this collection is read-only; otherwise, false.
Definition: Asn.h:13