blob: 816c1be77edd12affc8841888516cc4b6a0aa164 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright 2018 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CORE_FPDFAPI_PARSER_CPDF_OBJECT_STREAM_H_
#define CORE_FPDFAPI_PARSER_CPDF_OBJECT_STREAM_H_
#include <map>
#include <memory>
#include <vector>
#include "core/fpdfapi/parser/cpdf_object.h"
#include "core/fxcrt/retain_ptr.h"
class CPDF_IndirectObjectHolder;
class CPDF_Stream;
class CPDF_StreamAcc;
class IFX_SeekableReadStream;
// Implementation of logic of PDF "Object Streams".
// See "PDF 32000-1:2008" Spec. section 7.5.7.
class CPDF_ObjectStream {
public:
static bool IsObjectsStreamObject(const CPDF_Object* object);
static std::unique_ptr<CPDF_ObjectStream> Create(const CPDF_Stream* stream);
~CPDF_ObjectStream();
uint32_t obj_num() const { return obj_num_; }
uint32_t extends_obj_num() const { return extends_obj_num_; }
bool HasObject(uint32_t obj_number) const;
std::unique_ptr<CPDF_Object> ParseObject(CPDF_IndirectObjectHolder* pObjList,
uint32_t obj_number) const;
protected:
explicit CPDF_ObjectStream(const CPDF_Stream* stream);
void Init(const CPDF_Stream* stream);
std::unique_ptr<CPDF_Object> ParseObjectAtOffset(
CPDF_IndirectObjectHolder* pObjList,
uint32_t object_offset) const;
uint32_t obj_num_ = CPDF_Object::kInvalidObjNum;
uint32_t extends_obj_num_ = CPDF_Object::kInvalidObjNum;
RetainPtr<IFX_SeekableReadStream> data_stream_;
int first_object_offset_ = 0;
std::map<uint32_t, uint32_t> objects_offsets_;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_OBJECT_STREAM_H_
|