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

Side by Side Diff: core/fpdfapi/parser/cpdf_string.cpp

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (Closed)
Patch Set: rebase Created 4 years, 1 month 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/fpdfapi/parser/cpdf_string.h ('k') | core/fpdfapi/parser/cpdf_syntax_parser.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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/fpdfapi/parser/cpdf_string.h" 7 #include "core/fpdfapi/parser/cpdf_string.h"
8 8
9 #include <utility>
10
9 #include "core/fpdfapi/parser/fpdf_parser_decode.h" 11 #include "core/fpdfapi/parser/fpdf_parser_decode.h"
10 #include "third_party/base/ptr_util.h" 12 #include "third_party/base/ptr_util.h"
11 13
12 CPDF_String::CPDF_String() : m_bHex(false) {} 14 CPDF_String::CPDF_String() : m_bHex(false) {}
13 15
14 CPDF_String::CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool, 16 CPDF_String::CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool,
15 const CFX_ByteString& str, 17 const CFX_ByteString& str,
16 bool bHex) 18 bool bHex)
17 : m_String(str), m_bHex(bHex) { 19 : m_String(str), m_bHex(bHex) {
18 if (pPool) 20 if (pPool)
19 m_String = pPool->Intern(m_String); 21 m_String = pPool->Intern(m_String);
20 } 22 }
21 23
22 CPDF_String::CPDF_String(const CFX_WideString& str) : m_bHex(false) { 24 CPDF_String::CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool,
23 m_String = PDF_EncodeText(str); 25 const CFX_WideString& str)
26 : m_String(PDF_EncodeText(str)), m_bHex(false) {
27 if (pPool)
28 m_String = pPool->Intern(m_String);
24 } 29 }
25 30
26 CPDF_String::~CPDF_String() {} 31 CPDF_String::~CPDF_String() {}
27 32
28 CPDF_Object::Type CPDF_String::GetType() const { 33 CPDF_Object::Type CPDF_String::GetType() const {
29 return STRING; 34 return STRING;
30 } 35 }
31 36
32 std::unique_ptr<CPDF_Object> CPDF_String::Clone() const { 37 std::unique_ptr<CPDF_Object> CPDF_String::Clone() const {
33 auto pRet = pdfium::MakeUnique<CPDF_String>(); 38 auto pRet = pdfium::MakeUnique<CPDF_String>();
(...skipping 18 matching lines...) Expand all
52 return this; 57 return this;
53 } 58 }
54 59
55 const CPDF_String* CPDF_String::AsString() const { 60 const CPDF_String* CPDF_String::AsString() const {
56 return this; 61 return this;
57 } 62 }
58 63
59 CFX_WideString CPDF_String::GetUnicodeText() const { 64 CFX_WideString CPDF_String::GetUnicodeText() const {
60 return PDF_DecodeText(m_String); 65 return PDF_DecodeText(m_String);
61 } 66 }
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_string.h ('k') | core/fpdfapi/parser/cpdf_syntax_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698