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 "core/fxcrt/xml_int.h" | 7 #include "core/fxcrt/xml_int.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 if (item.Matches(space, name)) | 887 if (item.Matches(space, name)) |
888 return &item.m_Value; | 888 return &item.m_Value; |
889 } | 889 } |
890 return nullptr; | 890 return nullptr; |
891 } | 891 } |
892 | 892 |
893 void CXML_AttrMap::SetAt(const CFX_ByteString& space, | 893 void CXML_AttrMap::SetAt(const CFX_ByteString& space, |
894 const CFX_ByteString& name, | 894 const CFX_ByteString& name, |
895 const CFX_WideString& value) { | 895 const CFX_WideString& value) { |
896 if (!m_pMap) | 896 if (!m_pMap) |
897 m_pMap.reset(new std::vector<CXML_AttrItem>); | 897 m_pMap = WrapUnique(new std::vector<CXML_AttrItem>); |
898 | 898 |
899 for (CXML_AttrItem& item : *m_pMap) { | 899 for (CXML_AttrItem& item : *m_pMap) { |
900 if (item.Matches(space, name)) { | 900 if (item.Matches(space, name)) { |
901 item.m_Value = value; | 901 item.m_Value = value; |
902 return; | 902 return; |
903 } | 903 } |
904 } | 904 } |
905 | 905 |
906 m_pMap->push_back({space, name, CFX_WideString(value)}); | 906 m_pMap->push_back({space, name, CFX_WideString(value)}); |
907 } | 907 } |
908 | 908 |
909 int CXML_AttrMap::GetSize() const { | 909 int CXML_AttrMap::GetSize() const { |
910 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0; | 910 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0; |
911 } | 911 } |
912 | 912 |
913 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const { | 913 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const { |
914 return (*m_pMap)[index]; | 914 return (*m_pMap)[index]; |
915 } | 915 } |
OLD | NEW |