From c09625ca59701fabeb49dc59edcf33031b2c6672 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 7 Nov 2016 11:46:09 -0800 Subject: Rename CPDF_Linearized to CPDF_LinearizedHeader My OCD insists that classes be named after nouns, and "linearized" feels like an adjective. Remove a redundant "if" while at it. Review-Url: https://codereview.chromium.org/2482973002 --- core/fpdfapi/parser/cpdf_linearized_header.h | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 core/fpdfapi/parser/cpdf_linearized_header.h (limited to 'core/fpdfapi/parser/cpdf_linearized_header.h') diff --git a/core/fpdfapi/parser/cpdf_linearized_header.h b/core/fpdfapi/parser/cpdf_linearized_header.h new file mode 100644 index 0000000000..0d6d725f00 --- /dev/null +++ b/core/fpdfapi/parser/cpdf_linearized_header.h @@ -0,0 +1,55 @@ +// Copyright 2016 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. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_PARSER_CPDF_LINEARIZED_HEADER_H_ +#define CORE_FPDFAPI_PARSER_CPDF_LINEARIZED_HEADER_H_ + +#include + +#include "core/fxcrt/fx_memory.h" +#include "core/fxcrt/fx_stream.h" + +class CPDF_Dictionary; +class CPDF_Object; + +class CPDF_LinearizedHeader { + public: + ~CPDF_LinearizedHeader(); + static std::unique_ptr CreateForObject( + std::unique_ptr pObj); + + // Will only return values > 0. + FX_FILESIZE GetFileSize() const { return m_szFileSize; } + uint32_t GetFirstPageNo() const { return m_dwFirstPageNo; } + // Will only return values > 0. + FX_FILESIZE GetLastXRefOffset() const { return m_szLastXRefOffset; } + uint32_t GetPageCount() const { return m_PageCount; } + // Will only return values > 0. + FX_FILESIZE GetFirstPageEndOffset() const { return m_szFirstPageEndOffset; } + // Will only return values > 0. + uint32_t GetFirstPageObjNum() const { return m_FirstPageObjNum; } + + bool HasHintTable() const; + // Will only return values > 0. + FX_FILESIZE GetHintStart() const { return m_szHintStart; } + // Will only return values > 0. + FX_FILESIZE GetHintLength() const { return m_szHintLength; } + + protected: + explicit CPDF_LinearizedHeader(const CPDF_Dictionary* pDict); + + private: + FX_FILESIZE m_szFileSize = 0; + uint32_t m_dwFirstPageNo = 0; + FX_FILESIZE m_szLastXRefOffset = 0; + uint32_t m_PageCount = 0; + FX_FILESIZE m_szFirstPageEndOffset = 0; + uint32_t m_FirstPageObjNum = 0; + FX_FILESIZE m_szHintStart = 0; + FX_FILESIZE m_szHintLength = 0; +}; + +#endif // CORE_FPDFAPI_PARSER_CPDF_LINEARIZED_HEADER_H_ -- cgit v1.2.3