OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../include/fxcrt/fx_xml.h" | 7 #include "../../include/fxcrt/fx_xml.h" |
8 #include "xml_int.h" | 8 #include "xml_int.h" |
9 CXML_Parser::~CXML_Parser() | 9 CXML_Parser::~CXML_Parser() |
10 { | 10 { |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 FX_BOOL CXML_Element::HasAttr(FX_BSTR name) const | 663 FX_BOOL CXML_Element::HasAttr(FX_BSTR name) const |
664 { | 664 { |
665 CFX_ByteStringC bsSpace, bsName; | 665 CFX_ByteStringC bsSpace, bsName; |
666 FX_XML_SplitQualifiedName(name, bsSpace, bsName); | 666 FX_XML_SplitQualifiedName(name, bsSpace, bsName); |
667 return m_AttrMap.Lookup(bsSpace, bsName) != NULL; | 667 return m_AttrMap.Lookup(bsSpace, bsName) != NULL; |
668 } | 668 } |
669 FX_BOOL CXML_Element::GetAttrValue(FX_BSTR name, CFX_WideString& attribute) cons
t | 669 FX_BOOL CXML_Element::GetAttrValue(FX_BSTR name, CFX_WideString& attribute) cons
t |
670 { | 670 { |
671 CFX_ByteStringC bsSpace, bsName; | 671 CFX_ByteStringC bsSpace, bsName; |
672 FX_XML_SplitQualifiedName(name, bsSpace, bsName); | 672 FX_XML_SplitQualifiedName(name, bsSpace, bsName); |
673 const CFX_WideString* pValue = m_AttrMap.Lookup(bsSpace, bsName); | 673 return GetAttrValue(bsSpace, bsName, attribute); |
674 if (pValue) { | |
675 attribute = CFX_WideString((FX_LPCWSTR)pValue, pValue->GetLength()); | |
676 return TRUE; | |
677 } | |
678 return FALSE; | |
679 } | 674 } |
680 FX_BOOL CXML_Element::GetAttrValue(FX_BSTR space, FX_BSTR name, CFX_WideString&
attribute) const | 675 FX_BOOL CXML_Element::GetAttrValue(FX_BSTR space, FX_BSTR name, CFX_WideString&
attribute) const |
681 { | 676 { |
682 const CFX_WideString* pValue = m_AttrMap.Lookup(space, name); | 677 const CFX_WideString* pValue = m_AttrMap.Lookup(space, name); |
683 if (pValue) { | 678 if (pValue) { |
684 attribute = CFX_WideString((FX_LPCWSTR)pValue, pValue->GetLength()); | 679 attribute = *pValue; |
685 return TRUE; | 680 return TRUE; |
686 } | 681 } |
687 return FALSE; | 682 return FALSE; |
688 } | 683 } |
689 FX_BOOL CXML_Element::GetAttrInteger(FX_BSTR name, int& attribute) const | 684 FX_BOOL CXML_Element::GetAttrInteger(FX_BSTR name, int& attribute) const |
690 { | 685 { |
691 CFX_ByteStringC bsSpace, bsName; | 686 CFX_ByteStringC bsSpace, bsName; |
692 FX_XML_SplitQualifiedName(name, bsSpace, bsName); | 687 FX_XML_SplitQualifiedName(name, bsSpace, bsName); |
693 const CFX_WideString* pwsValue = m_AttrMap.Lookup(bsSpace, bsName); | 688 const CFX_WideString* pwsValue = m_AttrMap.Lookup(bsSpace, bsName); |
694 if (pwsValue) { | 689 if (pwsValue) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 } | 855 } |
861 void CXML_AttrMap::RemoveAll() | 856 void CXML_AttrMap::RemoveAll() |
862 { | 857 { |
863 if (!m_pMap) { | 858 if (!m_pMap) { |
864 return; | 859 return; |
865 } | 860 } |
866 m_pMap->RemoveAll(); | 861 m_pMap->RemoveAll(); |
867 delete m_pMap; | 862 delete m_pMap; |
868 m_pMap = NULL; | 863 m_pMap = NULL; |
869 } | 864 } |
OLD | NEW |