PoDoFo  1.0.0-dev
PdfResourceOperations.h
1 
7 #ifndef PDF_RESOURCE_OPERATIONS_H
8 #define PDF_RESOURCE_OPERATIONS_H
9 
10 #include "PdfDictionary.h"
11 
12 namespace PoDoFo {
13 
18 class PODOFO_API PdfResourceOperations
19 {
20 protected:
22 
23 public:
26  virtual PdfName AddResource(PdfResourceType type, const PdfObject& obj) = 0;
27 
30  virtual void AddResource(PdfResourceType type, const PdfName& key, const PdfObject& obj) = 0;
31 
34  virtual PdfObject* GetResource(PdfResourceType type, const std::string_view& key) = 0;
35 
38  virtual const PdfObject* GetResource(PdfResourceType type, const std::string_view& key) const = 0;
39 
42  virtual PdfDictionaryIndirectIterable GetResourceIterator(PdfResourceType type) = 0;
43 
46  virtual PdfDictionaryConstIndirectIterable GetResourceIterator(PdfResourceType type) const = 0;
47 
51  virtual void RemoveResource(PdfResourceType type, const std::string_view& key) = 0;
52 
56  virtual void RemoveResources(PdfResourceType type) = 0;
57 
58  // Generic functions to access resources by arbitrary type
59  // name. They shouldn't be generally needed, they are provided
60  // for custom use
61 
64  virtual PdfName AddResource(const PdfName& type, const PdfObject& obj) = 0;
65 
68  virtual void AddResource(const PdfName& type, const PdfName& key, const PdfObject& obj) = 0;
69 
72  virtual PdfObject* GetResource(const std::string_view& type, const std::string_view& key) = 0;
73 
76  virtual const PdfObject* GetResource(const std::string_view& type, const std::string_view& key) const = 0;
77 
80  virtual PdfDictionaryIndirectIterable GetResourceIterator(const std::string_view& type) = 0;
81 
84  virtual PdfDictionaryConstIndirectIterable GetResourceIterator(const std::string_view& type) const = 0;
85 
89  virtual void RemoveResource(const std::string_view& type, const std::string_view& key) = 0;
90 
94  virtual void RemoveResources(const std::string_view& type) = 0;
95 
96 protected:
98  PdfResourceOperations& operator=(const PdfResourceOperations&) = default;
99 };
100 
101 };
102 
103 #endif // PDF_RESOURCE_OPERATIONS_H
Helper class to iterate through indirect objects.
Definition: PdfDictionary.h:22
This class represents a PdfName.
Definition: PdfName.h:24
This class represents a PDF indirect Object in memory.
Definition: PdfObject.h:35
Low level interface for resource handling operations Inherited by PdfResources.
Definition: PdfResourceOperations.h:19
virtual PdfDictionaryConstIndirectIterable GetResourceIterator(const std::string_view &type) const =0
Get resource iterator by type name string.
virtual void RemoveResource(const std::string_view &type, const std::string_view &key)=0
Remove resource by type name string and key.
virtual const PdfObject * GetResource(PdfResourceType type, const std::string_view &key) const =0
Get resource by type and key.
virtual void AddResource(const PdfName &type, const PdfName &key, const PdfObject &obj)=0
Add resource by type name string and key.
virtual void AddResource(PdfResourceType type, const PdfName &key, const PdfObject &obj)=0
Add resource by type and key.
virtual const PdfObject * GetResource(const std::string_view &type, const std::string_view &key) const =0
Get resource by type name string and key.
virtual PdfObject * GetResource(const std::string_view &type, const std::string_view &key)=0
Get resource by type name string and key.
virtual void RemoveResources(const std::string_view &type)=0
Remove resources by type name string.
virtual PdfName AddResource(PdfResourceType type, const PdfObject &obj)=0
Add resource by type generating a new unique identifier.
virtual void RemoveResource(PdfResourceType type, const std::string_view &key)=0
Remove resource by type and key.
virtual PdfDictionaryIndirectIterable GetResourceIterator(const std::string_view &type)=0
Get resource iterator by type name string.
virtual PdfName AddResource(const PdfName &type, const PdfObject &obj)=0
Add resource by type name string generating a new unique identifier.
virtual PdfDictionaryIndirectIterable GetResourceIterator(PdfResourceType type)=0
Get resource iterator by type.
virtual PdfObject * GetResource(PdfResourceType type, const std::string_view &key)=0
Get resource by type and key.
virtual void RemoveResources(PdfResourceType type)=0
Remove resources by type.
virtual PdfDictionaryConstIndirectIterable GetResourceIterator(PdfResourceType type) const =0
Get resource iterator by type.
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition: basetypes.h:16