From 3522876d5291922ddc62bf1b70d02743b0850673 Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Tue, 8 Jul 2014 15:30:46 -0700 Subject: Remove custom memory manager BUG= R=palmer@chromium.org Review URL: https://codereview.chromium.org/372473003 --- core/include/fxcrt/fx_xml.h | 70 +++++++++++++-------------------------------- 1 file changed, 20 insertions(+), 50 deletions(-) (limited to 'core/include/fxcrt/fx_xml.h') diff --git a/core/include/fxcrt/fx_xml.h b/core/include/fxcrt/fx_xml.h index 19a49cde12..fb46a93591 100644 --- a/core/include/fxcrt/fx_xml.h +++ b/core/include/fxcrt/fx_xml.h @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #ifndef _FX_XML_H_ @@ -12,16 +12,9 @@ class CXML_AttrItem : public CFX_Object { public: - CFX_ByteStringL m_QSpaceName; - CFX_ByteStringL m_AttrName; - CFX_WideStringL m_Value; - - void Empty(IFX_Allocator* pAllocator = NULL) - { - m_QSpaceName.Empty(pAllocator); - m_AttrName.Empty(pAllocator); - m_Value.Empty(pAllocator); - } + CFX_ByteString m_QSpaceName; + CFX_ByteString m_AttrName; + CFX_WideString m_Value; }; class CXML_AttrMap : public CFX_Object { @@ -32,12 +25,12 @@ public: } ~CXML_AttrMap() { - RemoveAll(NULL); + RemoveAll(); } - const CFX_WideStringL* Lookup(FX_BSTR space, FX_BSTR name) const; - void SetAt(FX_BSTR space, FX_BSTR name, FX_WSTR value, IFX_Allocator* pAllocator = NULL); - void RemoveAt(FX_BSTR space, FX_BSTR name, IFX_Allocator* pAllocator = NULL); - void RemoveAll(IFX_Allocator* pAllocator = NULL); + const CFX_WideString* Lookup(FX_BSTR space, FX_BSTR name) const; + void SetAt(FX_BSTR space, FX_BSTR name, FX_WSTR value); + void RemoveAt(FX_BSTR space, FX_BSTR name); + void RemoveAll(); int GetSize() const; CXML_AttrItem& GetAt(int index) const; CFX_ObjectArray* m_pMap; @@ -46,37 +39,23 @@ class CXML_Content : public CFX_Object { public: CXML_Content() : m_bCDATA(FALSE), m_Content() {} - ~CXML_Content() - { - Empty(NULL); - } - void Empty(IFX_Allocator* pAllocator = NULL) - { - m_Content.Empty(pAllocator); - } - void Set(FX_BOOL bCDATA, FX_WSTR content, IFX_Allocator* pAllocator = NULL) + void Set(FX_BOOL bCDATA, FX_WSTR content) { m_bCDATA = bCDATA; - m_Content.Set(content, pAllocator); + m_Content = content; } FX_BOOL m_bCDATA; - CFX_WideStringL m_Content; + CFX_WideString m_Content; }; class CXML_Element : public CFX_Object { public: - - static CXML_Element* Parse(const void* pBuffer, size_t size, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL, IFX_Allocator* pAllocator = NULL); - - static CXML_Element* Parse(IFX_FileRead *pFile, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL, IFX_Allocator* pAllocator = NULL); - - static CXML_Element* Parse(IFX_BufferRead *pBuffer, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL, IFX_Allocator* pAllocator = NULL); - - CXML_Element(FX_BSTR qSpace, FX_BSTR tagName, IFX_Allocator* pAllocator = NULL); - - CXML_Element(FX_BSTR qTagName, IFX_Allocator* pAllocator = NULL); - - CXML_Element(IFX_Allocator* pAllocator = NULL); + static CXML_Element* Parse(const void* pBuffer, size_t size, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); + static CXML_Element* Parse(IFX_FileRead *pFile, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); + static CXML_Element* Parse(IFX_BufferRead *pBuffer, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); + CXML_Element(FX_BSTR qSpace, FX_BSTR tagName); + CXML_Element(FX_BSTR qTagName); + CXML_Element(); ~CXML_Element(); @@ -85,13 +64,10 @@ public: CFX_ByteString GetTagName(FX_BOOL bQualified = FALSE) const; - void GetTagName(CFX_ByteStringL &tagName, FX_BOOL bQualified = FALSE) const; CFX_ByteString GetNamespace(FX_BOOL bQualified = FALSE) const; - void GetNamespace(CFX_ByteStringL &nameSpace, FX_BOOL bQualified = FALSE) const; CFX_ByteString GetNamespaceURI(FX_BSTR qName) const; - void GetNamespaceURI(FX_BSTR qName, CFX_ByteStringL &uri) const; CXML_Element* GetParent() const { @@ -104,7 +80,6 @@ public: } void GetAttrByIndex(int index, CFX_ByteString &space, CFX_ByteString &name, CFX_WideString &value) const; - void GetAttrByIndex(int index, CFX_ByteStringL &space, CFX_ByteStringL &name, CFX_WideStringL &value) const; FX_BOOL HasAttr(FX_BSTR qName) const; @@ -115,7 +90,6 @@ public: GetAttrValue(name, attr); return attr; } - const CFX_WideStringL* GetAttrValuePtr(FX_BSTR name) const; FX_BOOL GetAttrValue(FX_BSTR space, FX_BSTR name, CFX_WideString& attribute) const; CFX_WideString GetAttrValue(FX_BSTR space, FX_BSTR name) const @@ -124,7 +98,6 @@ public: GetAttrValue(space, name, attr); return attr; } - const CFX_WideStringL* GetAttrValuePtr(FX_BSTR space, FX_BSTR name) const; FX_BOOL GetAttrInteger(FX_BSTR name, int& attribute) const; int GetAttrInteger(FX_BSTR name) const @@ -165,7 +138,6 @@ public: ChildType GetChildType(FX_DWORD index) const; CFX_WideString GetContent(FX_DWORD index) const; - const CFX_WideStringL* GetContentPtr(FX_DWORD index) const; CXML_Element* GetElement(FX_DWORD index) const; @@ -195,10 +167,8 @@ public: protected: CXML_Element* m_pParent; - - CFX_ByteStringL m_QSpaceName; - - CFX_ByteStringL m_TagName; + CFX_ByteString m_QSpaceName; + CFX_ByteString m_TagName; CXML_AttrMap m_AttrMap; -- cgit v1.2.3