summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_node.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-12-14 20:51:03 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-14 20:51:03 +0000
commitdf4f30eaaa469c3703118f89579d506209a49237 (patch)
tree881eb4c93dadd3b07414cc950ed5cbbbb3c9693a /xfa/fxfa/parser/cxfa_node.h
parent51ef4a6ca3b4ae9b618cb1c96f84697a2bf4a2b1 (diff)
downloadpdfium-df4f30eaaa469c3703118f89579d506209a49237.tar.xz
Add types to the CXFA_Node::Get*{Child|Sibling}* methods
This CL templates the various Get methods in CXFA_Node in order to return the correct node type. Change-Id: I4f50df6dd9213873deb8f8f262eaf579c6c4ca7d Reviewed-on: https://pdfium-review.googlesource.com/21230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_node.h')
-rw-r--r--xfa/fxfa/parser/cxfa_node.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index c2c7605e85..c9f1505f2e 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -183,12 +183,23 @@ class CXFA_Node : public CXFA_Object {
CXFA_WidgetData* GetContainerWidgetData();
bool GetLocaleName(WideString& wsLocaleName);
XFA_AttributeEnum GetIntact();
+
CXFA_Node* GetFirstChildByName(const WideStringView& wsNodeName) const;
CXFA_Node* GetFirstChildByName(uint32_t dwNodeNameHash) const;
- CXFA_Node* GetFirstChildByClass(XFA_Element eType) const;
+ template <typename T>
+ T* GetFirstChildByClass(XFA_Element eType) const {
+ return static_cast<T*>(GetFirstChildByClassInternal(eType));
+ }
CXFA_Node* GetNextSameNameSibling(uint32_t dwNodeNameHash) const;
- CXFA_Node* GetNextSameNameSibling(const WideStringView& wsNodeName) const;
- CXFA_Node* GetNextSameClassSibling(XFA_Element eType) const;
+ template <typename T>
+ T* GetNextSameNameSibling(const WideStringView& wsNodeName) const {
+ return static_cast<T*>(GetNextSameNameSiblingInternal(wsNodeName));
+ }
+ template <typename T>
+ T* GetNextSameClassSibling(XFA_Element eType) const {
+ return static_cast<T*>(GetNextSameClassSiblingInternal(eType));
+ }
+
int32_t GetNodeSameNameIndex() const;
int32_t GetNodeSameClassIndex() const;
CXFA_Node* GetInstanceMgrOfSubform();
@@ -233,6 +244,10 @@ class CXFA_Node : public CXFA_Object {
CXFA_Node* GetChildInternal(int32_t index,
XFA_Element eType,
bool bOnlyChild);
+ CXFA_Node* GetFirstChildByClassInternal(XFA_Element eType) const;
+ CXFA_Node* GetNextSameNameSiblingInternal(
+ const WideStringView& wsNodeName) const;
+ CXFA_Node* GetNextSameClassSiblingInternal(XFA_Element eType) const;
const PropertyData* const m_Properties;
const AttributeData* const m_Attributes;