diff options
Diffstat (limited to 'core/fpdfapi/page/cpdf_psengine.h')
-rw-r--r-- | core/fpdfapi/page/cpdf_psengine.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/core/fpdfapi/page/cpdf_psengine.h b/core/fpdfapi/page/cpdf_psengine.h index 0d5eadd78e..63d91d0757 100644 --- a/core/fpdfapi/page/cpdf_psengine.h +++ b/core/fpdfapi/page/cpdf_psengine.h @@ -10,10 +10,11 @@ #include <memory> #include <vector> +#include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" class CPDF_PSEngine; -class CPDF_PSOP; +class CPDF_PSProc; class CPDF_SimpleParser; enum PDF_PSOP : uint8_t { @@ -63,6 +64,23 @@ enum PDF_PSOP : uint8_t { PSOP_CONST }; +class CPDF_PSOP { + public: + CPDF_PSOP(); + explicit CPDF_PSOP(PDF_PSOP op); + explicit CPDF_PSOP(float value); + ~CPDF_PSOP(); + + float GetFloatValue() const; + CPDF_PSProc* GetProc() const; + PDF_PSOP GetOp() const { return m_op; } + + private: + const PDF_PSOP m_op; + const float m_value; + std::unique_ptr<CPDF_PSProc> m_proc; +}; + class CPDF_PSProc { public: CPDF_PSProc(); @@ -71,8 +89,18 @@ class CPDF_PSProc { bool Parse(CPDF_SimpleParser* parser, int depth); bool Execute(CPDF_PSEngine* pEngine); + // These methods are exposed for testing. + void AddOperatorForTesting(const ByteStringView& word); + size_t num_operators() const { return m_Operators.size(); } + const std::unique_ptr<CPDF_PSOP>& last_operator() { + return m_Operators.back(); + } + private: static const int kMaxDepth = 128; + + void AddOperator(const ByteStringView& word); + std::vector<std::unique_ptr<CPDF_PSOP>> m_Operators; }; |