summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_contentparser.h
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-11-07 14:22:19 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-07 14:22:19 +0000
commitf2f12b32b601f022b5c10fddd8c4d19d00072630 (patch)
tree3f23bcaf245b1bc7d331638070a42ae0f40c3908 /core/fpdfapi/page/cpdf_contentparser.h
parenta9fee44bc9f6fb09cdd2585a5649ecf2ad03ecdd (diff)
downloadpdfium-f2f12b32b601f022b5c10fddd8c4d19d00072630.tar.xz
Simplify CPDF_ContentParser.
Do more work in the ctor instead of a separate Start() method. Adjust callers and member variables accordingly. Change-Id: I310f27b3102a89e8e7b7ad31affd174f1fbbe500 Reviewed-on: https://pdfium-review.googlesource.com/17793 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_contentparser.h')
-rw-r--r--core/fpdfapi/page/cpdf_contentparser.h39
1 files changed, 19 insertions, 20 deletions
diff --git a/core/fpdfapi/page/cpdf_contentparser.h b/core/fpdfapi/page/cpdf_contentparser.h
index b1e601a0e1..c4fcb9060b 100644
--- a/core/fpdfapi/page/cpdf_contentparser.h
+++ b/core/fpdfapi/page/cpdf_contentparser.h
@@ -24,22 +24,19 @@ class CPDF_Type3Char;
class CPDF_ContentParser {
public:
- enum ParseStatus { Ready, ToBeContinued, Done };
-
- CPDF_ContentParser();
+ explicit CPDF_ContentParser(CPDF_Page* pPage);
+ CPDF_ContentParser(CPDF_Form* pForm,
+ CPDF_AllStates* pGraphicStates,
+ const CFX_Matrix* pParentMatrix,
+ CPDF_Type3Char* pType3Char,
+ std::set<const uint8_t*>* parsedSet);
~CPDF_ContentParser();
- ParseStatus GetStatus() const { return m_Status; }
const CPDF_AllStates* GetCurStates() const {
return m_pParser ? m_pParser->GetCurStates() : nullptr;
}
- void Start(CPDF_Page* pPage);
- void Start(CPDF_Form* pForm,
- CPDF_AllStates* pGraphicStates,
- const CFX_Matrix* pParentMatrix,
- CPDF_Type3Char* pType3Char,
- std::set<const uint8_t*>* parsedSet);
- void Continue(IFX_PauseIndicator* pPause);
+ // Returns whether to continue or not.
+ bool Continue(IFX_PauseIndicator* pPause);
private:
enum InternalStage {
@@ -48,19 +45,21 @@ class CPDF_ContentParser {
STAGE_CHECKCLIP,
};
- ParseStatus m_Status;
+ bool m_bIsDone = false;
InternalStage m_InternalStage;
- UnownedPtr<CPDF_PageObjectHolder> m_pObjectHolder;
- bool m_bForm;
- UnownedPtr<CPDF_Type3Char> m_pType3Char;
- uint32_t m_nStreams;
+ UnownedPtr<CPDF_PageObjectHolder> const m_pObjectHolder;
+ UnownedPtr<CPDF_Type3Char> m_pType3Char; // Only used when parsing forms.
+ uint32_t m_nStreams = 0;
RetainPtr<CPDF_StreamAcc> m_pSingleStream;
std::vector<RetainPtr<CPDF_StreamAcc>> m_StreamArray;
- uint8_t* m_pData;
- uint32_t m_Size;
- uint32_t m_CurrentOffset;
+ uint8_t* m_pData = nullptr;
+ uint32_t m_Size = 0;
+ uint32_t m_CurrentOffset = 0;
+
+ // Only used when parsing pages.
std::unique_ptr<std::set<const uint8_t*>> m_parsedSet;
- // m_pParser has a reference to m_parsedSet, so must be below and thus
+
+ // |m_pParser| has a reference to |m_parsedSet|, so must be below and thus
// destroyed first.
std::unique_ptr<CPDF_StreamContentParser> m_pParser;
};