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 #ifndef CORE_SRC_FXCODEC_JBIG2_JBIG2_LIST_H_ | 7 #ifndef CORE_SRC_FXCODEC_JBIG2_JBIG2_LIST_H_ |
8 #define CORE_SRC_FXCODEC_JBIG2_JBIG2_LIST_H_ | 8 #define CORE_SRC_FXCODEC_JBIG2_JBIG2_LIST_H_ |
9 | 9 |
| 10 #include <stdlib.h> |
| 11 |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 // A poor man's ScopedVector for pointers of TYPE. | 14 // A poor man's ScopedVector for pointers of TYPE. |
13 // Owns all the pointers contained within and deletes them on destruction. | 15 // Owns all the pointers contained within and deletes them on destruction. |
14 template <class TYPE> | 16 template <class TYPE> |
15 class CJBig2_List { | 17 class CJBig2_List { |
16 public: | 18 public: |
17 CJBig2_List() {} | 19 CJBig2_List() {} |
18 explicit CJBig2_List(size_t count) { resize(count); } | 20 explicit CJBig2_List(size_t count) { resize(count); } |
19 | 21 |
(...skipping 25 matching lines...) Expand all Loading... |
45 for (size_t i = count; i < size(); ++i) | 47 for (size_t i = count; i < size(); ++i) |
46 delete m_vector[i]; | 48 delete m_vector[i]; |
47 m_vector.resize(count); | 49 m_vector.resize(count); |
48 } | 50 } |
49 | 51 |
50 private: | 52 private: |
51 std::vector<TYPE*> m_vector; | 53 std::vector<TYPE*> m_vector; |
52 }; | 54 }; |
53 | 55 |
54 #endif // CORE_SRC_FXCODEC_JBIG2_JBIG2_LIST_H_ | 56 #endif // CORE_SRC_FXCODEC_JBIG2_JBIG2_LIST_H_ |
OLD | NEW |