diff options
author | Lei Zhang <thestig@chromium.org> | 2016-02-25 14:35:23 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2016-02-25 14:35:23 -0800 |
commit | f8e21f34e9b67c5b9e754e949c58a5113ea4d746 (patch) | |
tree | d6d2c774ae099320c41fab43cfa4857f1274aa25 | |
parent | 198362223d2257ded96895bd91df2bea422f361e (diff) | |
download | pdfium-f8e21f34e9b67c5b9e754e949c58a5113ea4d746.tar.xz |
Use std::lower_bound() in a couple places.
Do some cleanups along the way.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1732223002 .
-rw-r--r-- | core/src/fxge/ge/fx_ge_fontmap.cpp | 43 | ||||
-rw-r--r-- | xfa/src/fgas/src/localization/fx_locale.cpp | 25 | ||||
-rw-r--r-- | xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp | 99 | ||||
-rw-r--r-- | xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h | 141 |
4 files changed, 155 insertions, 153 deletions
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index b9850f85db..06b58ea3ab 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -4,6 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include <algorithm> #include <limits> #include <vector> @@ -197,17 +198,17 @@ const struct FX_FontStyle { {"Bold", 4}, {"Italic", 6}, {"BoldItalic", 10}, {"Reg", 3}, {"Regular", 7}, }; -const struct CHARSET_MAP { - uint8_t charset; +const struct CODEPAGE_MAP { FX_WORD codepage; + uint8_t charset; } g_Codepage2CharsetTable[] = { - {1, 0}, {2, 42}, {254, 437}, {255, 850}, {222, 874}, - {128, 932}, {134, 936}, {129, 949}, {136, 950}, {238, 1250}, - {204, 1251}, {0, 1252}, {161, 1253}, {162, 1254}, {177, 1255}, - {178, 1256}, {186, 1257}, {163, 1258}, {130, 1361}, {77, 10000}, - {78, 10001}, {79, 10003}, {80, 10008}, {81, 10002}, {83, 10005}, - {84, 10004}, {85, 10006}, {86, 10081}, {87, 10021}, {88, 10029}, - {89, 10007}, + {0, 1}, {42, 2}, {437, 254}, {850, 255}, {874, 222}, + {932, 128}, {936, 134}, {949, 129}, {950, 136}, {1250, 238}, + {1251, 204}, {1252, 0}, {1253, 161}, {1254, 162}, {1255, 177}, + {1256, 178}, {1257, 186}, {1258, 163}, {1361, 130}, {10000, 77}, + {10001, 78}, {10002, 81}, {10003, 79}, {10004, 84}, {10005, 83}, + {10006, 85}, {10007, 89}, {10008, 80}, {10021, 87}, {10029, 88}, + {10081, 86}, }; const FX_DWORD kTableNAME = FXDWORD_GET_MSBFIRST("name"); @@ -281,21 +282,15 @@ CFX_ByteString FPDF_LoadTableFromTT(FXSYS_FILE* pFile, } uint8_t GetCharsetFromCodePage(FX_WORD codepage) { - int32_t iEnd = sizeof(g_Codepage2CharsetTable) / sizeof(CHARSET_MAP) - 1; - FXSYS_assert(iEnd >= 0); - int32_t iStart = 0, iMid; - do { - iMid = (iStart + iEnd) / 2; - const CHARSET_MAP& cp = g_Codepage2CharsetTable[iMid]; - if (codepage == cp.codepage) { - return cp.charset; - } - if (codepage < cp.codepage) { - iEnd = iMid - 1; - } else { - iStart = iMid + 1; - } - } while (iStart <= iEnd); + const CODEPAGE_MAP* pEnd = + g_Codepage2CharsetTable + FX_ArraySize(g_Codepage2CharsetTable); + const CODEPAGE_MAP* pCharmap = + std::lower_bound(g_Codepage2CharsetTable, pEnd, codepage, + [](const CODEPAGE_MAP& charset, FX_WORD page) { + return charset.codepage < page; + }); + if (pCharmap < pEnd && codepage == pCharmap->codepage) + return pCharmap->charset; return 1; } diff --git a/xfa/src/fgas/src/localization/fx_locale.cpp b/xfa/src/fgas/src/localization/fx_locale.cpp index 46eeae0c4f..ca12dbb69e 100644 --- a/xfa/src/fgas/src/localization/fx_locale.cpp +++ b/xfa/src/fgas/src/localization/fx_locale.cpp @@ -55,8 +55,6 @@ static const FX_LOCALETIMEZONEINFO g_FXLocaleTimeZoneData[] = { {FXBSTR_ID(0, 'M', 'D', 'T'), -6, 0}, {FXBSTR_ID(0, 'M', 'S', 'T'), -7, 0}, {FXBSTR_ID(0, 'P', 'D', 'T'), -7, 0}, {FXBSTR_ID(0, 'P', 'S', 'T'), -8, 0}, }; -static const int32_t g_iFXLocaleTimeZoneCount = - sizeof(g_FXLocaleTimeZoneData) / sizeof(FX_LOCALETIMEZONEINFO); static const CFX_WideStringC gs_wsTextSymbols = FX_WSTRC(L"AXO09"); static const CFX_WideStringC gs_wsTimeSymbols = FX_WSTRC(L"hHkKMSFAzZ"); @@ -2771,22 +2769,13 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, } FX_ResolveZone(hour, minute, tzDiff, pLocale); } else { - const FX_LOCALETIMEZONEINFO* pTimeZoneInfo = NULL; - int32_t iStart = 0; - int32_t iEnd = g_iFXLocaleTimeZoneCount - 1; - do { - int32_t iMid = (iStart + iEnd) / 2; - const FX_LOCALETIMEZONEINFO* pInfo = g_FXLocaleTimeZoneData + iMid; - if (dwHash == pInfo->uHash) { - pTimeZoneInfo = pInfo; - break; - } else if (dwHash < pInfo->uHash) { - iEnd = iMid - 1; - } else { - iStart = iMid + 1; - } - } while (iStart <= iEnd); - if (pTimeZoneInfo) { + const FX_LOCALETIMEZONEINFO* pEnd = + g_FXLocaleTimeZoneData + FX_ArraySize(g_FXLocaleTimeZoneData); + const FX_LOCALETIMEZONEINFO* pTimeZoneInfo = + std::lower_bound(g_FXLocaleTimeZoneData, pEnd, dwHash, + [](const FX_LOCALETIMEZONEINFO& info, + FX_DWORD hash) { return info.uHash < hash; }); + if (pTimeZoneInfo < pEnd && dwHash == pTimeZoneInfo->uHash) { hour += pTimeZoneInfo->iHour; minute += pTimeZoneInfo->iHour > 0 ? pTimeZoneInfo->iMinute : -pTimeZoneInfo->iMinute; diff --git a/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp b/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp index b0ce3ad4ca..68faa7ae0c 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp +++ b/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.cpp @@ -5,7 +5,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "xfa/src/fxfa/src/fm2js/xfa_fm2js.h" -static CFX_WideStringC gs_lpStrExpFuncName[] = { + +namespace { + +const CFX_WideStringC gs_lpStrExpFuncName[] = { FX_WSTRC(L"foxit_xfa_formcalc_runtime.assign_value_operator"), FX_WSTRC(L"foxit_xfa_formcalc_runtime.logical_or_operator"), FX_WSTRC(L"foxit_xfa_formcalc_runtime.logical_and_operator"), @@ -32,11 +35,12 @@ static CFX_WideStringC gs_lpStrExpFuncName[] = { FX_WSTRC(L"foxit_xfa_formcalc_runtime.get_fm_jsobj"), FX_WSTRC(L"foxit_xfa_formcalc_runtime.fm_var_filter"), }; -CFX_WideStringC XFA_FM_EXPTypeToString( - XFA_FM_SimpleExpressionType simpleExpType) { - return gs_lpStrExpFuncName[simpleExpType]; -} -static XFA_FMBuildInFunc buildInFuncs[] = { + +struct XFA_FMBuildInFunc { + uint32_t m_uHash; + const FX_WCHAR* m_buildinfunc; +}; +const XFA_FMBuildInFunc g_BuildInFuncs[] = { {0x0001f1f5, L"At"}, {0x00020b9c, L"FV"}, {0x00021aef, L"If"}, {0x00023ee6, L"PV"}, {0x04b5c9ee, L"Encode"}, {0x08e96685, L"DateFmt"}, @@ -71,7 +75,13 @@ static XFA_FMBuildInFunc buildInFuncs[] = { {0xea18d121, L"Choose"}, {0xebfef69c, L"Replace"}, {0xf5ad782b, L"Left"}, {0xf7bb2248, L"Ltrim"}, }; -static const XFA_FMSOMMethod gs_FMSomMethods[] = { + +struct XFA_FMSOMMethod { + uint32_t m_uHash; + const FX_WCHAR* m_wsSomMethodName; + FX_DWORD m_dParameters; +}; +const XFA_FMSOMMethod gs_FMSomMethods[] = { {0x00000068, L"h", 0x01}, {0x00000077, L"w", 0x01}, {0x00000078, L"x", 0x01}, @@ -94,6 +104,14 @@ static const XFA_FMSOMMethod gs_FMSomMethods[] = { {0xda12e518, L"append", 0x01}, {0xe74f0653, L"absPage", 0x01}, }; + +} // namespace + +CFX_WideStringC XFA_FM_EXPTypeToString( + XFA_FM_SimpleExpressionType simpleExpType) { + return gs_lpStrExpFuncName[simpleExpType]; +} + CXFA_FMSimpleExpression::CXFA_FMSimpleExpression(FX_DWORD line, XFA_FM_TOKEN op) : m_line(line), m_op(op) {} void CXFA_FMSimpleExpression::ToJavaScript(CFX_WideTextBuf& javascript) {} @@ -174,10 +192,7 @@ CXFA_FMUnaryExpression::CXFA_FMUnaryExpression(FX_DWORD line, CXFA_FMSimpleExpression* pExp) : CXFA_FMSimpleExpression(line, op), m_pExp(pExp) {} CXFA_FMUnaryExpression::~CXFA_FMUnaryExpression() { - if (m_pExp != 0) { - delete m_pExp; - m_pExp = 0; - } + delete m_pExp; } void CXFA_FMUnaryExpression::ToJavaScript(CFX_WideTextBuf& javascript) {} CXFA_FMBinExpression::CXFA_FMBinExpression(FX_DWORD line, @@ -186,14 +201,8 @@ CXFA_FMBinExpression::CXFA_FMBinExpression(FX_DWORD line, CXFA_FMSimpleExpression* pExp2) : CXFA_FMSimpleExpression(line, op), m_pExp1(pExp1), m_pExp2(pExp2) {} CXFA_FMBinExpression::~CXFA_FMBinExpression() { - if (m_pExp1 != 0) { - delete m_pExp1; - m_pExp1 = 0; - } - if (m_pExp2 != 0) { - delete m_pExp2; - m_pExp2 = 0; - } + delete m_pExp1; + delete m_pExp2; } void CXFA_FMBinExpression::ToJavaScript(CFX_WideTextBuf& javascript) {} CXFA_FMAssignExpression::CXFA_FMAssignExpression(FX_DWORD line, @@ -446,29 +455,25 @@ CXFA_FMCallExpression::~CXFA_FMCallExpression() { m_pArguments = 0; } } -FX_BOOL CXFA_FMCallExpression::IsBuildInFunc(CFX_WideTextBuf& funcName) { - uint32_t uHash = - FX_HashCode_String_GetW(funcName.GetBuffer(), funcName.GetLength(), TRUE); - XFA_FMBuildInFunc buildinfunction; - int32_t iStart = 0, - iEnd = (sizeof(buildInFuncs) / sizeof(buildInFuncs[0])) - 1; - int32_t iMid = (iStart + iEnd) / 2; - do { - iMid = (iStart + iEnd) / 2; - buildinfunction = buildInFuncs[iMid]; - if (uHash == buildinfunction.m_uHash) { - funcName.Clear(); - funcName << buildinfunction.m_buildinfunc; - return TRUE; - } else if (uHash < buildinfunction.m_uHash) { - iEnd = iMid - 1; - } else { - iStart = iMid + 1; - } - } while (iStart <= iEnd); - return FALSE; + +bool CXFA_FMCallExpression::IsBuildInFunc(CFX_WideTextBuf* funcName) { + uint32_t uHash = FX_HashCode_String_GetW(funcName->GetBuffer(), + funcName->GetLength(), TRUE); + const XFA_FMBuildInFunc* pEnd = g_BuildInFuncs + FX_ArraySize(g_BuildInFuncs); + const XFA_FMBuildInFunc* pFunc = + std::lower_bound(g_BuildInFuncs, pEnd, uHash, + [](const XFA_FMBuildInFunc& func, uint32_t hash) { + return func.m_uHash < hash; + }); + if (pFunc < pEnd && uHash == pFunc->m_uHash) { + funcName->Clear(); + *funcName << pFunc->m_buildinfunc; + return true; + } + return false; } -FX_DWORD CXFA_FMCallExpression::IsSomMethodWithObjPara( + +FX_DWORD CXFA_FMCallExpression::IsMethodWithObjParam( const CFX_WideStringC& methodName) { int32_t iLength = methodName.GetLength(); uint32_t uHash = FX_HashCode_String_GetW(methodName.GetPtr(), iLength); @@ -500,7 +505,7 @@ void CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) { if (m_pArguments) { int32_t argc = m_pArguments->GetSize(); int32_t index = 0; - FX_DWORD methodPara = IsSomMethodWithObjPara(funcName.GetWideString()); + FX_DWORD methodPara = IsMethodWithObjParam(funcName.GetWideString()); if (methodPara > 0) { CXFA_FMSimpleExpression* e = 0; while (index < argc) { @@ -535,16 +540,16 @@ void CXFA_FMCallExpression::ToJavaScript(CFX_WideTextBuf& javascript) { } javascript << FX_WSTRC(L")"); } else { - FX_BOOL isEvalFunc = FALSE; - FX_BOOL isExistsFunc = FALSE; - if (IsBuildInFunc(funcName)) { + bool isEvalFunc = false; + bool isExistsFunc = false; + if (IsBuildInFunc(&funcName)) { if (funcName.GetWideString() == FX_WSTRC(L"Eval")) { - isEvalFunc = TRUE; + isEvalFunc = true; javascript << FX_WSTRC(L"eval.call(this, "); javascript << gs_lpStrExpFuncName[CALL]; javascript << FX_WSTRC(L"Translate"); } else if (funcName.GetWideString() == FX_WSTRC(L"Exists")) { - isExistsFunc = TRUE; + isExistsFunc = true; javascript << gs_lpStrExpFuncName[CALL]; javascript << funcName; } else { diff --git a/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h b/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h index f474004300..2fb9b8fc1c 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h +++ b/xfa/src/fxfa/src/fm2js/xfa_simpleexpression.h @@ -36,27 +36,21 @@ enum XFA_FM_SimpleExpressionType { GETFMJSOBJ, VARFILTER }; + CFX_WideStringC XFA_FM_EXPTypeToString( XFA_FM_SimpleExpressionType simpleExpType); -struct XFA_FMBuildInFunc { - uint32_t m_uHash; - const FX_WCHAR* m_buildinfunc; -}; -struct XFA_FMSOMMethod { - uint32_t m_uHash; - const FX_WCHAR* m_wsSomMethodName; - FX_DWORD m_dParameters; -}; + enum XFA_FM_AccessorIndex { ACCESSOR_NO_INDEX, ACCESSOR_NO_RELATIVEINDEX, ACCESSOR_POSITIVE_INDEX, ACCESSOR_NEGATIVE_INDEX }; + class CXFA_FMSimpleExpression { public: CXFA_FMSimpleExpression(FX_DWORD line, XFA_FM_TOKEN op); - virtual ~CXFA_FMSimpleExpression(){}; + virtual ~CXFA_FMSimpleExpression() {} virtual void ToJavaScript(CFX_WideTextBuf& javascript); virtual void ToImpliedReturnJS(CFX_WideTextBuf& javascript); @@ -66,160 +60,178 @@ class CXFA_FMSimpleExpression { FX_DWORD m_line; XFA_FM_TOKEN m_op; }; + class CXFA_FMNullExpression : public CXFA_FMSimpleExpression { public: - CXFA_FMNullExpression(FX_DWORD line); - virtual ~CXFA_FMNullExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + explicit CXFA_FMNullExpression(FX_DWORD line); + ~CXFA_FMNullExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; }; + class CXFA_FMNumberExpression : public CXFA_FMSimpleExpression { public: CXFA_FMNumberExpression(FX_DWORD line, CFX_WideStringC wsNumber); - virtual ~CXFA_FMNumberExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMNumberExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; - protected: + private: CFX_WideStringC m_wsNumber; }; + class CXFA_FMStringExpression : public CXFA_FMSimpleExpression { public: CXFA_FMStringExpression(FX_DWORD line, CFX_WideStringC wsString); - virtual ~CXFA_FMStringExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMStringExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; - protected: + private: CFX_WideStringC m_wsString; }; + class CXFA_FMIdentifierExpressionn : public CXFA_FMSimpleExpression { public: CXFA_FMIdentifierExpressionn(FX_DWORD line, CFX_WideStringC wsIdentifier); - virtual ~CXFA_FMIdentifierExpressionn(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMIdentifierExpressionn() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; - protected: + private: CFX_WideStringC m_wsIdentifier; }; + class CXFA_FMUnaryExpression : public CXFA_FMSimpleExpression { public: CXFA_FMUnaryExpression(FX_DWORD line, XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp); - virtual ~CXFA_FMUnaryExpression(); - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMUnaryExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; protected: CXFA_FMSimpleExpression* m_pExp; }; + class CXFA_FMBinExpression : public CXFA_FMSimpleExpression { public: CXFA_FMBinExpression(FX_DWORD line, XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp1, CXFA_FMSimpleExpression* pExp2); - virtual ~CXFA_FMBinExpression(); - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMBinExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; protected: CXFA_FMSimpleExpression* m_pExp1; CXFA_FMSimpleExpression* m_pExp2; }; + class CXFA_FMAssignExpression : public CXFA_FMBinExpression { public: CXFA_FMAssignExpression(FX_DWORD line, XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp1, CXFA_FMSimpleExpression* pExp2); - virtual ~CXFA_FMAssignExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); - virtual void ToImpliedReturnJS(CFX_WideTextBuf& javascript); + ~CXFA_FMAssignExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; + void ToImpliedReturnJS(CFX_WideTextBuf& javascript) override; }; + class CXFA_FMLogicalOrExpression : public CXFA_FMBinExpression { public: CXFA_FMLogicalOrExpression(FX_DWORD line, XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp1, CXFA_FMSimpleExpression* pExp2); - virtual ~CXFA_FMLogicalOrExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMLogicalOrExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; }; + class CXFA_FMLogicalAndExpression : public CXFA_FMBinExpression { public: CXFA_FMLogicalAndExpression(FX_DWORD line, XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp1, CXFA_FMSimpleExpression* pExp2); - virtual ~CXFA_FMLogicalAndExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMLogicalAndExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; }; + class CXFA_FMEqualityExpression : public CXFA_FMBinExpression { public: CXFA_FMEqualityExpression(FX_DWORD line, XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp1, CXFA_FMSimpleExpression* pExp2); - virtual ~CXFA_FMEqualityExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMEqualityExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; }; + class CXFA_FMRelationalExpression : public CXFA_FMBinExpression { public: CXFA_FMRelationalExpression(FX_DWORD line, XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp1, CXFA_FMSimpleExpression* pExp2); - virtual ~CXFA_FMRelationalExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMRelationalExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; }; + class CXFA_FMAdditiveExpression : public CXFA_FMBinExpression { public: CXFA_FMAdditiveExpression(FX_DWORD line, XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp1, CXFA_FMSimpleExpression* pExp2); - virtual ~CXFA_FMAdditiveExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMAdditiveExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; }; + class CXFA_FMMultiplicativeExpression : public CXFA_FMBinExpression { public: CXFA_FMMultiplicativeExpression(FX_DWORD line, XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp1, CXFA_FMSimpleExpression* pExp2); - virtual ~CXFA_FMMultiplicativeExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMMultiplicativeExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; }; + class CXFA_FMPosExpression : public CXFA_FMUnaryExpression { public: CXFA_FMPosExpression(FX_DWORD line, CXFA_FMSimpleExpression* pExp); - virtual ~CXFA_FMPosExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMPosExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; }; + class CXFA_FMNegExpression : public CXFA_FMUnaryExpression { public: CXFA_FMNegExpression(FX_DWORD line, CXFA_FMSimpleExpression* pExp); - virtual ~CXFA_FMNegExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMNegExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; }; + class CXFA_FMNotExpression : public CXFA_FMUnaryExpression { public: CXFA_FMNotExpression(FX_DWORD line, CXFA_FMSimpleExpression* pExp); - virtual ~CXFA_FMNotExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMNotExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; }; + class CXFA_FMCallExpression : public CXFA_FMUnaryExpression { public: CXFA_FMCallExpression(FX_DWORD line, CXFA_FMSimpleExpression* pExp, CFX_PtrArray* pArguments, FX_BOOL bIsSomMethod); - virtual ~CXFA_FMCallExpression(); - virtual FX_BOOL IsBuildInFunc(CFX_WideTextBuf& funcName); - virtual FX_DWORD IsSomMethodWithObjPara(const CFX_WideStringC& methodName); - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMCallExpression() override; + bool IsBuildInFunc(CFX_WideTextBuf* funcName); + FX_DWORD IsMethodWithObjParam(const CFX_WideStringC& methodName); + void ToJavaScript(CFX_WideTextBuf& javascript) override; private: FX_BOOL m_bIsSomMethod; CFX_PtrArray* m_pArguments; }; + class CXFA_FMDotAccessorExpression : public CXFA_FMBinExpression { public: CXFA_FMDotAccessorExpression(FX_DWORD line, @@ -227,25 +239,27 @@ class CXFA_FMDotAccessorExpression : public CXFA_FMBinExpression { XFA_FM_TOKEN op, CFX_WideStringC wsIdentifier, CXFA_FMSimpleExpression* pIndexExp); - virtual ~CXFA_FMDotAccessorExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMDotAccessorExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; - protected: + private: CFX_WideStringC m_wsIdentifier; }; + class CXFA_FMIndexExpression : public CXFA_FMUnaryExpression { public: CXFA_FMIndexExpression(FX_DWORD line, XFA_FM_AccessorIndex accessorIndex, CXFA_FMSimpleExpression* pIndexExp, FX_BOOL bIsStarIndex); - virtual ~CXFA_FMIndexExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMIndexExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; - protected: + private: XFA_FM_AccessorIndex m_accessorIndex; FX_BOOL m_bIsStarIndex; }; + class CXFA_FMDotDotAccessorExpression : public CXFA_FMBinExpression { public: CXFA_FMDotDotAccessorExpression(FX_DWORD line, @@ -253,21 +267,20 @@ class CXFA_FMDotDotAccessorExpression : public CXFA_FMBinExpression { XFA_FM_TOKEN op, CFX_WideStringC wsIdentifier, CXFA_FMSimpleExpression* pIndexExp); - virtual ~CXFA_FMDotDotAccessorExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); + ~CXFA_FMDotDotAccessorExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; - protected: + private: CFX_WideStringC m_wsIdentifier; }; + class CXFA_FMMethodCallExpression : public CXFA_FMBinExpression { public: CXFA_FMMethodCallExpression(FX_DWORD line, CXFA_FMSimpleExpression* pAccessorExp1, CXFA_FMSimpleExpression* pCallExp); - virtual ~CXFA_FMMethodCallExpression(){}; - virtual void ToJavaScript(CFX_WideTextBuf& javascript); - - protected: + ~CXFA_FMMethodCallExpression() override {} + void ToJavaScript(CFX_WideTextBuf& javascript) override; }; #endif // XFA_SRC_FXFA_SRC_FM2JS_XFA_SIMPLEEXPRESSION_H_ |