From d02c4d8b1199799340833ebfc79d7092f9b2d043 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 30 Nov 2017 22:06:40 +0000 Subject: Rename XFA_ATTRIBUTEENUM to XFA_AttributeEnum enum class This CL changes the enum XFA_ATTRIBUTEENUM to an enum class XFA_AttributeEnum. Methods expecting an int32 have been updated to take or return the XFA_AttrbuteEnum type. Change-Id: I268453949545fe2dd3eae707be4d9cc7edeff763 Reviewed-on: https://pdfium-review.googlesource.com/20070 Reviewed-by: Lei Zhang Commit-Queue: dsinclair --- fxjs/cfxjse_engine.cpp | 2 +- fxjs/cfxjse_engine.h | 6 +++--- fxjs/cjx_node.cpp | 16 ++++++++-------- fxjs/cjx_node.h | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'fxjs') diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp index 9eeb9bda89..cd0a3f3c93 100644 --- a/fxjs/cfxjse_engine.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -135,7 +135,7 @@ CFXJSE_Engine::CFXJSE_Engine(CXFA_Document* pDocument, v8::Isolate* pIsolate) m_ResolveProcessor(pdfium::MakeUnique()), m_pThisObject(nullptr), m_dwBuiltInInFlags(0), - m_eRunAtType(XFA_ATTRIBUTEENUM_Client) { + m_eRunAtType(XFA_AttributeEnum::Client) { RemoveBuiltInObjs(m_JsContext.get()); m_JsContext->EnableCompatibleMode(); diff --git a/fxjs/cfxjse_engine.h b/fxjs/cfxjse_engine.h index ae9156f1c4..1409f71001 100644 --- a/fxjs/cfxjse_engine.h +++ b/fxjs/cfxjse_engine.h @@ -52,8 +52,8 @@ class CFXJSE_Engine { void AddNodesOfRunScript(CXFA_Node* pNode); CFXJSE_Class* GetJseNormalClass(); - void SetRunAtType(XFA_ATTRIBUTEENUM eRunAt) { m_eRunAtType = eRunAt; } - bool IsRunAtClient() { return m_eRunAtType != XFA_ATTRIBUTEENUM_Server; } + void SetRunAtType(XFA_AttributeEnum eRunAt) { m_eRunAtType = eRunAt; } + bool IsRunAtClient() { return m_eRunAtType != XFA_AttributeEnum::Server; } bool QueryNodeByFlag(CXFA_Node* refNode, const WideStringView& propname, CFXJSE_Value* pValue, @@ -117,7 +117,7 @@ class CFXJSE_Engine { std::unique_ptr m_FM2JSContext; CXFA_Object* m_pThisObject; uint32_t m_dwBuiltInInFlags; - XFA_ATTRIBUTEENUM m_eRunAtType; + XFA_AttributeEnum m_eRunAtType; }; #endif // FXJS_CFXJSE_ENGINE_H_ diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp index 52cf1d90f2..479bb8fa3d 100644 --- a/fxjs/cjx_node.cpp +++ b/fxjs/cjx_node.cpp @@ -193,7 +193,7 @@ bool CJX_Node::SetAttribute(XFA_Attribute eAttr, XFA_AttributeType eType = GetXFANode()->GetAttributeType(eAttr); switch (eType) { case XFA_AttributeType::Enum: { - pdfium::Optional item = + pdfium::Optional item = CXFA_Node::NameToAttributeEnum(wsValue); return SetEnum(eAttr, item ? *item : *(GetXFANode()->GetDefaultEnum(eAttr)), @@ -241,7 +241,7 @@ pdfium::Optional CJX_Node::TryAttribute(XFA_Attribute eAttr, XFA_AttributeType eType = GetXFANode()->GetAttributeType(eAttr); switch (eType) { case XFA_AttributeType::Enum: { - pdfium::Optional value = TryEnum(eAttr, bUseDefault); + pdfium::Optional value = TryEnum(eAttr, bUseDefault); if (!value) return {}; @@ -2982,13 +2982,13 @@ pdfium::Optional CJX_Node::TryInteger(XFA_Attribute eAttr, return GetXFANode()->GetDefaultInteger(eAttr); } -pdfium::Optional CJX_Node::TryEnum(XFA_Attribute eAttr, +pdfium::Optional CJX_Node::TryEnum(XFA_Attribute eAttr, bool bUseDefault) { void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr); void* pValue = nullptr; if (GetMapModuleValue(pKey, pValue)) { return { - static_cast(reinterpret_cast(pValue))}; + static_cast(reinterpret_cast(pValue))}; } if (!bUseDefault) return {}; @@ -2997,7 +2997,7 @@ pdfium::Optional CJX_Node::TryEnum(XFA_Attribute eAttr, } bool CJX_Node::SetEnum(XFA_Attribute eAttr, - XFA_ATTRIBUTEENUM eValue, + XFA_AttributeEnum eValue, bool bNotify) { CFX_XMLElement* elem = SetValue(eAttr, XFA_AttributeType::Enum, (void*)(uintptr_t)eValue, bNotify); @@ -3008,8 +3008,8 @@ bool CJX_Node::SetEnum(XFA_Attribute eAttr, return true; } -XFA_ATTRIBUTEENUM CJX_Node::GetEnum(XFA_Attribute eAttr) { - return TryEnum(eAttr, true).value_or(XFA_ATTRIBUTEENUM_Unknown); +XFA_AttributeEnum CJX_Node::GetEnum(XFA_Attribute eAttr) { + return TryEnum(eAttr, true).value_or(XFA_AttributeEnum::Unknown); } bool CJX_Node::SetMeasure(XFA_Attribute eAttr, @@ -3507,7 +3507,7 @@ pdfium::Optional CJX_Node::TryNamespace() { return {}; if (GetXFANode()->GetElementType() == XFA_Element::DataValue && - GetEnum(XFA_Attribute::Contains) == XFA_ATTRIBUTEENUM_MetaData) { + GetEnum(XFA_Attribute::Contains) == XFA_AttributeEnum::MetaData) { WideString wsNamespace; bool ret = XFA_FDEExtension_ResolveNamespaceQualifier( static_cast(pXMLNode), diff --git a/fxjs/cjx_node.h b/fxjs/cjx_node.h index a860db9155..ba1d7523bd 100644 --- a/fxjs/cjx_node.h +++ b/fxjs/cjx_node.h @@ -89,10 +89,10 @@ class CJX_Node : public CJX_Object { bool bScriptModify); WideString GetCData(XFA_Attribute eAttr); - pdfium::Optional TryEnum(XFA_Attribute eAttr, + pdfium::Optional TryEnum(XFA_Attribute eAttr, bool bUseDefault); - bool SetEnum(XFA_Attribute eAttr, XFA_ATTRIBUTEENUM eValue, bool bNotify); - XFA_ATTRIBUTEENUM GetEnum(XFA_Attribute eAttr); + bool SetEnum(XFA_Attribute eAttr, XFA_AttributeEnum eValue, bool bNotify); + XFA_AttributeEnum GetEnum(XFA_Attribute eAttr); pdfium::Optional TryBoolean(XFA_Attribute eAttr, bool bUseDefault); bool SetBoolean(XFA_Attribute eAttr, bool bValue, bool bNotify); -- cgit v1.2.3