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

Side by Side Diff: core/fxcodec/jbig2/JBig2_List.h

Issue 1800523005: Move core/src/ up to core/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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/fxcodec/jbig2/JBig2_Image.cpp ('k') | core/fxcodec/jbig2/JBig2_Page.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 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 #ifndef CORE_SRC_FXCODEC_JBIG2_JBIG2_LIST_H_ 7 #ifndef CORE_FXCODEC_JBIG2_JBIG2_LIST_H_
8 #define CORE_SRC_FXCODEC_JBIG2_JBIG2_LIST_H_ 8 #define CORE_FXCODEC_JBIG2_JBIG2_LIST_H_
9 9
10 #include <stdlib.h> 10 #include <stdlib.h>
11 11
12 #include <vector> 12 #include <vector>
13 13
14 // A poor man's ScopedVector for pointers of TYPE. 14 // A poor man's ScopedVector for pointers of TYPE.
15 // Owns all the pointers contained within and deletes them on destruction. 15 // Owns all the pointers contained within and deletes them on destruction.
16 template <class TYPE> 16 template <class TYPE>
17 class CJBig2_List { 17 class CJBig2_List {
18 public: 18 public:
19 CJBig2_List() {} 19 CJBig2_List() {}
20 explicit CJBig2_List(size_t count) { resize(count); } 20 explicit CJBig2_List(size_t count) { resize(count); }
21 21
22 ~CJBig2_List() { 22 ~CJBig2_List() { clear(); }
23 clear();
24 }
25 23
26 TYPE* get(size_t index) const { return m_vector[index]; } 24 TYPE* get(size_t index) const { return m_vector[index]; }
27 TYPE* back() const { return m_vector.back(); } 25 TYPE* back() const { return m_vector.back(); }
28 size_t size() const { return m_vector.size(); } 26 size_t size() const { return m_vector.size(); }
29 27
30 // Deletes all the pointers contained within. 28 // Deletes all the pointers contained within.
31 void clear() { 29 void clear() {
32 for (size_t i = 0; i < m_vector.size(); ++i) 30 for (size_t i = 0; i < m_vector.size(); ++i)
33 delete m_vector[i]; 31 delete m_vector[i];
34 m_vector.clear(); 32 m_vector.clear();
(...skipping 11 matching lines...) Expand all
46 void resize(size_t count) { 44 void resize(size_t count) {
47 for (size_t i = count; i < size(); ++i) 45 for (size_t i = count; i < size(); ++i)
48 delete m_vector[i]; 46 delete m_vector[i];
49 m_vector.resize(count); 47 m_vector.resize(count);
50 } 48 }
51 49
52 private: 50 private:
53 std::vector<TYPE*> m_vector; 51 std::vector<TYPE*> m_vector;
54 }; 52 };
55 53
56 #endif // CORE_SRC_FXCODEC_JBIG2_JBIG2_LIST_H_ 54 #endif // CORE_FXCODEC_JBIG2_JBIG2_LIST_H_
OLDNEW
« no previous file with comments | « core/fxcodec/jbig2/JBig2_Image.cpp ('k') | core/fxcodec/jbig2/JBig2_Page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698