Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Unified Diff: xfa/fde/xml/fde_xml_imp.h

Issue 1981003002: Replace Release() { delete this; } in fde_xml_imp.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: One more unique_ptr Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | xfa/fde/xml/fde_xml_imp.cpp » ('j') | xfa/fxfa/app/xfa_ffdoc.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fde/xml/fde_xml_imp.h
diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h
index bad970e5befe24b0a1b50aa4f0db3af7ea6382f4..51b73f526443e59805b73fdf9d79ddd5e1c4dff2 100644
--- a/xfa/fde/xml/fde_xml_imp.h
+++ b/xfa/fde/xml/fde_xml_imp.h
@@ -40,8 +40,8 @@ class CFDE_XMLNode : public CFX_Target {
};
CFDE_XMLNode();
+ ~CFDE_XMLNode() override;
- virtual void Release() { delete this; }
virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Unknown; }
virtual int32_t CountChildNodes() const;
virtual CFDE_XMLNode* GetChildNode(int32_t index) const;
@@ -60,18 +60,19 @@ class CFDE_XMLNode : public CFX_Target {
virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive);
virtual void SaveXMLNode(IFX_Stream* pXMLStream);
- public:
- ~CFDE_XMLNode();
void CloneChildren(CFDE_XMLNode* pClone);
+
CFDE_XMLNode* m_pParent;
CFDE_XMLNode* m_pChild;
CFDE_XMLNode* m_pPrior;
CFDE_XMLNode* m_pNext;
};
+
class CFDE_XMLInstruction : public CFDE_XMLNode {
public:
CFDE_XMLInstruction(const CFX_WideString& wsTarget);
- virtual void Release() { delete this; }
+ ~CFDE_XMLInstruction() override {}
Lei Zhang 2016/05/16 20:38:08 Move the impl to xfa/fde/xml/fde_xml_imp.cpp ? Dit
Tom Sepez 2016/05/16 21:29:05 Done.
+
virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Instruction; }
virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive);
virtual void GetTargetName(CFX_WideString& wsTarget) const {
@@ -99,16 +100,16 @@ class CFDE_XMLInstruction : public CFDE_XMLNode {
virtual void AppendData(const CFX_WideString& wsData);
virtual void RemoveData(int32_t index);
- public:
- ~CFDE_XMLInstruction() {}
CFX_WideString m_wsTarget;
CFX_WideStringArray m_Attributes;
CFX_WideStringArray m_TargetData;
};
+
class CFDE_XMLElement : public CFDE_XMLNode {
public:
CFDE_XMLElement(const CFX_WideString& wsTag);
- virtual void Release() { delete this; }
+ ~CFDE_XMLElement() override;
+
virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Element; }
virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive);
virtual void GetTagName(CFX_WideString& wsTag) const;
@@ -135,33 +136,33 @@ class CFDE_XMLElement : public CFDE_XMLNode {
virtual void GetTextData(CFX_WideString& wsText) const;
virtual void SetTextData(const CFX_WideString& wsText);
- public:
- ~CFDE_XMLElement();
CFX_WideString m_wsTag;
CFX_WideStringArray m_Attributes;
};
+
class CFDE_XMLText : public CFDE_XMLNode {
public:
CFDE_XMLText(const CFX_WideString& wsText);
- virtual void Release() { delete this; }
+ ~CFDE_XMLText() override {}
+
virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Text; }
virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive);
virtual void GetText(CFX_WideString& wsText) const { wsText = m_wsText; }
virtual void SetText(const CFX_WideString& wsText) { m_wsText = wsText; }
- public:
- ~CFDE_XMLText() {}
CFX_WideString m_wsText;
};
+
class CFDE_XMLDeclaration : public CFDE_XMLNode {
public:
CFDE_XMLDeclaration() : CFDE_XMLNode() {}
};
+
class CFDE_XMLCharData : public CFDE_XMLDeclaration {
public:
CFDE_XMLCharData(const CFX_WideString& wsCData);
+ ~CFDE_XMLCharData() override {}
- virtual void Release() { delete this; }
virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_CharData; }
virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive);
virtual void GetCharData(CFX_WideString& wsCharData) const {
@@ -171,16 +172,14 @@ class CFDE_XMLCharData : public CFDE_XMLDeclaration {
m_wsCharData = wsCData;
}
- public:
- ~CFDE_XMLCharData() {}
-
CFX_WideString m_wsCharData;
};
+
class CFDE_XMLDoc : public CFX_Target {
public:
CFDE_XMLDoc();
- ~CFDE_XMLDoc();
- virtual void Release() { delete this; }
+ ~CFDE_XMLDoc() override;
+
virtual FX_BOOL LoadXML(IFX_Stream* pXMLStream,
int32_t iXMLPlaneSize = 8192,
int32_t iTextDataSize = 256,
@@ -207,16 +206,14 @@ class CFDE_XMLParser {
public:
virtual ~CFDE_XMLParser() {}
- virtual void Release() = 0;
virtual int32_t DoParser(IFX_Pause* pPause) = 0;
};
class CFDE_XMLDOMParser : public CFDE_XMLParser, public CFX_Target {
public:
CFDE_XMLDOMParser(CFDE_XMLNode* pRoot, CFDE_XMLSyntaxParser* pParser);
- ~CFDE_XMLDOMParser();
+ ~CFDE_XMLDOMParser() override;
- virtual void Release() { delete this; }
virtual int32_t DoParser(IFX_Pause* pPause);
private:
@@ -236,13 +233,13 @@ class CFDE_XMLTAG : public CFX_Target {
FDE_XMLNODETYPE eType;
};
typedef CFX_ObjectStackTemplate<CFDE_XMLTAG> CFDE_XMLTagStack;
+
class CFDE_XMLSAXParser : public CFDE_XMLParser, public CFX_Target {
public:
CFDE_XMLSAXParser(FDE_XMLREADERHANDLER* pHandler,
CFDE_XMLSyntaxParser* pParser);
- ~CFDE_XMLSAXParser();
+ ~CFDE_XMLSAXParser() override;
- virtual void Release() { delete this; }
virtual int32_t DoParser(IFX_Pause* pPause);
private:
@@ -259,11 +256,11 @@ class CFDE_XMLSAXParser : public CFDE_XMLParser, public CFX_Target {
class CFDE_BlockBuffer : public CFX_Target {
public:
CFDE_BlockBuffer(int32_t iAllocStep = 1024 * 1024);
- ~CFDE_BlockBuffer();
+ ~CFDE_BlockBuffer() override;
FX_BOOL InitBuffer(int32_t iBufferSize = 1024 * 1024);
FX_BOOL IsInitialized() { return m_iBufferSize / m_iAllocStep >= 1; }
- void ReleaseBuffer() { delete this; }
+
FX_WCHAR* GetAvailableBlock(int32_t& iIndexInBlock);
inline int32_t GetAllocStep() const { return m_iAllocStep; }
inline int32_t& GetDataLengthRef() { return m_iDataLength; }
@@ -294,8 +291,8 @@ class CFDE_BlockBuffer : public CFX_Target {
class CFDE_XMLSyntaxParser : public CFX_Target {
public:
CFDE_XMLSyntaxParser();
- ~CFDE_XMLSyntaxParser();
- void Release() { delete this; }
+ ~CFDE_XMLSyntaxParser() override;
+
void Init(IFX_Stream* pStream,
int32_t iXMLPlaneSize,
int32_t iTextDataSize = 256);
« no previous file with comments | « no previous file | xfa/fde/xml/fde_xml_imp.cpp » ('j') | xfa/fxfa/app/xfa_ffdoc.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698