summaryrefslogtreecommitdiff
path: root/core/fxcrt/xml/cfx_xmltext.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/xml/cfx_xmltext.h')
-rw-r--r--core/fxcrt/xml/cfx_xmltext.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/fxcrt/xml/cfx_xmltext.h b/core/fxcrt/xml/cfx_xmltext.h
index c5c168059d..f7feae669e 100644
--- a/core/fxcrt/xml/cfx_xmltext.h
+++ b/core/fxcrt/xml/cfx_xmltext.h
@@ -31,4 +31,13 @@ class CFX_XMLText : public CFX_XMLNode {
WideString m_wsText;
};
+inline bool IsXMLText(CFX_XMLNode* pNode) {
+ FX_XMLNODETYPE type = pNode->GetType();
+ return type == FX_XMLNODE_Text || type == FX_XMLNODE_CharData;
+}
+
+inline CFX_XMLText* ToXMLText(CFX_XMLNode* pNode) {
+ return pNode && IsXMLText(pNode) ? static_cast<CFX_XMLText*>(pNode) : nullptr;
+}
+
#endif // CORE_FXCRT_XML_CFX_XMLTEXT_H_