summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_node.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-27 18:10:47 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-27 18:10:47 +0000
commitf473672fd6305fe97c749bde3b92e3c9c90e88d0 (patch)
treefe1ec0af4f66a801c7a08fd762e61b065b89d4ec /xfa/fxfa/parser/cxfa_node.h
parent3636a854af15219fd679ed54207abcdad3283b9b (diff)
downloadpdfium-f473672fd6305fe97c749bde3b92e3c9c90e88d0.tar.xz
Generate XFA node classes
This CL adds concrete classes for each of the XFA Node types. Change-Id: Ieac8e2fcd5d13c61daa27fc63e3d80abb7aa7a29 Reviewed-on: https://pdfium-review.googlesource.com/18271 Reviewed-by: Tom Sepez <tsepez@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.h33
1 files changed, 29 insertions, 4 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index dc4710a9c6..7b7086ecb5 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -9,6 +9,7 @@
#include <map>
#include <memory>
+#include <utility>
#include <vector>
#include "core/fxcrt/fx_string.h"
@@ -46,12 +47,28 @@ const XFA_ATTRIBUTEENUMINFO* GetAttributeEnumByID(XFA_ATTRIBUTEENUM eName);
class CXFA_Node : public CXFA_Object {
public:
+ struct PropertyData {
+ XFA_Element property;
+ uint8_t occurance_count;
+ uint8_t flags;
+ };
+
+ static XFA_Element NameToElement(const WideString& name);
static std::unique_ptr<CXFA_Node> Create(CXFA_Document* doc,
- XFA_XDPPACKET packet,
- const XFA_ELEMENTINFO* pElement);
+ XFA_Element element,
+ XFA_XDPPACKET packet);
~CXFA_Node() override;
+ bool IsValidInPacket(XFA_XDPPACKET packet) const;
+
+ bool HasProperty(XFA_Element property) const;
+ bool HasPropertyFlags(XFA_Element property, uint8_t flags) const;
+ uint8_t PropertyOccuranceCount(XFA_Element property) const;
+
+ bool HasAttribute(XFA_Attribute attr) const;
+ XFA_Attribute GetAttribute(size_t i) const;
+
uint32_t GetPacketID() const { return m_ePacket; }
void SetFlag(uint32_t dwFlag, bool bNotify);
@@ -148,18 +165,26 @@ class CXFA_Node : public CXFA_Object {
pdfium::Optional<WideString> GetDefaultCData(XFA_Attribute attr) const;
pdfium::Optional<XFA_ATTRIBUTEENUM> GetDefaultEnum(XFA_Attribute attr) const;
- private:
+ protected:
CXFA_Node(CXFA_Document* pDoc,
uint16_t ePacket,
+ uint32_t validPackets,
XFA_ObjectType oType,
XFA_Element eType,
+ const PropertyData* properties,
+ const XFA_Attribute* attributes,
const WideStringView& elementName);
+ private:
bool HasFlag(XFA_NodeFlag dwFlag) const;
CXFA_Node* Deprecated_GetPrevSibling();
-
+ const PropertyData* GetPropertyData(XFA_Element property) const;
+ pdfium::Optional<XFA_Element> GetFirstPropertyWithFlag(uint8_t flag);
void OnRemoved(bool bNotify);
+ const PropertyData* m_Properties;
+ const XFA_Attribute* m_Attributes;
+ uint32_t m_ValidPackets;
CXFA_Node* m_pNext;
CXFA_Node* m_pChild;
CXFA_Node* m_pLastChild;