FileSpecification.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 
4 #include <system/string.h>
5 #include <system/scope_guard.h>
6 #include <system/make_const_ref.h>
7 #include <system/idisposable.h>
8 #include <system/details/pointer_collection_helpers.h>
9 #include <system/default.h>
10 #include <system/date_time.h>
11 #include <cstdint>
12 
13 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
14 
15 namespace Aspose
16 {
17 namespace Pdf
18 {
19 enum class AFRelationship;
20 namespace Annotations
21 {
22 class Annotation;
23 class FileAttachmentAnnotation;
24 class GoToRemoteAction;
25 class ImportDataAction;
26 class LaunchAction;
27 class MediaClipData;
28 class MovieAnnotation;
29 class RenditionAction;
30 class RichMediaAnnotation;
31 class SubmitFormAction;
32 } // namespace Annotations
33 class EmbeddedFileCollection;
34 class EncryptedPayload;
35 namespace Engine
36 {
37 namespace Data
38 {
39 class IPdfDictionary;
40 class IPdfObject;
41 class IPdfPrimitive;
42 class ITrailerable;
43 } // namespace Data
44 namespace Filters
45 {
46 enum class FilterType;
47 } // namespace Filters
48 namespace IO
49 {
50 namespace ConvertStrategies
51 {
52 class PdfAConvertStrategy;
53 class PdfUaConvertStrategy;
54 } // namespace ConvertStrategies
55 } // namespace IO
56 } // namespace Engine
57 namespace Facades
58 {
59 class PdfFileEditor;
60 } // namespace Facades
61 enum class FileEncoding;
62 class FileParams;
63 class FileSpecification;
64 namespace Tests
65 {
66 class RegressionTests_v10_2;
67 class RegressionTests_v10_3;
68 } // namespace Tests
69 } // namespace Pdf
70 } // namespace Aspose
71 namespace System
72 {
73 namespace Collections
74 {
75 namespace Generic
76 {
77 template <typename, typename> class Dictionary;
78 template <typename> class ICollection;
79 } // namespace Generic
80 } // namespace Collections
81 namespace IO
82 {
83 class Stream;
84 } // namespace IO
85 } // namespace System
86 
87 namespace Aspose {
88 
89 namespace Pdf {
90 
95 class ASPOSE_PDF_SHARED_CLASS CollectionItem : public System::Object
96 {
97  typedef CollectionItem ThisType;
98  typedef System::Object BaseType;
99 
100  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
101  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
102 
104 
105 public:
106 
111  template<typename T>
112  class Value : public System::Object
113  {
114  typedef Value<T> ThisType;
115  typedef System::Object BaseType;
116 
117  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
118  RTTI_INFO_TEMPLATE_CLASS(ThisType, ThisTypeBaseTypesInfo);
119 
121  friend class Aspose::Pdf::CollectionItem;
122 
123  public:
124 
131  {
132  return pr_Prefix;
133  }
134 
139  {
140  return pr_Data;
141  }
142 
143  void SetTemplateWeakPtr(uint32_t argument) override
144  {
145  switch (argument)
146  {
147  case 0:
148  break;
149 
150  }
151  }
152 
153  protected:
154 
158  Value() : pr_Data(T())
159  {
160  //Self Reference+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
161  System::Details::ThisProtector __local_self_ref(this);
162  //---------------------------------------------------------Self Reference
163 
164  pr_Data = System::Default<T>();
165  pr_Prefix = System::String::Empty;
166  }
167 
168  MEMBER_FUNCTION_MAKE_OBJECT(Value, CODEPORTING_ARGS(), CODEPORTING_ARGS());
169 
174  Value(T data) : Value(System::String::Empty, data)
175  {
176  }
177 
178  MEMBER_FUNCTION_MAKE_OBJECT(Value, CODEPORTING_ARGS(T data), CODEPORTING_ARGS(data));
179 
185  Value(System::String prefix, T data) : pr_Data(T())
186  {
187  //Self Reference+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
188  System::Details::ThisProtector __local_self_ref(this);
189  //---------------------------------------------------------Self Reference
190 
191  pr_Data = data;
192  pr_Prefix = prefix;
193  }
194 
195  MEMBER_FUNCTION_MAKE_OBJECT(Value, CODEPORTING_ARGS(System::String prefix, T data), CODEPORTING_ARGS(prefix,data));
196 
197  private:
198 
199  System::String pr_Prefix;
200  T pr_Data;
201 
202  };
203 
204 
205 public:
206 
216  ASPOSE_PDF_SHARED_API bool get_IsEmpty();
221 
227  ASPOSE_PDF_SHARED_API bool HasName(System::String name);
234  ASPOSE_PDF_SHARED_API bool TryGetIntValue(System::String name, System::SharedPtr<CollectionItem::Value<int32_t>>& value);
241  ASPOSE_PDF_SHARED_API bool TryGetDoubleValue(System::String name, System::SharedPtr<CollectionItem::Value<double>>& value);
256 
257 protected:
258 
262  CollectionItem();
263 
265 
271 
273 
274 private:
275 
278 
279  void InitValues();
281 
282 };
283 
287 class ASPOSE_PDF_SHARED_CLASS FileSpecification final : public System::IDisposable
288 {
289  typedef FileSpecification ThisType;
291 
292  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
293  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
294 
298  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::PdfUaConvertStrategy;
300  friend class Aspose::Pdf::Engine::IO::ConvertStrategies::PdfAConvertStrategy;
310  friend class Aspose::Pdf::Tests::RegressionTests_v10_3;
311  friend class Aspose::Pdf::Tests::RegressionTests_v10_2;
312 
313 public:
314 
320  ASPOSE_PDF_SHARED_API FileEncoding get_Encoding() const;
326  ASPOSE_PDF_SHARED_API void set_Encoding(FileEncoding value);
330  ASPOSE_PDF_SHARED_API bool get_IncludeContents() const;
334  ASPOSE_PDF_SHARED_API void set_IncludeContents(bool value);
338  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::CollectionItem> get_CollectionItem();
342  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::EncryptedPayload> get_EncryptedPayload();
346  ASPOSE_PDF_SHARED_API System::String get_Description();
350  ASPOSE_PDF_SHARED_API void set_Description(System::String value);
354  ASPOSE_PDF_SHARED_API Aspose::Pdf::AFRelationship get_AFRelationship();
358  ASPOSE_PDF_SHARED_API void set_AFRelationship(Aspose::Pdf::AFRelationship value);
364  ASPOSE_PDF_SHARED_API System::SharedPtr<System::IO::Stream> get_StreamContents();
370  ASPOSE_PDF_SHARED_API System::SharedPtr<System::IO::Stream> get_Contents();
376  ASPOSE_PDF_SHARED_API void set_Contents(System::SharedPtr<System::IO::Stream> value);
380  ASPOSE_PDF_SHARED_API System::SharedPtr<FileParams> get_Params();
384  ASPOSE_PDF_SHARED_API void set_Params(System::SharedPtr<FileParams> value);
388  ASPOSE_PDF_SHARED_API System::String get_MIMEType();
392  ASPOSE_PDF_SHARED_API void set_MIMEType(System::String value);
396  ASPOSE_PDF_SHARED_API System::String get_Name();
400  ASPOSE_PDF_SHARED_API void set_Name(System::String value);
404  ASPOSE_PDF_SHARED_API System::String get_UnicodeName();
408  ASPOSE_PDF_SHARED_API void set_UnicodeName(System::String value);
412  ASPOSE_PDF_SHARED_API System::String get_FileSystem();
416  ASPOSE_PDF_SHARED_API void set_FileSystem(System::String value);
417 
422  ASPOSE_PDF_SHARED_API FileSpecification(System::String file);
428  ASPOSE_PDF_SHARED_API FileSpecification(System::SharedPtr<System::IO::Stream> stream, System::String name);
434  ASPOSE_PDF_SHARED_API FileSpecification(System::String file, System::String description);
441  ASPOSE_PDF_SHARED_API FileSpecification(System::SharedPtr<System::IO::Stream> stream, System::String name, System::String description);
447  ASPOSE_PDF_SHARED_API FileSpecification(System::String fileName, System::SharedPtr<Annotations::Annotation> annot);
451  ASPOSE_PDF_SHARED_API FileSpecification();
452 
458  ASPOSE_PDF_SHARED_API System::String GetValue(System::String key);
464  ASPOSE_PDF_SHARED_API void SetValue(System::String key, System::String value);
468  ASPOSE_PDF_SHARED_API void Dispose() override;
469 
470 protected:
471 
476  System::SharedPtr<Engine::Data::IPdfObject> get_EngineObj() const;
477 
479 
480  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(FileSpecification, CODEPORTING_ARGS(System::SharedPtr<Engine::Data::IPdfPrimitive> specification));
481  void SendMeteredInformation();
488 
489  virtual ASPOSE_PDF_SHARED_API ~FileSpecification();
490 
491 private:
492 
495  System::String _description;
496  Aspose::Pdf::AFRelationship _afRelationship;
498  System::String _name;
499  System::String _unicodeName;
500  bool _disposeContents;
502  System::String _fileSystem;
503  bool _includeContents;
504  System::String _mimeType;
505  bool _meteredInformationSent;
508  FileEncoding _encoding;
509 
511  void set_contents(System::SharedPtr<System::IO::Stream> value);
512 
514 
515  Engine::Filters::FilterType TranslateEncoding(FileEncoding encoding);
516  bool IsAscii(System::String s);
517  void CopyParameters();
518 
519 };
520 
521 } // namespace Pdf
522 } // namespace Aspose
523 
524 
Value(System::String prefix, T data)
Creates a collection item value class instance.
Definition: FileSpecification.h:185
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
Represents a remote go-to action that is similar to an ordinary go-to action but jumps to a destinati...
Definition: GoToRemoteAction.h:42
Upon invocation of an import-data action, Forms Data Format (FDF) data shall be imported into the doc...
Definition: ImportDataAction.h:33
Class describes media clip data.
Definition: MediaClipData.h:33
Value()
Creates a collection item value class instance.
Definition: FileSpecification.h:158
Represents a launch action that launches an application or opens or prints a document.
Definition: LaunchAction.h:37
Defines an embedded file parameter dictionary that shall contain additional file-specific information...
Definition: FileParams.h:51
Represents a class for a value of colection item.
Definition: FileSpecification.h:112
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:64
Definition: Artifact.h:67
ASPOSE_PDF_SHARED_API bool TryGetDoubleValue(System::String name, System::SharedPtr< CollectionItem::Value< double >> &value)
Tries to get the double value for the specified name from the collection item.
System::String get_Prefix() const
Gets a prefix string that shall be concatenated with the text string presented to the user...
Definition: FileSpecification.h:130
System::MakeConstRef_t< T > get_Data() const
Gets a collection item value.
Definition: FileSpecification.h:138
Class representing embedded files collection.
Definition: EmbeddedFileCollection.h:98
Represents a collection item class. The collection item contains the data described by the collection...
Definition: FileSpecification.h:95
ASPOSE_PDF_SHARED_API bool HasName(System::String name)
Checks if the given name exists in the collection item.
Class representing embedded file.
Definition: FileSpecification.h:287
Definition: signed_info.h:13
Class describes RichMediaAnnotation which allows embed video/audio data into PDF document.
Definition: RichMediaAnnotation.h:59
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
Defines method that releases resources owned by the current object. Objects of this class should only...
Definition: idisposable.h:29
Definition: AFRelationship.h:4
A rendition action that controls the playing of multimedia content.
Definition: RenditionAction.h:42
ASPOSE_PDF_SHARED_API bool get_IsEmpty()
Gets a value indicating whether the collection item is empty.
Class describes file attachment annotation.
Definition: FileAttachmentAnnotation.h:58
FilterType
Definition: FilterType.h:24
typename MakeConstRef< T >::type MakeConstRef_t
Helper type for MakeConstRef modifier.
Definition: make_const_ref.h:20
ASPOSE_PDF_SHARED_API bool TryGetDateTimeValue(System::String name, System::SharedPtr< CollectionItem::Value< System::DateTime >> &value)
Tries to get the value of type DateTime from the collection item by the specified name...
static const ASPOSECPP_SHARED_API String Empty
Empty string.
Definition: string.h:894
Implements operations with PDF file: concatenation, splitting, extracting pages, making booklet...
Definition: PdfFileEditor.h:105
Value(T data)
Creates a collection item value class instance.
Definition: FileSpecification.h:174
ASPOSE_PDF_SHARED_API bool TryGetIntValue(System::String name, System::SharedPtr< CollectionItem::Value< int32_t >> &value)
Tries to get the integer value for a specified name from the collection item.
Represents encrypted payload in file specification.
Definition: EncryptedPayload.h:34
Class which describes submit-form action.
Definition: SubmitFormAction.h:34
Represents a movie annotation that contains animated graphics and sound to be presented on the comput...
Definition: MovieAnnotation.h:48
FileEncoding
Encoding of the attached file. Possible values: Zip - file is compressed with ZIP, None - file is non compressed.
Definition: FileEncoding.h:16
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(CollectionItem, CODEPORTING_ARGS())
CollectionItem()
Creates a collection item class instance.
void SetTemplateWeakPtr(uint32_t argument) override
Set n&#39;th template argument a weak pointer (rather than shared). Allows switching pointers in containe...
Definition: FileSpecification.h:143
AFRelationship
Enumeration describes associated files relationship.
Definition: AFRelationship.h:11
ASPOSE_PDF_SHARED_API bool TryGetTextValue(System::String name, System::SharedPtr< CollectionItem::Value< System::String >> &value)
Tries to get the text value with the specified name from the collection item.
ASPOSE_PDF_SHARED_API System::SharedPtr< System::Collections::Generic::ICollection< System::String > > get_AllNames()
Gets a collection of all the names of collection item values.
Whole PDF file will be submitted.