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

Side by Side Diff: core/fxcrt/fx_xml_parser.cpp

Issue 2386273004: Add ptr_util.h from base until std::make_unique<> available (Closed)
Patch Set: 2016 Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « core/fxcrt/fx_memory.h ('k') | core/fxge/agg/fx_agg_driver.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "core/fxcrt/fx_ext.h" 11 #include "core/fxcrt/fx_ext.h"
12 #include "core/fxcrt/fx_xml.h" 12 #include "core/fxcrt/fx_xml.h"
13 #include "third_party/base/ptr_util.h"
13 #include "third_party/base/stl_util.h" 14 #include "third_party/base/stl_util.h"
14 15
15 CXML_DataBufAcc::CXML_DataBufAcc(const uint8_t* pBuffer, size_t size) 16 CXML_DataBufAcc::CXML_DataBufAcc(const uint8_t* pBuffer, size_t size)
16 : m_pBuffer(pBuffer), m_dwSize(size), m_dwCurPos(0) {} 17 : m_pBuffer(pBuffer), m_dwSize(size), m_dwCurPos(0) {}
17 18
18 CXML_DataBufAcc::~CXML_DataBufAcc() {} 19 CXML_DataBufAcc::~CXML_DataBufAcc() {}
19 20
20 void CXML_DataBufAcc::Release() { 21 void CXML_DataBufAcc::Release() {
21 delete this; 22 delete this;
22 } 23 }
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 if (item.Matches(space, name)) 888 if (item.Matches(space, name))
888 return &item.m_Value; 889 return &item.m_Value;
889 } 890 }
890 return nullptr; 891 return nullptr;
891 } 892 }
892 893
893 void CXML_AttrMap::SetAt(const CFX_ByteString& space, 894 void CXML_AttrMap::SetAt(const CFX_ByteString& space,
894 const CFX_ByteString& name, 895 const CFX_ByteString& name,
895 const CFX_WideString& value) { 896 const CFX_WideString& value) {
896 if (!m_pMap) 897 if (!m_pMap)
897 m_pMap = WrapUnique(new std::vector<CXML_AttrItem>); 898 m_pMap = pdfium::MakeUnique<std::vector<CXML_AttrItem>>();
898 899
899 for (CXML_AttrItem& item : *m_pMap) { 900 for (CXML_AttrItem& item : *m_pMap) {
900 if (item.Matches(space, name)) { 901 if (item.Matches(space, name)) {
901 item.m_Value = value; 902 item.m_Value = value;
902 return; 903 return;
903 } 904 }
904 } 905 }
905 906
906 m_pMap->push_back({space, name, CFX_WideString(value)}); 907 m_pMap->push_back({space, name, CFX_WideString(value)});
907 } 908 }
908 909
909 int CXML_AttrMap::GetSize() const { 910 int CXML_AttrMap::GetSize() const {
910 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0; 911 return m_pMap ? pdfium::CollectionSize<int>(*m_pMap) : 0;
911 } 912 }
912 913
913 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const { 914 CXML_AttrItem& CXML_AttrMap::GetAt(int index) const {
914 return (*m_pMap)[index]; 915 return (*m_pMap)[index];
915 } 916 }
OLDNEW
« no previous file with comments | « core/fxcrt/fx_memory.h ('k') | core/fxge/agg/fx_agg_driver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698