From 640d8ffad8536c789103892c7a4e69e5d30172c8 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 10 Jan 2018 16:28:57 +0000 Subject: Make methods which create nodes more obvious This CL converts the various methods Get methods which take a boolean value to explicit Get* and GetOrCreate* methods to make the usage clearer. Change-Id: I2af68448b1b69b95713e739bf7fe14a4336d2b65 Reviewed-on: https://pdfium-review.googlesource.com/22590 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- fxjs/xfa/cjx_object.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'fxjs/xfa/cjx_object.h') diff --git a/fxjs/xfa/cjx_object.h b/fxjs/xfa/cjx_object.h index 87a164ff8b..c252b45036 100644 --- a/fxjs/xfa/cjx_object.h +++ b/fxjs/xfa/cjx_object.h @@ -96,8 +96,15 @@ class CJX_Object { WideString GetContent(bool bScriptModify); template - T* GetProperty(int32_t index, XFA_Element eType, bool bCreateProperty) { - return static_cast(GetPropertyInternal(index, eType, bCreateProperty)); + T* GetProperty(int32_t index, XFA_Element eType) const { + CXFA_Node* node; + int32_t count; + std::tie(node, count) = GetPropertyInternal(index, eType); + return static_cast(node); + } + template + T* GetOrCreateProperty(int32_t index, XFA_Element eType) { + return static_cast(GetOrCreatePropertyInternal(index, eType)); } void SetAttributeValue(const WideString& wsValue, @@ -227,9 +234,9 @@ class CJX_Object { bool bSetting, XFA_Attribute eAttribute); - CXFA_Node* GetPropertyInternal(int32_t index, - XFA_Element eType, - bool bCreateProperty); + std::pair GetPropertyInternal(int32_t index, + XFA_Element eType) const; + CXFA_Node* GetOrCreatePropertyInternal(int32_t index, XFA_Element eType); void OnChanged(XFA_Attribute eAttr, bool bNotify, bool bScriptModify); void OnChanging(XFA_Attribute eAttr, bool bNotify); -- cgit v1.2.3