diff options
Diffstat (limited to 'xfa/fde/css/fde_cssdatatable.h')
-rw-r--r-- | xfa/fde/css/fde_cssdatatable.h | 76 |
1 files changed, 25 insertions, 51 deletions
diff --git a/xfa/fde/css/fde_cssdatatable.h b/xfa/fde/css/fde_cssdatatable.h index d61ff09ae7..252efdce50 100644 --- a/xfa/fde/css/fde_cssdatatable.h +++ b/xfa/fde/css/fde_cssdatatable.h @@ -27,56 +27,26 @@ class CFDE_CSSFunction : public CFX_Target { IFDE_CSSValueList* m_pArgList; const FX_WCHAR* m_pszFuncName; }; + class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue, public CFX_Target { public: - CFDE_CSSPrimitiveValue(const CFDE_CSSPrimitiveValue& src) { *this = src; } - CFDE_CSSPrimitiveValue(FX_ARGB color) - : m_eType(FDE_CSSPRIMITIVETYPE_RGB), m_dwColor(color) {} - CFDE_CSSPrimitiveValue(FDE_CSSPROPERTYVALUE eValue) - : m_eType(FDE_CSSPRIMITIVETYPE_Enum), m_eEnum(eValue) {} - CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, FX_FLOAT fValue) - : m_eType(eType), m_fNumber(fValue) {} - CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, const FX_WCHAR* pValue) - : m_eType(eType), m_pString(pValue) { - ASSERT(m_pString); - } - CFDE_CSSPrimitiveValue(CFDE_CSSFunction* pFunction) - : m_eType(FDE_CSSPRIMITIVETYPE_Function), m_pFunction(pFunction) {} - - virtual FDE_CSSPRIMITIVETYPE GetPrimitiveType() const { return m_eType; } - - virtual FX_ARGB GetRGBColor() const { - ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_RGB); - return m_dwColor; - } - virtual FX_FLOAT GetFloat() const { - ASSERT(m_eType >= FDE_CSSPRIMITIVETYPE_Number && - m_eType <= FDE_CSSPRIMITIVETYPE_PC); - return m_fNumber; - } - virtual const FX_WCHAR* GetString(int32_t& iLength) const { - ASSERT(m_eType >= FDE_CSSPRIMITIVETYPE_String && - m_eType <= FDE_CSSPRIMITIVETYPE_URI); - iLength = FXSYS_wcslen(m_pString); - return m_pString; - } - virtual FDE_CSSPROPERTYVALUE GetEnum() const { - ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Enum); - return m_eEnum; - } - virtual const FX_WCHAR* GetFuncName() const { - ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function); - return m_pFunction->GetFuncName(); - } - virtual int32_t CountArgs() const { - ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function); - return m_pFunction->CountArgs(); - } - virtual IFDE_CSSValue* GetArgs(int32_t index) const { - ASSERT(m_eType == FDE_CSSPRIMITIVETYPE_Function); - return m_pFunction->GetArgs(index); - } + explicit CFDE_CSSPrimitiveValue(FX_ARGB color); + explicit CFDE_CSSPrimitiveValue(FDE_CSSPROPERTYVALUE eValue); + explicit CFDE_CSSPrimitiveValue(CFDE_CSSFunction* pFunction); + CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, FX_FLOAT fValue); + CFDE_CSSPrimitiveValue(FDE_CSSPRIMITIVETYPE eType, const FX_WCHAR* pValue); + CFDE_CSSPrimitiveValue(const CFDE_CSSPrimitiveValue& src); + + // IFDE_CSSPrimitiveValue + FDE_CSSPRIMITIVETYPE GetPrimitiveType() const override; + FX_ARGB GetRGBColor() const override; + FX_FLOAT GetFloat() const override; + const FX_WCHAR* GetString(int32_t& iLength) const override; + FDE_CSSPROPERTYVALUE GetEnum() const override; + const FX_WCHAR* GetFuncName() const override; + int32_t CountArgs() const override; + IFDE_CSSValue* GetArgs(int32_t index) const override; FDE_CSSPRIMITIVETYPE m_eType; union { @@ -87,21 +57,24 @@ class CFDE_CSSPrimitiveValue : public IFDE_CSSPrimitiveValue, CFDE_CSSFunction* m_pFunction; }; }; + typedef CFX_ArrayTemplate<IFDE_CSSPrimitiveValue*> CFDE_CSSPrimitiveArray; typedef CFX_ArrayTemplate<IFDE_CSSValue*> CFDE_CSSValueArray; + class CFDE_CSSValueList : public IFDE_CSSValueList, public CFX_Target { public: CFDE_CSSValueList(IFX_MemoryAllocator* pStaticStore, const CFDE_CSSValueArray& list); - virtual int32_t CountValues() const { return m_iCount; } - virtual IFDE_CSSValue* GetValue(int32_t index) const { - return m_ppList[index]; - } + + // IFDE_CSSValueList + int32_t CountValues() const override; + IFDE_CSSValue* GetValue(int32_t index) const override; protected: IFDE_CSSValue** m_ppList; int32_t m_iCount; }; + class CFDE_CSSValueListParser : public CFX_Target { public: CFDE_CSSValueListParser(const FX_WCHAR* psz, int32_t iLen, FX_WCHAR separator) @@ -117,6 +90,7 @@ class CFDE_CSSValueListParser : public CFX_Target { int32_t SkipTo(FX_WCHAR wch, FX_BOOL bWSSeparator = FALSE, FX_BOOL bBrContinue = FALSE); + const FX_WCHAR* m_pCur; const FX_WCHAR* m_pEnd; }; |