Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_object_walker.h
Go to the documentation of this file.
1// Copyright 2017 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CORE_FPDFAPI_PARSER_CPDF_OBJECT_WALKER_H_
6#define CORE_FPDFAPI_PARSER_CPDF_OBJECT_WALKER_H_
7
8#include <memory>
9#include <stack>
10
11#include "core/fxcrt/bytestring.h"
12#include "core/fxcrt/retain_ptr.h"
13
14class CPDF_Object;
15
16// Walk on all non-null sub-objects in an object in depth, include itself,
17// like in flat list.
19 public:
21 public:
23 virtual bool IsFinished() const = 0;
24 bool IsStarted() const { return is_started_; }
26 const CPDF_Object* object() const { return object_.Get(); }
27
28 protected:
29 explicit SubobjectIterator(RetainPtr<const CPDF_Object> object);
30
31 virtual RetainPtr<const CPDF_Object> IncrementImpl() = 0;
32 virtual void Start() = 0;
33
34 private:
35 RetainPtr<const CPDF_Object> object_;
36 bool is_started_ = false;
37 };
38
39 explicit CPDF_ObjectWalker(RetainPtr<const CPDF_Object> root);
41
44
45 size_t current_depth() const { return current_depth_; }
46 const CPDF_Object* GetParent() const { return parent_object_.Get(); }
47 const ByteString& dictionary_key() const { return dict_key_; }
48
49 private:
50 static std::unique_ptr<SubobjectIterator> MakeIterator(
51 RetainPtr<const CPDF_Object> object);
52
53 RetainPtr<const CPDF_Object> next_object_;
54 RetainPtr<const CPDF_Object> parent_object_;
55 ByteString dict_key_;
56 size_t current_depth_ = 0;
57 std::stack<std::unique_ptr<SubobjectIterator>> stack_;
58};
59
60class CPDF_NonConstObjectWalker final : public CPDF_ObjectWalker {
61 public:
64};
65
66#endif // CORE_FPDFAPI_PARSER_CPDF_OBJECT_WALKER_H_
bool DecryptObjectTree(RetainPtr< CPDF_Object > object)
static bool IsSignatureDictionary(const CPDF_Dictionary *dictionary)
CPDF_CryptoHandler(Cipher cipher, const uint8_t *key, size_t keylen)
size_t EncryptGetSize(pdfium::span< const uint8_t > source) const
void EncryptContent(uint32_t objnum, uint32_t gennum, pdfium::span< const uint8_t > source, uint8_t *dest_buf, size_t &dest_size) const
RetainPtr< const CPDF_Object > GetDirectObjectFor(const ByteString &key) const
RetainPtr< CPDF_Object > GetNext()
CPDF_NonConstObjectWalker(RetainPtr< CPDF_Object > root)
virtual bool IsFinished() const =0
virtual RetainPtr< const CPDF_Object > IncrementImpl()=0
const CPDF_Object * object() const
SubobjectIterator(RetainPtr< const CPDF_Object > object)
RetainPtr< const CPDF_Object > Increment()
CPDF_ObjectWalker(RetainPtr< const CPDF_Object > root)
size_t current_depth() const
RetainPtr< const CPDF_Object > GetNext()
const CPDF_Object * GetParent() const
const ByteString & dictionary_key() const
void SetData(pdfium::span< const uint8_t > pData)
void SetString(const ByteString &str) override
ByteString GetString() const override
void AppendSpan(pdfium::span< const uint8_t > span)
pdfium::span< const uint8_t > GetSpan() const
pdfium::span< uint8_t > GetMutableSpan()
void CRYPT_AESSetIV(CRYPT_aes_context *context, const uint8_t *iv)
void CRYPT_AESSetKey(CRYPT_aes_context *context, const uint8_t *key, uint32_t keylen)
void CRYPT_AESDecrypt(CRYPT_aes_context *context, uint8_t *dest, const uint8_t *src, uint32_t size)
CRYPT_aes_context m_Context