From e3c204392a01870ecc9e8f3b2aa06b2b45306b5a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 28 Mar 2018 18:28:45 +0000 Subject: Use ByteStringView in parsers This CL converts the CPDF_SimpleParser to accept a ByteStringView. Several of the callers of SimpleParser are also updated to use a ByteStringView instead of . Change-Id: Ic2df3a06f92e77b53745a0419b44368142f9d8e6 Reviewed-on: https://pdfium-review.googlesource.com/29351 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- core/fpdfapi/parser/cpdf_simple_parser.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'core/fpdfapi/parser/cpdf_simple_parser.h') diff --git a/core/fpdfapi/parser/cpdf_simple_parser.h b/core/fpdfapi/parser/cpdf_simple_parser.h index 659039e6fa..f02a58c98b 100644 --- a/core/fpdfapi/parser/cpdf_simple_parser.h +++ b/core/fpdfapi/parser/cpdf_simple_parser.h @@ -14,8 +14,8 @@ class CPDF_SimpleParser { public: - CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize); explicit CPDF_SimpleParser(const ByteStringView& str); + ~CPDF_SimpleParser(); ByteStringView GetWord(); @@ -23,15 +23,11 @@ class CPDF_SimpleParser { // and move the current position to the start of those parameters. bool FindTagParamFromStart(const ByteStringView& token, int nParams); - // For testing only. - uint32_t GetCurPos() const { return m_dwCurPos; } + uint32_t GetCurPosForTest() const { return cur_pos_; } private: - std::pair ParseWord(); - - const uint8_t* m_pData; - uint32_t m_dwSize; - uint32_t m_dwCurPos; + const ByteStringView data_; + uint32_t cur_pos_ = 0; }; #endif // CORE_FPDFAPI_PARSER_CPDF_SIMPLE_PARSER_H_ -- cgit v1.2.3