EmbeddedFileCollection.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 
4 // C# preprocessor directive: #if NETCORE && (NETSTANDARD2_1 || NET5_0 || NET6_0 || NET7_0 || NET8_0)
5 
6 // C# INACTIVE CODE:
7 // using KeyValuePair = Aspose.Pdf.Engine.CommonData.KeyValuePair;
8 
9 // C# preprocessor directive: #endif
10 
11 
12 #include <system/exceptions.h>
13 #include <system/collections/ienumerator.h>
14 #include <system/collections/icollection.h>
15 #include <system/array.h>
16 #include <cstdint>
17 
18 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
19 
20 namespace Aspose
21 {
22 namespace Pdf
23 {
24 class Collection;
25 namespace CommonData
26 {
27 namespace Tree
28 {
29 class NamesTree;
30 } // namespace Tree
31 } // namespace CommonData
32 class Document;
33 namespace Engine
34 {
35 namespace CommonData
36 {
37 class ITreeNode;
38 } // namespace CommonData
39 namespace Data
40 {
41 class IPdfPrimitive;
42 } // namespace Data
43 namespace IO
44 {
45 namespace ConvertStrategies
46 {
47 class PdfAConvertStrategy;
48 } // namespace ConvertStrategies
49 } // namespace IO
50 class IPdfDocument;
51 } // namespace Engine
52 class FileSpecification;
53 } // namespace Pdf
54 } // namespace Aspose
55 namespace System
56 {
57 namespace Collections
58 {
59 namespace Generic
60 {
61 template <typename, typename> class Dictionary;
62 template <typename> class List;
63 } // namespace Generic
64 } // namespace Collections
65 } // namespace System
66 
67 namespace Aspose {
68 
69 namespace Pdf {
70 
71 class Details_EmbeddedFilesDoesNotExists;
73 
74 class Details_EmbeddedFilesDoesNotExists : public System::Details_Exception
75 {
76  typedef Details_EmbeddedFilesDoesNotExists ThisType;
77  typedef System::Details_Exception BaseType;
78 
79  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
80  RTTI_INFO_DECL();
81 
82  friend class System::ExceptionWrapperHelper;
83  template <typename T> friend class System::ExceptionWrapper;
84 
85 protected:
86 
87  [[noreturn]] void DoThrow(const System::ExceptionPtr& self) const override;
88 
89  Details_EmbeddedFilesDoesNotExists();
90 
91  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Details_EmbeddedFilesDoesNotExists, CODEPORTING_ARGS());
92 
93 };
94 
98 class ASPOSE_PDF_SHARED_CLASS EmbeddedFileCollection : public System::Collections::Generic::ICollection<System::SharedPtr<Aspose::Pdf::FileSpecification>>
99 {
102 
103  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
104  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
105 
106  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::PdfAConvertStrategy;
108 
109 private:
110 
111  class EmbeddedFilesEnumerator : public System::Collections::Generic::IEnumerator<System::SharedPtr<Aspose::Pdf::FileSpecification>>
112  {
113  typedef EmbeddedFilesEnumerator ThisType;
115 
116  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
117  RTTI_INFO_DECL();
118  CODEPORTING_ENUMERATOR_ITERATOR_METHODS_DECLARATION(CODEPORTING_ARGS(System::SharedPtr<FileSpecification>), CODEPORTING_NO_API_KEYWORD);
119 
120  public:
121 
122  const System::SharedPtr<FileSpecification>& get_Current() const override;
123 
125 
126  bool MoveNext() override;
127  void Reset() override;
128  void Dispose() override;
129 
130  private:
131 
133  int32_t viewed;
135 
136  bool MoveNextImplementation();
137  System::SharedPtr<FileSpecification>* GetCurrentElementPointer();
138 
139  };
140 
141 
142 public:
143 
147  ASPOSE_PDF_SHARED_API bool get_IsSynchronized();
151  ASPOSE_PDF_SHARED_API System::SharedPtr<System::Object> get_SyncRoot() const;
155  ASPOSE_PDF_SHARED_API int32_t get_Count() const override;
160 
166  ASPOSE_PDF_SHARED_API void CopyTo(System::ArrayPtr<System::SharedPtr<FileSpecification>> array, int32_t index) override;
176  ASPOSE_PDF_SHARED_API void Add(const System::SharedPtr<FileSpecification>& file) override;
182  ASPOSE_PDF_SHARED_API void Add(System::String key, System::SharedPtr<FileSpecification> file);
187  ASPOSE_PDF_SHARED_API void DeleteByKey(System::String key);
193  ASPOSE_PDF_SHARED_API System::SharedPtr<FileSpecification> FindByName(System::String name);
198  ASPOSE_PDF_SHARED_API void Delete(System::String name);
202  ASPOSE_PDF_SHARED_API void Delete();
203 
209  ASPOSE_PDF_SHARED_API System::SharedPtr<FileSpecification> idx_get(int32_t index);
215  ASPOSE_PDF_SHARED_API System::SharedPtr<FileSpecification> idx_get(System::String name);
216 
217 protected:
218 
223 
228 
229  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(EmbeddedFileCollection, CODEPORTING_ARGS());
230 
236 
237  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(EmbeddedFileCollection, CODEPORTING_ARGS(System::SharedPtr<Document> document));
238  void ConvertToObjects();
239 
240  virtual ASPOSE_PDF_SHARED_API ~EmbeddedFileCollection();
241 
242 private:
243 
247 
251  bool get_IsReadOnly() const override;
254 
258  void LoadCache();
259  int32_t GetFileSpecificationKey(System::SharedPtr<Engine::Data::IPdfPrimitive> value);
266  System::SharedPtr<FileSpecification> get(int32_t index);
277  void EnsureEmbeddedFilesExisit();
282  void ConvertToObjects(System::SharedPtr<Engine::Data::IPdfPrimitive> node);
283  void ClearTreeNode(System::SharedPtr<Engine::CommonData::ITreeNode> node);
287  bool Remove(const System::SharedPtr<FileSpecification>& item) override;
291  bool Contains(const System::SharedPtr<FileSpecification>& item) const override;
295  void Clear() override;
296 
297 };
298 
299 } // namespace Pdf
300 } // namespace Aspose
301 
302 
System::SharedPtr< Engine::IPdfDocument > EngineDoc
PDF document where embedded files are placed.
Definition: EmbeddedFileCollection.h:222
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
Class representing PDF document
Definition: Document.h:625
Definition: Artifact.h:67
Template that represents wrapper of exceptions that are derived from Exception class.
Definition: exception.h:28
Class representing embedded files collection.
Definition: EmbeddedFileCollection.h:98
Class representing embedded file.
Definition: FileSpecification.h:287
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
Interface of enumerator which can be used to iterate through some elements. Objects of this class sho...
Definition: BaseOperatorCollection.h:47
Definition: AFRelationship.h:4
Interface of collection of elements. Objects of this class should only be allocated using System::Mak...
Definition: Collection.h:41
List forward declaration.
Definition: Artifact.h:74
Represents class for Collection(12.3.5 Collections).
Definition: Collection.h:491
Whole PDF file will be submitted.