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

Side by Side Diff: core/fpdfapi/parser/cpdf_dictionary.h

Issue 2420743002: Make CPDF_Image() constructors saner. (Closed)
Patch Set: typo 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/fpdfapi/parser/cpdf_array.h ('k') | core/fpdfapi/parser/cpdf_object.h » ('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 #ifndef CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_ 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_
8 #define CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_ 8 #define CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_
9 9
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 12
13 #include "core/fpdfapi/parser/cpdf_object.h" 13 #include "core/fpdfapi/parser/cpdf_object.h"
14 #include "core/fxcrt/cfx_string_pool_template.h" 14 #include "core/fxcrt/cfx_string_pool_template.h"
15 #include "core/fxcrt/cfx_weak_ptr.h" 15 #include "core/fxcrt/cfx_weak_ptr.h"
16 #include "core/fxcrt/fx_coordinates.h" 16 #include "core/fxcrt/fx_coordinates.h"
17 #include "core/fxcrt/fx_string.h" 17 #include "core/fxcrt/fx_string.h"
18 #include "third_party/base/ptr_util.h"
18 19
19 class CPDF_IndirectObjectHolder; 20 class CPDF_IndirectObjectHolder;
20 21
21 class CPDF_Dictionary : public CPDF_Object { 22 class CPDF_Dictionary : public CPDF_Object {
22 public: 23 public:
23 using iterator = std::map<CFX_ByteString, CPDF_Object*>::iterator; 24 using iterator = std::map<CFX_ByteString, CPDF_Object*>::iterator;
24 using const_iterator = std::map<CFX_ByteString, CPDF_Object*>::const_iterator; 25 using const_iterator = std::map<CFX_ByteString, CPDF_Object*>::const_iterator;
25 26
26 CPDF_Dictionary(); 27 CPDF_Dictionary();
27 explicit CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool); 28 explicit CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 92
92 CFX_ByteString MaybeIntern(const CFX_ByteString& str); 93 CFX_ByteString MaybeIntern(const CFX_ByteString& str);
93 CPDF_Object* CloneNonCyclic( 94 CPDF_Object* CloneNonCyclic(
94 bool bDirect, 95 bool bDirect,
95 std::set<const CPDF_Object*>* visited) const override; 96 std::set<const CPDF_Object*>* visited) const override;
96 97
97 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; 98 CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
98 std::map<CFX_ByteString, CPDF_Object*> m_Map; 99 std::map<CFX_ByteString, CPDF_Object*> m_Map;
99 }; 100 };
100 101
102 using UniqueDictionary =
103 std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Object>>;
104
101 inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) { 105 inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) {
102 return obj ? obj->AsDictionary() : nullptr; 106 return obj ? obj->AsDictionary() : nullptr;
103 } 107 }
104 108
105 inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) { 109 inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) {
106 return obj ? obj->AsDictionary() : nullptr; 110 return obj ? obj->AsDictionary() : nullptr;
107 } 111 }
108 112
113 inline UniqueDictionary ToDictionary(UniqueObject obj) {
114 return UniqueDictionary(ToDictionary(obj.release()));
Lei Zhang 2016/10/13 22:35:01 If |obj| is not a dictionary, then doesn't the rel
Tom Sepez 2016/10/13 22:46:30 right. Fixing all these.
115 }
116
109 #endif // CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_ 117 #endif // CORE_FPDFAPI_PARSER_CPDF_DICTIONARY_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_array.h ('k') | core/fpdfapi/parser/cpdf_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698