summaryrefslogtreecommitdiff
path: root/fxjs/xfa/cjx_object.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-10 16:28:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-10 16:28:57 +0000
commit640d8ffad8536c789103892c7a4e69e5d30172c8 (patch)
treeebd3f4013383a2319c95d29a10097f4bdb28ea30 /fxjs/xfa/cjx_object.h
parent594b3eeeaa61a2c0a6d84df3e17ea587f3b15c23 (diff)
downloadpdfium-640d8ffad8536c789103892c7a4e69e5d30172c8.tar.xz
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 <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/xfa/cjx_object.h')
-rw-r--r--fxjs/xfa/cjx_object.h17
1 files changed, 12 insertions, 5 deletions
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 <typename T>
- T* GetProperty(int32_t index, XFA_Element eType, bool bCreateProperty) {
- return static_cast<T*>(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<T*>(node);
+ }
+ template <typename T>
+ T* GetOrCreateProperty(int32_t index, XFA_Element eType) {
+ return static_cast<T*>(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<CXFA_Node*, int32_t> 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);