summaryrefslogtreecommitdiff
path: root/core/src/fxcodec/jbig2/JBig2_List.h
blob: e033eb23ea4d7b4a9d5ba674f382799f95bf3c75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef _JBIG2_LIST_H_
#define _JBIG2_LIST_H_

#include <vector>

template <class TYPE>
class CJBig2_List {
 public:
  CJBig2_List() {}

  ~CJBig2_List() {
    clear();
  }

  void clear() {
    for (size_t i = 0; i < m_vector.size(); ++i)
      delete m_vector[i];
    m_vector.clear();
  }

  void push_back(TYPE* pItem) { m_vector.push_back(pItem); }

  size_t size() const { return m_vector.size(); }
  void resize(size_t count) { m_vector.resize(count); }

  TYPE* get(size_t index) { return m_vector[index]; }

  TYPE* back() { return m_vector.back(); }

 private:
  std::vector<TYPE*> m_vector;
};

#endif