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_simple_parser.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_PARSER_CPDF_SIMPLE_PARSER_H_
8#define CORE_FPDFAPI_PARSER_CPDF_SIMPLE_PARSER_H_
9
10#include <stdint.h>
11
12#include <optional>
13
14#include "core/fxcrt/bytestring.h"
15#include "core/fxcrt/span.h"
16
18 public:
19 explicit CPDF_SimpleParser(pdfium::span<const uint8_t> input);
21
23
24 void SetCurrentPosition(uint32_t position) { cur_position_ = position; }
25 uint32_t GetCurrentPosition() const { return cur_position_; }
26
27 private:
28 // Returns the ByteStringView of the subspan of `data_` from `start_position`
29 // to `cur_position_`.
30 ByteStringView GetDataToCurrentPosition(uint32_t start_position) const;
31
32 // Skips whitespace and comment lines. Returns the first parseable character
33 // if `data_` can still be parsed, nullopt otherwise.
34 std::optional<uint8_t> SkipSpacesAndComments();
35
36 ByteStringView HandleName();
37 ByteStringView HandleBeginAngleBracket();
38 ByteStringView HandleEndAngleBracket();
39 ByteStringView HandleParentheses();
40 ByteStringView HandleNonDelimiter();
41
42 const pdfium::span<const uint8_t> data_;
43
44 // The current unread position.
45 uint32_t cur_position_ = 0;
46};
47
48#endif // CORE_FPDFAPI_PARSER_CPDF_SIMPLE_PARSER_H_
fxcrt::ByteString ByteString
Definition bytestring.h:180
#define DCHECK
Definition check.h:33
CPDF_CMapParser(CPDF_CMap *pCMap)
void ParseWord(ByteStringView word)
~CPDF_CMap() override
size_t CountChar(ByteStringView pString) const
uint32_t GetNextChar(ByteStringView pString, size_t *pOffset) const
@ MixedTwoBytes
Definition cpdf_cmap.h:43
@ MixedFourBytes
Definition cpdf_cmap.h:44
uint16_t CIDFromCharCode(uint32_t charcode) const
void SetAdditionalMappings(std::vector< CIDRange > mappings)
int GetCharSize(uint32_t charcode) const
void AppendChar(ByteString *str, uint32_t charcode) const
void SetMixedFourByteLeadingRanges(std::vector< CodeRange > ranges)
void SetDirectCharcodeToCIDTableRange(uint32_t start_code, uint32_t end_code, uint16_t start_cid)
CPDF_SimpleParser(pdfium::span< const uint8_t > input)
uint32_t GetCurrentPosition() const
void SetCurrentPosition(uint32_t position)
ByteStringView GetWord()
ByteString & operator+=(char ch)
CIDSet
@ CIDSET_KOREA1
@ CIDSET_JAPAN1
@ CIDSET_GB1
@ CIDSET_CNS1
CIDCoding
Definition cpdf_cmap.h:25
#define NOTREACHED_NORETURN()
Definition notreached.h:22
fxcrt::ByteStringView ByteStringView