summaryrefslogtreecommitdiff
path: root/core/include/fpdfapi/fpdf_parser.h
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-02-16 14:26:22 -0800
committerWei Li <weili@chromium.org>2016-02-16 14:26:22 -0800
commit970c11e2225d73234009ccdc6f656abd01ae4026 (patch)
treec184a4d3b62785ee5431cc2c6d7199103b78986f /core/include/fpdfapi/fpdf_parser.h
parent4f7f4eea92b607ca3864df63e4b277abd5e5af97 (diff)
downloadpdfium-970c11e2225d73234009ccdc6f656abd01ae4026.tar.xz
Refactor CPDF_SimpleParser and add unit tests.
Remove unused member functions and simplify calls to find tag parameters. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1681403007 .
Diffstat (limited to 'core/include/fpdfapi/fpdf_parser.h')
-rw-r--r--core/include/fpdfapi/fpdf_parser.h22
1 files changed, 5 insertions, 17 deletions
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index 18a942e4e8..de32b1fb37 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -212,28 +212,16 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
class CPDF_SimpleParser {
public:
CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize);
-
CPDF_SimpleParser(const CFX_ByteStringC& str);
CFX_ByteStringC GetWord();
- FX_BOOL SearchToken(const CFX_ByteStringC& token);
-
- FX_BOOL SkipWord(const CFX_ByteStringC& token);
-
- FX_BOOL FindTagPair(const CFX_ByteStringC& start_token,
- const CFX_ByteStringC& end_token,
- FX_DWORD& start_pos,
- FX_DWORD& end_pos);
+ // Find the token and its |nParams| parameters from the start of data,
+ // and move the current position to the start of those parameters.
+ bool FindTagParamFromStart(const CFX_ByteStringC& token, int nParams);
- FX_BOOL FindTagParam(const CFX_ByteStringC& token, int nParams);
-
- FX_DWORD GetPos() { return m_dwCurPos; }
-
- void SetPos(FX_DWORD pos) {
- ASSERT(pos <= m_dwSize);
- m_dwCurPos = pos;
- }
+ // For testing only.
+ FX_DWORD GetCurPos() const { return m_dwCurPos; }
private:
void ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize);