blob: 80de95e51e89044341f0b5e989156b3718b9f6eb (
plain) (
blame)
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
|
#ifndef QPDF_SPARSEOHARRAY_HH
#define QPDF_SPARSEOHARRAY_HH
#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/QPDFObject_private.hh>
#include <map>
class QPDF_Array;
class SparseOHArray
{
public:
SparseOHArray() = default;
int
size() const noexcept
{
return n_elements;
}
void append(QPDFObjectHandle oh);
void append(std::shared_ptr<QPDFObject>&& obj);
QPDFObjectHandle at(int idx) const;
void remove_last();
void setAt(int idx, QPDFObjectHandle oh);
void erase(int idx);
void insert(int idx, QPDFObjectHandle oh);
SparseOHArray copy();
void disconnect();
typedef std::map<int, std::shared_ptr<QPDFObject>>::const_iterator
const_iterator;
const_iterator begin() const;
const_iterator end() const;
private:
friend class QPDF_Array;
std::map<int, std::shared_ptr<QPDFObject>> elements;
int n_elements{0};
};
#endif // QPDF_SPARSEOHARRAY_HH
|