Aspose.Tasks for C++
TableCollection.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="TableCollection.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 MppViewWriter;
23 } // namespace MSProject
24 } // namespace IO
25 enum class ItemType;
26 class Project;
27 namespace Saving
28 {
29 class TemplateProjectLoader;
30 } // namespace Saving
31 class Table;
32 class View;
33 namespace Visualization
34 {
35 class ProjectView;
36 } // namespace Visualization
37 } // namespace Tasks
38 } // namespace Aspose
39 namespace System
40 {
41 namespace Collections
42 {
43 namespace Generic
44 {
45 template <typename> class IEnumerator;
46 template <typename> class List;
47 template <typename, typename> class SortedList;
48 } // namespace Generic
49 } // namespace Collections
50 } // namespace System
51 
52 namespace Aspose {
53 
54 namespace Tasks {
55 
56 /// <summary>
57 /// Contains a list of <see cref="Table"></see> objects.
58 /// Implements ICollection&lt;Table&gt; interface.
59 /// </summary>
60 class ASPOSE_TASKS_SHARED_CLASS TableCollection : public System::Collections::Generic::ICollection<System::SharedPtr<Aspose::Tasks::Table>>
61 {
62  typedef TableCollection ThisType;
63  typedef System::Collections::Generic::ICollection<System::SharedPtr<Aspose::Tasks::Table>> BaseType;
64 
65  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
66  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
67 
68  friend class Aspose::Tasks::Project;
69  friend class Aspose::Tasks::Saving::TemplateProjectLoader;
70  friend class Aspose::Tasks::View;
71  friend class Aspose::Tasks::IO::MSProject::MppViewWriter;
73 
74 public:
75 
76  /// <summary>
77  /// Gets the number of elements contained in this collection.
78  /// </summary>
79  ASPOSE_TASKS_SHARED_API int32_t get_Count() const override;
80  /// <summary>
81  /// Gets a value indicating whether this collection is read-only; otherwise, false.
82  /// </summary>
83  ASPOSE_TASKS_SHARED_API bool get_IsReadOnly() const override;
84 
85  /// <summary>
86  /// Returns an enumerator for this collection.
87  /// </summary>
88  /// <returns>an enumerator for this collection.</returns>
89  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<Table>>> GetEnumerator() override;
90  /// <summary>
91  /// Adds the specified item to this collection.
92  /// </summary>
93  /// <param name="item">the specified item to add to this collection.</param>
94  ASPOSE_TASKS_SHARED_API void Add(const System::SharedPtr<Table>& item) override;
95  /// <summary>
96  /// Removes all items from this collection.
97  /// </summary>
98  ASPOSE_TASKS_SHARED_API void Clear() override;
99  /// <summary>
100  /// Returns true if the specified item is found in this collection; otherwise, false.
101  /// </summary>
102  /// <param name="item">the specified item to find.</param>
103  /// <returns>true if the specified item is found in this collection; otherwise, false.</returns>
104  ASPOSE_TASKS_SHARED_API bool Contains(const System::SharedPtr<Table>& item) const override;
105  /// <summary>
106  /// Copies the elements of this collection to the specified array, starting at the specified array index.
107  /// </summary>
108  /// <param name="array">the specified one-dimensional array to copy elements to</param>
109  /// <param name="arrayIndex">the zero-based index of the specified array at which copying begins.</param>
110  ASPOSE_TASKS_SHARED_API void CopyTo(System::ArrayPtr<System::SharedPtr<Table>> array, int32_t arrayIndex) override;
111  /// <summary>
112  /// Removes the first occurrence of a specific object from this collection.
113  /// </summary>
114  /// <param name="item">the specified object to remove.</param>
115  /// <returns>true if the specified object was successfully removed from this collection; otherwise, false.</returns>
116  ASPOSE_TASKS_SHARED_API bool Remove(const System::SharedPtr<Table>& item) override;
117  /// <summary>
118  /// Converts a table collection to a list of <see cref="Table"></see> objects.
119  /// </summary>
120  /// <returns>Generic list of <see cref="Table"></see> objects.</returns>
121  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Table>>> ToList();
122 
123 protected:
124 
125  /// <summary>
126  /// Initializes a new instance of the <see cref="TableCollection"></see> class.
127  /// </summary>
128  ASPOSE_TASKS_SHARED_API TableCollection();
129 
130  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(TableCollection, CODEPORTING_ARGS());
131  /// <summary>
132  /// Gets a table by its name.
133  /// </summary>
134  /// <param name="name">table name</param>
135  /// <param name="itemType">ItemType</param>
136  /// <returns>Table with a given name if present; otherwise, null</returns>
137  ASPOSE_TASKS_SHARED_API System::SharedPtr<Table> GetByNameAndType(const System::String& name, ItemType itemType);
138  ASPOSE_TASKS_SHARED_API System::SharedPtr<Table> GetByType(ItemType itemType);
139  ASPOSE_TASKS_SHARED_API int32_t GetLastUid();
140 
141  virtual ASPOSE_TASKS_SHARED_API ~TableCollection();
142 
143  #ifdef ASPOSE_GET_SHARED_MEMBERS
144  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
145  #endif
146 
147 
148 private:
149 
150  System::SharedPtr<System::Collections::Generic::SortedList<int32_t, System::SharedPtr<Table>>> tables;
151 
152 };
153 
154 } // namespace Tasks
155 } // namespace Aspose
156 
157 
Represents a project.
Definition: Project.h:551
Contains a list of Table objects. Implements ICollection<Table> interface.
Definition: TableCollection.h:61
System::SharedPtr< System::Collections::Generic::IEnumerator< System::SharedPtr< Table > > > GetEnumerator() override
Returns an enumerator for this collection.
void Clear() override
Removes all items from this collection.
System::SharedPtr< System::Collections::Generic::List< System::SharedPtr< Table > > > ToList()
Converts a table collection to a list of Table objects.
int32_t get_Count() const override
Gets the number of elements contained in this collection.
bool Contains(const System::SharedPtr< Table > &item) const override
Returns true if the specified item is found in this collection; otherwise, false.
void CopyTo(System::ArrayPtr< System::SharedPtr< Table >> array, int32_t arrayIndex) override
Copies the elements of this collection to the specified array, starting at the specified array index.
bool Remove(const System::SharedPtr< Table > &item) override
Removes the first occurrence of a specific object from this collection.
bool get_IsReadOnly() const override
Gets a value indicating whether this collection is read-only; otherwise, false.
void Add(const System::SharedPtr< Table > &item) override
Adds the specified item to this collection.
Represents a view in Project.
Definition: View.h:100
Project's view class
Definition: ProjectView.h:58
Definition: Asn.h:13