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 "core/fxcrt/retain_ptr.h"
11#include "core/fxcrt/string_pool_template.h"
12#include "core/fxcrt/weak_ptr.h"
13#include "third_party/base/containers/span.h"
14
15class CPDF_Dictionary;
16class CPDF_Document;
17class CPDF_Object;
18class CPDF_Stream;
19
21 public:
23
24 explicit CPDF_StreamParser(pdfium::span<const uint8_t> span);
25 CPDF_StreamParser(pdfium::span<const uint8_t> span,
26 const WeakPtr<ByteStringPool>& pPool);
28
30 ByteStringView GetWord() const {
31 return ByteStringView(m_WordBuffer, m_WordSize);
32 }
33 uint32_t GetPos() const { return m_Pos; }
34 void SetPos(uint32_t pos) { m_Pos = pos; }
35 const RetainPtr<CPDF_Object>& GetObject() const { return m_pLastObj; }
36 RetainPtr<CPDF_Object> ReadNextObject(bool bAllowNestedArray,
37 bool bInArray,
38 uint32_t dwRecursionLevel);
39 RetainPtr<CPDF_Stream> ReadInlineStream(CPDF_Document* pDoc,
40 RetainPtr<CPDF_Dictionary> pDict,
41 const CPDF_Object* pCSObj);
42
43 private:
44 friend class cpdf_streamparser_ReadHexString_Test;
45 static constexpr uint32_t kMaxWordLength = 255;
46
47 void GetNextWord(bool& bIsNumber);
48 ByteString ReadString();
49 ByteString ReadHexString();
50 bool PositionIsInBounds() const;
51
52 uint32_t m_Pos = 0; // Current byte position within |m_pBuf|.
53 uint32_t m_WordSize = 0; // Current byte position within |m_WordBuffer|.
54 WeakPtr<ByteStringPool> m_pPool;
55 RetainPtr<CPDF_Object> m_pLastObj;
56 pdfium::span<const uint8_t> m_pBuf;
57 uint8_t m_WordBuffer[kMaxWordLength + 1] = {}; // Include space for NUL.
58};
59
60#endif // CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_
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
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
static RetainPtr< CPDF_ColorSpace > GetStockCS(Family family)
CPDF_DictionaryLocker(const CPDF_Dictionary *pDictionary)
uint32_t ComponentBits() 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)
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
bool operator==(const char *ptr) const
bool IsEmpty() const
Definition bytestring.h:119
bool operator!=(const char *ptr) const
Definition bytestring.h:130
@ kCoonsPatchMeshShading
@ kTensorProductPatchMeshShading
@ kLatticeFormGouraudTriangleMeshShading
@ kFreeFormGouraudTriangleMeshShading
bool TextRenderingModeIsStrokeMode(const TextRenderingMode &mode)
TextRenderingMode
#define FX_FILESIZE
Definition fx_types.h:19
#define CHECK(cvref)