From f45406f8ec992560353756cff1e2c3931984e62b Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 2 Nov 2017 17:50:58 +0000 Subject: Move CJX_Node definitions to cpp file This CL moves some method bodies from the .h to the .cpp file. This makes the .h file a lot easier to read. Change-Id: Ia6366d3b8dcfdb1b626814577fd93b027250474c Reviewed-on: https://pdfium-review.googlesource.com/17430 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- fxjs/cjx_node.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'fxjs/cjx_node.cpp') diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp index 929a946c09..64894b7c7e 100644 --- a/fxjs/cjx_node.cpp +++ b/fxjs/cjx_node.cpp @@ -2943,6 +2943,26 @@ bool CJX_Node::TryBoolean(XFA_ATTRIBUTE eAttr, bool& bValue, bool bUseDefault) { return true; } +bool CJX_Node::SetBoolean(XFA_ATTRIBUTE eAttr, bool bValue, bool bNotify) { + return SetValue(eAttr, XFA_ATTRIBUTETYPE_Boolean, (void*)(uintptr_t)bValue, + bNotify); +} + +bool CJX_Node::GetBoolean(XFA_ATTRIBUTE eAttr) { + bool bValue; + return TryBoolean(eAttr, bValue, true) ? bValue : false; +} + +bool CJX_Node::SetInteger(XFA_ATTRIBUTE eAttr, int32_t iValue, bool bNotify) { + return SetValue(eAttr, XFA_ATTRIBUTETYPE_Integer, (void*)(uintptr_t)iValue, + bNotify); +} + +int32_t CJX_Node::GetInteger(XFA_ATTRIBUTE eAttr) { + int32_t iValue; + return TryInteger(eAttr, iValue, true) ? iValue : 0; +} + bool CJX_Node::TryInteger(XFA_ATTRIBUTE eAttr, int32_t& iValue, bool bUseDefault) { @@ -2963,6 +2983,18 @@ bool CJX_Node::TryEnum(XFA_ATTRIBUTE eAttr, return true; } +bool CJX_Node::SetEnum(XFA_ATTRIBUTE eAttr, + XFA_ATTRIBUTEENUM eValue, + bool bNotify) { + return SetValue(eAttr, XFA_ATTRIBUTETYPE_Enum, (void*)(uintptr_t)eValue, + bNotify); +} + +XFA_ATTRIBUTEENUM CJX_Node::GetEnum(XFA_ATTRIBUTE eAttr) { + XFA_ATTRIBUTEENUM eValue; + return TryEnum(eAttr, eValue, true) ? eValue : XFA_ATTRIBUTEENUM_Unknown; +} + bool CJX_Node::SetMeasure(XFA_ATTRIBUTE eAttr, CXFA_Measurement mValue, bool bNotify) { @@ -2998,6 +3030,11 @@ CXFA_Measurement CJX_Node::GetMeasure(XFA_ATTRIBUTE eAttr) const { return TryMeasure(eAttr, mValue, true) ? mValue : CXFA_Measurement(); } +WideStringView CJX_Node::GetCData(XFA_ATTRIBUTE eAttr) { + WideStringView wsValue; + return TryCData(eAttr, wsValue) ? wsValue : WideStringView(); +} + bool CJX_Node::SetCData(XFA_ATTRIBUTE eAttr, const WideString& wsValue, bool bNotify, @@ -3195,6 +3232,11 @@ bool CJX_Node::SetObject(XFA_ATTRIBUTE eAttr, return SetUserData(pKey, pData, pCallbackInfo); } +void* CJX_Node::GetObject(XFA_ATTRIBUTE eAttr) { + void* pData; + return TryObject(eAttr, pData) ? pData : nullptr; +} + bool CJX_Node::TryObject(XFA_ATTRIBUTE eAttr, void*& pData) { void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr); pData = GetUserData(pKey); @@ -3257,6 +3299,11 @@ bool CJX_Node::GetValue(XFA_ATTRIBUTE eAttr, GetXFANode()->GetPacketID()); } +void* CJX_Node::GetUserData(void* pKey, bool bProtoAlso) { + void* pData; + return TryUserData(pKey, pData, bProtoAlso) ? pData : nullptr; +} + bool CJX_Node::SetUserData(void* pKey, void* pData, XFA_MAPDATABLOCKCALLBACKINFO* pCallbackInfo) { -- cgit v1.2.3