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_streamparser.h
Go to the documentation of this file.
1// Copyright 2016 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// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_
8#define CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_
9
10#include <stdint.h>
11
12#include <array>
13
14#include "core/fxcrt/data_vector.h"
15#include "core/fxcrt/raw_span.h"
16#include "core/fxcrt/retain_ptr.h"
17#include "core/fxcrt/span.h"
18#include "core/fxcrt/string_pool_template.h"
19#include "core/fxcrt/weak_ptr.h"
20
21class CPDF_Dictionary;
22class CPDF_Document;
23class CPDF_Object;
24class CPDF_Stream;
25
27 public:
29
30 explicit CPDF_StreamParser(pdfium::span<const uint8_t> span);
31 CPDF_StreamParser(pdfium::span<const uint8_t> span,
32 const WeakPtr<ByteStringPool>& pPool);
34
37 return ByteStringView(m_WordBuffer).First(m_WordSize);
38 }
39 uint32_t GetPos() const { return m_Pos; }
40 void SetPos(uint32_t pos) { m_Pos = pos; }
41 const RetainPtr<CPDF_Object>& GetObject() const { return m_pLastObj; }
42 RetainPtr<CPDF_Object> ReadNextObject(bool bAllowNestedArray,
43 bool bInArray,
44 uint32_t dwRecursionLevel);
45 RetainPtr<CPDF_Stream> ReadInlineStream(CPDF_Document* pDoc,
47 const CPDF_Object* pCSObj);
48
49 private:
50 friend class cpdf_streamparser_ReadHexString_Test;
51 static constexpr uint32_t kMaxWordLength = 255;
52
53 void GetNextWord(bool& bIsNumber);
54 ByteString ReadString();
55 DataVector<uint8_t> ReadHexString();
56 bool PositionIsInBounds() const;
57
58 uint32_t m_Pos = 0; // Current byte position within |m_pBuf|.
59 uint32_t m_WordSize = 0; // Current byte position within |m_WordBuffer|.
60 WeakPtr<ByteStringPool> m_pPool;
61 RetainPtr<CPDF_Object> m_pLastObj;
62 pdfium::raw_span<const uint8_t> m_pBuf;
63 // Include space for NUL.
64 std::array<uint8_t, kMaxWordLength + 1> m_WordBuffer = {};
65};
66
67#endif // CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_
fxcrt::ByteString ByteString
Definition bytestring.h:180
#define DCHECK
Definition check.h:33
CFX_FloatRect(const CFX_FloatRect &that)=default
constexpr CFX_FloatRect()=default
void UpdateRect(const CFX_PointF &point)
void Intersect(const CFX_FloatRect &other_rect)
CFX_FloatRect & operator=(const CFX_FloatRect &that)=default
CFX_Matrix & operator=(const CFX_Matrix &other)=default
CFX_FloatRect TransformRect(const CFX_FloatRect &rect) const
constexpr CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
bool IsIdentity() const
void Concat(const CFX_Matrix &right)
bool m_CloseFigure
Definition cfx_path.h:35
std::vector< RetainPtr< CPDF_Object > >::const_iterator const_iterator
Definition cpdf_array.h:29
static RetainPtr< CPDF_ColorSpace > GetStockCS(Family family)
CPDF_DictionaryLocker(const CPDF_Dictionary *pDictionary)
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
uint32_t ComponentBits() const
uint32_t ReadFlag() const
bool CanReadCoords() const
bool CanReadFlag() const
void SkipBits(uint32_t nbits)
void AppendRect(float left, float bottom, float right, float top)
Definition cpdf_path.cpp:53
void Transform(const CFX_Matrix &matrix)
Definition cpdf_path.cpp:41
ShadingType GetShadingType() const
CPDF_StreamContentParser(CPDF_Document *pDoc, RetainPtr< CPDF_Dictionary > pPageResources, RetainPtr< CPDF_Dictionary > pParentResources, const CFX_Matrix *pmtContentToUser, CPDF_PageObjectHolder *pObjHolder, RetainPtr< CPDF_Dictionary > pResources, const CFX_FloatRect &rcBBox, const CPDF_AllStates *pStates, CPDF_Form::RecursionState *parse_state)
CPDF_PageObjectHolder::CTMMap TakeAllCTMs()
uint32_t Parse(pdfium::span< const uint8_t > pData, uint32_t start_offset, uint32_t max_cost, const std::vector< uint32_t > &stream_start_offsets)
static ByteStringView FindValueAbbreviationForTesting(ByteStringView abbr)
RetainPtr< CPDF_Font > FindFont(const ByteString &name)
static ByteStringView FindKeyAbbreviationForTesting(ByteStringView abbr)
void SetPos(uint32_t pos)
ElementType ParseNextElement()
const RetainPtr< CPDF_Object > & GetObject() const
uint32_t GetPos() const
RetainPtr< CPDF_Object > ReadNextObject(bool bAllowNestedArray, bool bInArray, uint32_t dwRecursionLevel)
RetainPtr< CPDF_Stream > ReadInlineStream(CPDF_Document *pDoc, RetainPtr< CPDF_Dictionary > pDict, const CPDF_Object *pCSObj)
CPDF_StreamParser(pdfium::span< const uint8_t > span, const WeakPtr< ByteStringPool > &pPool)
CPDF_StreamParser(pdfium::span< const uint8_t > span)
ByteStringView GetWord() const
float GetFloat() const
ByteString()=default
bool operator==(const char *ptr) const
bool operator!=(const char *ptr) const
Definition bytestring.h:65
@ kCoonsPatchMeshShading
@ kTensorProductPatchMeshShading
@ kLatticeFormGouraudTriangleMeshShading
@ kFreeFormGouraudTriangleMeshShading
bool TextRenderingModeIsStrokeMode(const TextRenderingMode &mode)
TextRenderingMode
CFX_PTemplate< float > CFX_PointF
pdfium::CheckedNumeric< uint32_t > FX_SAFE_UINT32
#define FX_FILESIZE
Definition fx_types.h:19
#define NOTREACHED_NORETURN()
Definition notreached.h:22
#define CHECK(cvref)
fxcrt::ByteStringView ByteStringView