summaryrefslogtreecommitdiff
path: root/xfa/fde
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fde')
-rw-r--r--xfa/fde/xml/fde_xml_imp.cpp19
-rw-r--r--xfa/fde/xml/fde_xml_imp.h14
2 files changed, 16 insertions, 17 deletions
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp
index f333b4fcda..7880804367 100644
--- a/xfa/fde/xml/fde_xml_imp.cpp
+++ b/xfa/fde/xml/fde_xml_imp.cpp
@@ -7,6 +7,7 @@
#include "xfa/fde/xml/fde_xml_imp.h"
#include <algorithm>
+#include <utility>
#include "core/fxcrt/fx_ext.h"
#include "core/fxcrt/fx_safe_types.h"
@@ -957,29 +958,27 @@ void CFDE_XMLDoc::Reset(bool bInitRoot) {
}
void CFDE_XMLDoc::ReleaseParser() {
- if (m_pXMLParser) {
- m_pXMLParser->Release();
- m_pXMLParser = nullptr;
- }
+ m_pXMLParser.reset();
if (m_pSyntaxParser) {
m_pSyntaxParser->Release();
m_pSyntaxParser = nullptr;
}
}
-bool CFDE_XMLDoc::LoadXML(CFDE_XMLParser* pXMLParser) {
+bool CFDE_XMLDoc::LoadXML(std::unique_ptr<IFDE_XMLParser> pXMLParser) {
if (!pXMLParser)
return false;
Reset(true);
- m_pXMLParser = pXMLParser;
- return !!m_pXMLParser;
+ m_pXMLParser = std::move(pXMLParser);
+ return true;
}
int32_t CFDE_XMLDoc::DoLoad(IFX_Pause* pPause) {
- if (m_iStatus >= 100)
- return m_iStatus;
- return m_iStatus = m_pXMLParser->DoParser(pPause);
+ if (m_iStatus < 100)
+ m_iStatus = m_pXMLParser->DoParser(pPause);
+
+ return m_iStatus;
}
void CFDE_XMLDoc::CloseXML() {
diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h
index 283184aadc..8571f1b9f1 100644
--- a/xfa/fde/xml/fde_xml_imp.h
+++ b/xfa/fde/xml/fde_xml_imp.h
@@ -7,6 +7,8 @@
#ifndef XFA_FDE_XML_FDE_XML_IMP_H_
#define XFA_FDE_XML_FDE_XML_IMP_H_
+#include <memory>
+
#include "core/fxcrt/fx_system.h"
#include "xfa/fde/xml/fde_xml.h"
#include "xfa/fgas/crt/fgas_memory.h"
@@ -19,8 +21,8 @@ class CFDE_XMLElement;
class CFDE_XMLText;
class CFDE_XMLDoc;
class CFDE_XMLDOMParser;
-class CFDE_XMLParser;
class CFDE_XMLSyntaxParser;
+class IFDE_XMLParser;
class CFDE_XMLNode : public CFX_Target {
public:
@@ -193,7 +195,7 @@ class CFDE_XMLDoc : public CFX_Target {
CFDE_XMLDoc();
~CFDE_XMLDoc() override;
- bool LoadXML(CFDE_XMLParser* pXMLParser);
+ bool LoadXML(std::unique_ptr<IFDE_XMLParser> pXMLParser);
int32_t DoLoad(IFX_Pause* pPause = nullptr);
void CloseXML();
CFDE_XMLNode* GetRoot() const { return m_pRoot; }
@@ -209,14 +211,12 @@ class CFDE_XMLDoc : public CFX_Target {
int32_t m_iStatus;
CFDE_XMLNode* m_pRoot;
CFDE_XMLSyntaxParser* m_pSyntaxParser;
- CFDE_XMLParser* m_pXMLParser;
+ std::unique_ptr<IFDE_XMLParser> m_pXMLParser;
};
-class CFDE_XMLParser {
+class IFDE_XMLParser {
public:
- virtual ~CFDE_XMLParser() {}
-
- virtual void Release() = 0;
+ virtual ~IFDE_XMLParser() {}
virtual int32_t DoParser(IFX_Pause* pPause) = 0;
};